tabctrl.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Combat *
  23. * *
  24. * $Archive:: /Commando/Code/wwui/tabctrl.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 11/06/01 3:51p $*
  29. * *
  30. * $Revision:: 9 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __TAB_CTRL_H
  39. #define __TAB_CTRL_H
  40. #include "dialogcontrol.h"
  41. #include "vector3.h"
  42. #include "vector.h"
  43. #include "render2dsentence.h"
  44. #include "bittype.h"
  45. ////////////////////////////////////////////////////////////////
  46. // Forward declarations
  47. ////////////////////////////////////////////////////////////////
  48. class ChildDialogClass;
  49. ////////////////////////////////////////////////////////////////
  50. // Useful macros
  51. ////////////////////////////////////////////////////////////////
  52. #define TABCTRL_ADD_TAB(tab_ctrl, class_name) { \
  53. ChildDialogClass *new_tab = new class_name; \
  54. tab_ctrl->Add_Tab (new_tab); \
  55. REF_PTR_RELEASE (new_tab); }
  56. ////////////////////////////////////////////////////////////////
  57. //
  58. // TabCtrlClass
  59. //
  60. ////////////////////////////////////////////////////////////////
  61. class TabCtrlClass : public DialogControlClass
  62. {
  63. public:
  64. ////////////////////////////////////////////////////////////////
  65. // Public constructors/destructors
  66. ////////////////////////////////////////////////////////////////
  67. TabCtrlClass (void);
  68. virtual ~TabCtrlClass (void);
  69. ////////////////////////////////////////////////////////////////
  70. // Public methods
  71. ////////////////////////////////////////////////////////////////
  72. //
  73. // From DialogControlClass
  74. //
  75. void Render (void);
  76. bool Wants_Tooltip (void) const { return false; }
  77. //
  78. // Tab control
  79. //
  80. void Add_Tab (ChildDialogClass *dialog);
  81. void Remove_Tab (int index);
  82. int Get_Tab_Count (void) const { return TabList.Count (); }
  83. //
  84. // Selection control
  85. //
  86. void Set_Curr_Tab (int index);
  87. int Get_Curr_Tab (void) const { return CurrTabIndex; }
  88. //
  89. // Apply/Discard support
  90. //
  91. // Note: If either of these methods return false, then the
  92. // dialog should NOT advance.
  93. //
  94. bool Apply_Changes_On_Tabs (void);
  95. bool Discard_Changes_On_Tabs (void);
  96. void Reload_Tabs (void);
  97. protected:
  98. ////////////////////////////////////////////////////////////////
  99. // Protected methods
  100. ////////////////////////////////////////////////////////////////
  101. void On_LButton_Down (const Vector2 &mouse_pos);
  102. void On_LButton_Up (const Vector2 &mouse_pos);
  103. void On_Mouse_Move (const Vector2 &mouse_pos);
  104. void On_Mouse_Wheel (int direction);
  105. void On_Set_Cursor (const Vector2 &mouse_pos);
  106. void On_Set_Focus (void);
  107. void On_Kill_Focus (DialogControlClass *focus);
  108. bool On_Key_Down (uint32 key_id, uint32 key_data);
  109. void On_Create (void);
  110. void Update_Client_Rect (void);
  111. void Create_Control_Renderer (void);
  112. void Create_Text_Renderer (void);
  113. void Create_Glow_Renderer (void);
  114. int Tab_From_Pos (const Vector2 &mouse_pos);
  115. float Pos_From_Tab (int index);
  116. void Free_Tabs (void);
  117. void Update_Bubble (void);
  118. void Update_Selector (void);
  119. ////////////////////////////////////////////////////////////////
  120. // Protected member data
  121. ////////////////////////////////////////////////////////////////
  122. Render2DClass ControlRenderer;
  123. Render2DSentenceClass HilightRenderer;
  124. Render2DSentenceClass TextRenderer;
  125. Render2DSentenceClass HilightGlowRenderer;
  126. Render2DSentenceClass GlowRenderer;
  127. int CurrTabIndex;
  128. int NextBlinkTime;
  129. bool IsBubbleDisplayed;
  130. float SelectorPos;
  131. float ScaleX;
  132. float ScaleY;
  133. RectClass SelRect;
  134. DynamicVectorClass<ChildDialogClass *> TabList;
  135. };
  136. #endif //__TAB_CTRL_H