Advertisement
tonti666

Untitled

Sep 17th, 2017
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1.  
  2. #pragma once
  3.  
  4. #include "GUI.h"
  5.  
  6. #include "Interfaces.h"
  7.  
  8. void CWindow::SetPosition(int x, int y)
  9. {
  10. m_x = x; m_y = y;
  11. }
  12.  
  13. void CWindow::SetSize(int w, int h)
  14. {
  15. m_iWidth = w;
  16. m_iHeight = h;
  17. }
  18.  
  19. void CWindow::SetTitle(std::string title)
  20. {
  21. Title = title;
  22. }
  23.  
  24. void CWindow::RegisterTab(CTab* Tab)
  25. {
  26. if (Tabs.size() == 0)
  27. {
  28. SelectedTab = Tab;
  29. }
  30. Tab->parent = this;
  31. Tabs.push_back(Tab);
  32. }
  33.  
  34. RECT CWindow::GetClientArea()
  35. {
  36. RECT client;
  37. if (m_HasTabs)
  38. client.left = m_x + UI_TAB_WIDTH;
  39. else
  40. client.left = m_x;
  41. client.top = m_y + UI_WIN_TOPHEIGHT + UI_WIN_TITLEHEIGHT;
  42.  
  43. if (m_HasTabs)
  44. client.right = m_iWidth - UI_TAB_WIDTH;
  45. else
  46. client.right = m_iWidth;
  47.  
  48. client.bottom = m_iHeight - UI_WIN_TOPHEIGHT - UI_WIN_TITLEHEIGHT;
  49. return client;
  50. }
  51.  
  52. RECT CWindow::GetTabArea()
  53. {
  54. RECT client;
  55. client.left = m_x;
  56. client.top = m_y + UI_WIN_TOPHEIGHT + UI_WIN_TITLEHEIGHT;
  57. client.right = UI_TAB_WIDTH;
  58. client.bottom = m_iHeight - UI_WIN_TOPHEIGHT - UI_WIN_TITLEHEIGHT;
  59. return client;
  60. }
  61.  
  62. void CWindow::Open()
  63. {
  64. m_bIsOpen = true;
  65. }
  66.  
  67. void CWindow::Close()
  68. {
  69. m_bIsOpen = false;
  70. }
  71.  
  72. void CWindow::Toggle()
  73. {
  74. m_bIsOpen = !m_bIsOpen;
  75. if (m_bIsOpen)
  76. Interfaces::Engine->ClientCmd_Unrestricted("cl_mouseenable 0");
  77. else
  78. Interfaces::Engine->ClientCmd_Unrestricted("cl_mouseenable 1");
  79. }
  80.  
  81. CControl* CWindow::GetFocus()
  82. {
  83. return FocusedControl;
  84. }
  85.  
  86. // TABS ---------------------------------------------------------------------------------------------------
  87.  
  88. void CTab::SetTitle(std::string name)
  89. {
  90. Title = name;
  91. }
  92.  
  93. void CTab::RegisterControl(CControl* control)
  94. {
  95. control->parent = parent;
  96. Controls.push_back(control);
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement