OROCHI
 
Loading...
Searching...
No Matches
GxGuiTab.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13#if GX_DEVELOP
14
15GX_CORE_NAMESPACE_BEGIN()
16
17//===========================================================================
19//===========================================================================
20class GxGuiTab : public GxGuiBase
21{
22 //-----------------------------------------------------------
24 //-----------------------------------------------------------
26public:
27 GX_RTTI_CLASS(GxGuiTab, GxGuiBase)
28 // 基底継承クラス用禁止宣言
30
31
32 enum class TAB_TYPE
33 {
34 COMPRESS = 0,
35 LINEFEED
36 };
37
38 class GxOneTab;
39protected:
40
42 static constexpr u32 TAB_HEIGHT = 20;
44 static constexpr u32 TAB_X_MARGIN = 8;
46 static constexpr u32 TAB_Y_MARGIN = 3;
48 static constexpr u32 TAB_BUTTON_SIZE = TAB_HEIGHT - TAB_Y_MARGIN * 2;
50 static constexpr u32 TAB_BUTTON_Y_MARGIN = (TAB_HEIGHT - TAB_BUTTON_SIZE) / 2;
52 static constexpr u32 TAB_MAX_WIDTH = 80;
53
55 //-----------------------------------------------------------
57 //-----------------------------------------------------------
59public:
61 GxGuiTab(void);
63 GxGuiTab( TAB_TYPE type );
64
66 //-----------------------------------------------------------
68 //-----------------------------------------------------------
70public:
72 b32 initialize( void ) override;
73
75 void cleanup( void ) override;
76
78 void update(void) override;
79
81 void onNoClientDraw( void ) override;
82
84 GxSize getUseRegionSize(void) const override;
85
87 void addTab(GxGuiBase* pGuiForm, GX_CSTR pTitle, u32 index = U32_MAX, b32 useCloseButton = false);
88
90 void setTab(GxGuiBase* pGuiForm, GX_CSTR pTitle, u32 index = U32_MAX);
91
93 void eraseTab(GxOneTab* pOneTab);
95 void eraseTabFromIndex(u32 index);
96
98 void eraseAllTab(void);
99
101 void updateTabRect(void);
102
103protected:
105 void onNoClientMouseDown(const GxPoint2& position, u32 button) override;
106
108 void onSize(const GxSize& size) override;
109
111 GxRect calculateClientRect(const GxRect& clientRect) const override;
112
114 void setCurrent(GxOneTab* pOneTab);
115
117 u32 getHeightTotalTabRect(void)const;
118
120 //-----------------------------------------------------------
122 //-----------------------------------------------------------
124public:
126 void setCurrentIndex( u32 index );
127
129 u32 getCurrentIndex( void );
130
132 GxOneTab* getTab(u32 index) const;
133
135 s32 getIndex(const GxGuiBase* pGuiForm) const;
136
138 GxGuiBase* getCurrentGui( void );
139
142 constexpr void setTabHeight( s32 height ){ _tabHeight = height; }
143
145 constexpr u32 getTabCount(void) const { return _pListTab->getCount(); }
146
148 //-----------------------------------------------------------
150 //-----------------------------------------------------------
152private:
153 GxArrayClassBaseReference* _pListTab;
154 GxOneTab* _pCurrentTab;
155 s32 _tabHeight;
156 TAB_TYPE _type;
157
159};
160
161//===========================================================================
163//===========================================================================
164class GxGuiTab::GxOneTab : public GxClassBaseReference
165{
166 //-----------------------------------------------------------
168 //-----------------------------------------------------------
170public:
171 GX_RTTI_CLASS(GxOneTab, GxClassBaseReference)
172 // GxClassBaseReference継承クラス用禁止宣言
174 // new, delete定義
175 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
176
177
178 //-----------------------------------------------------------
180 //-----------------------------------------------------------
182public:
184 GxOneTab( GxGuiTab* pParent, GxGuiBase* pGuiBase, GX_CSTR title, b32 useCloseButton );
185private:
187 GxOneTab(void) {}
188
190 //-----------------------------------------------------------
192 //-----------------------------------------------------------
194private:
196 void updateTitle(void);
197
199 //-----------------------------------------------------------
201 //-----------------------------------------------------------
203public:
206 GX_FORCE_INLINE const GxString& getTitle(void) const { return _title; }
208 GX_FORCE_INLINE void setTitle(GX_CSTR title) { _title = title; updateTitle(); }
211 GX_FORCE_INLINE const GxString& getClipTitle(void) const { return _clipTitle; }
212
215 GX_FORCE_INLINE const GxRect& getTabRect(void) const { return _tabRect; }
217 void setTabRect(const GxRect& tabRect);
218
221 constexpr GxGuiBase* getGui(void) const { return _pGui; }
222
224 constexpr GxGuiButton* getCloseButton(void) const { return _pCloseButton; }
226 constexpr u32 getTitleRightMargin(void) const { return _pCloseButton ? TAB_BUTTON_SIZE + TAB_X_MARGIN : TAB_X_MARGIN; }
227
229 //-----------------------------------------------------------
231 //-----------------------------------------------------------
233protected:
234 GxRect _tabRect;
235 GxString _title;
236 GxString _clipTitle;
237 GxGuiBase* _pGui;
238 GxGuiButton* _pCloseButton;
239
241};
242
243GX_CORE_NAMESPACE_END()
244
245#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
参照カウンタ用配列クラス
Definition GxArrayClassBase.h:145
参照オブジェクト基底クラス
Definition GxBase.h:122
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173