OROCHI
 
Loading...
Searching...
No Matches
GxGuiMenu.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13#if GX_DEVELOP
14
15GX_CORE_NAMESPACE_BEGIN()
16
17class GxRenderTexture;
18class GxGuiSplitter;
19
20//===========================================================================
22//===========================================================================
23class GxGuiMenu : public GxGuiForm
24{
25 //-----------------------------------------------------------
27 //-----------------------------------------------------------
29public:
30 GX_RTTI_CLASS(GxGuiMenu, GxGuiForm)
31 // GxClassBaseReference継承クラス用禁止宣言
33
34
35 static constexpr u32 MENU_SELECT_MOUSE_BUTTON = GxMouse::BUTTON_LEFT;
36
37 struct GxItem;
38 struct GxPage;
39
41 //-----------------------------------------------------------
43 //-----------------------------------------------------------
45
46public:
48 GxGuiMenu(void);
50 GxGuiMenu(const GxPoint2& point, const GxGuiWindow* pGuiWindow, u32 displayItemNum = 0, b32 useSearchBar = false);
51
53 void cleanup( void ) override;
55 b32 initialize(void) override;
56
58 //-----------------------------------------------------------
60 //-----------------------------------------------------------
62public:
64 b32 close(void) override;
65
66private:
68 void update( void ) override;
69
71 void onDraw( void ) override;
72
74 void onDestroy(void) override;
75private:
77 void execute(void);
78
80 void updateItemTable(void);
81
83 void openSubMenu(s32 index);
85 void closeSubMenu(void);
87 GX_FORCE_INLINE b32 isOpenSubMenu(void) const { return (nullptr != getChild()); }
88
90 GX_FORCE_INLINE b32 isRootMenu(void) const { return (getParent() && !getParent()->getRtti().isDerived(GxGuiMenu::GX_RTTI)); }
92 void closeRootMenu(void);
93
95 void updateSubMenu(void);
97 constexpr void updateSubMenuKey(void) {}
99 void updateSubMenuMouse(void);
100
102 void selectMenuUp(void);
104 void selectMenuDown(void);
105
106public:
108 void addProperty( const GxProperty& property, GxClassBaseRoot* pCore );
111 GX_FORCE_INLINE void operator << (const GxProperty& property) { addProperty(property, nullptr); }
113 void addProperty( const GxPropertyTable& propertyTable );
114
115protected:
117 void onActive(b32 active) override;
119 void onMouseMove(const GxPoint2& position) override;
121 void onClick(const GxPoint2& position, u32 button) override;
123 GX_FORCE_INLINE void onMouseDown(const GxPoint2& /*position*/, u32 /*button*/) override {}
125 void onKeyDown(GxKeyboard::KEY key) override;
127 void onAttach(void) override;
129 void onSize(const GxSize& size) override;
130
132 void updatePropertySearchStringCallback( const GxString& value );
133
134private:
136 b32 isEnableSearch( void ) const;
138 b32 findSearchString( const GxProperty& property );
140 void findSearchStringSeparate( GxArray& enableSeparateIndexArray );
142 void findSearchStringPage( GxArray& enablePageArray );
144 s32 getMatchMenuItemIndex( u32 propertyTableIndex );
145
147 //-----------------------------------------------------------
149 //-----------------------------------------------------------
151public:
153 GxSize getUseSize( void );
155 GxSize getDisplaySize( const GxSize& useSize );
156#if defined(_WINDOWS)
158 GX_FORCE_INLINE const GxGuiWindow* getGuiWindow(void) const { return _pGuiWindow; }
159#endif //_WINDOWS
161 void setGuiModalOnDestroy(GxGuiBase* pGui);
162protected:
164 GX_FORCE_INLINE void setMenuDirectionRight( b32 menuDirectionRight ){ _menuDirectionRight = menuDirectionRight; }
165
167 GX_FORCE_INLINE b32 isMenuDirectionRight( void ) const { return _menuDirectionRight; }
168
170 constexpr void setSelectIndex( s32 selectItemIndex ){ _selectItemIndex = selectItemIndex; }
171
173 GX_FORCE_INLINE void setKeySerectedItem( b32 isKeySerectedItem ){ _isKeySerectedItem = isKeySerectedItem; }
174
176 b32 isHit( const GxPoint2& position );
177
179 //-----------------------------------------------------------
181 //-----------------------------------------------------------
183protected:
184 GxPropertyTable _propertyTable;
185 GxGuiPropertySearchBar* _pGuiSearchBar;
186 GxGuiForm* _pGuiForm;
187 GxGuiSplitter* _pGuiSplitter;
188
189 GxPoint2 _scrollOffsetOld;
190
191 b32 _useSearchBar;
192 b32 _requestUpdateItemTable;
193 b32 _requestClose;
194
195 s32 _useSizeWidthOld;
196 s32 _selectItemIndex;
197 s32 _selectItemIndexOld;
198 b32 _isKeySerectedItem;
199
200 u32 _selectedTime;
201
202 u32 _displayItemNum;
203 u32 _itemNum;
204 GxGuiMenu::GxItem* _pItemTable;
205
206 b32 _menuDirectionRight;
207
208 b32 _updateFirst;
209
210#if defined(_WINDOWS)
211 const GxGuiWindow* _pGuiWindow;
212#endif //_WINDOWS
213
214 GxGuiBase* _pGuiModalOnDestroy;
215 b32 _isClosing;
216
218};
219
220//===========================================================================
222//===========================================================================
223struct GxGuiMenu::GxItem : public GxStructBase
224{
225 //-----------------------------------------------------------
227 //-----------------------------------------------------------
229public:
230 GX_RTTI_STRUCT(GxItem)
231 // new, delete定義
232 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
233
234
235 //-----------------------------------------------------------
237 //-----------------------------------------------------------
239public:
241 GxItem( void );
242
244 //-----------------------------------------------------------
246 //-----------------------------------------------------------
248public:
249 GxRect _selectRegion;
250 u32 _depth;
251 u32 _referencePropertyTableIndex;
252
254};
255
256//===========================================================================
258//===========================================================================
259struct GxGuiMenu::GxPage : public GxStructBase
260{
261 //-----------------------------------------------------------
263 //-----------------------------------------------------------
265public:
266 GX_RTTI_STRUCT(GxPage)
267 // new, delete定義
268 GX_OPERATOR_NEW_DELETE_USE_ARRAY(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
269
270
271 //-----------------------------------------------------------
273 //-----------------------------------------------------------
275public:
277 GxPage( void );
278
280 //-----------------------------------------------------------
282 //-----------------------------------------------------------
284public:
285 u32 _depth;
286 u32 _beginPropertyTableIndex;
287 u32 _endPropertyTableIndex;
288 b32 _enable;
289
291};
292
293GX_CORE_NAMESPACE_END()
294
295#endif //GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
配列クラス
Definition GxArray.h:18
基底クラス
Definition GxBase.h:51
プロパティクラス
Definition GxProperty.h:48
プロパティテーブルクラス
Definition GxProperty.h:1641
テクスチャクラス
Definition GxRenderTexture.h:19
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
Definition GxBase.h:24
32bitブーリアン
Definition GxDefine.h:173