OROCHI
 
Loading...
Searching...
No Matches
GxGuiPropertyTable.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/*
18 ┌──────────────────┐
19 │ GxGuiPropertyTable │
20 │┌────────────────┐│
21 ││ GuiNameForm ││
22 ││┌─────────┐ ││
23 │││GxGuiSplitterCross│ ││
24 │││┌──────--┐│ ││
25 ││││GxGuiBase ││ ││
26 ││││"..." ││ ││
27 │││└──────--┘│ ││
28 ││└─────────┘ ││
29 │└────────────────┘│
30 │┌────────────────┐│
31 ││ GuiValueForm ││
32 ││┌─────────┐ ││
33 │││GxGuiSplitterCross│ ││
34 │││┌──────--┐│ ││
35 ││││GxGuiBase ││ ││
36 ││││"0" ││ ││
37 ││││"1" ││ ││
38 ││││"2" ││ ││
39 │││└──────--┘│ ││
40 ││└─────────┘ ││
41 │└────────────────┘│
42 └──────────────────┘
43*/
44
45class GxGuiSplitterCross;
46class GxGuiValueForm;
47class GxGuiNameForm;
48
49//===========================================================================
51//===========================================================================
52class GxGuiPropertyTable : public GxGuiBase
53{
54 //-----------------------------------------------------------
56 //-----------------------------------------------------------
58public:
59 GX_RTTI_CLASS(GxGuiPropertyTable, GxGuiBase)
60 // GxGuiPropertyTable継承クラス用禁止宣言
61 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiPropertyTable)
62 // new, delete定義
63 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
64
65
66 enum class TYPE
67 {
68 HORIZON = 0,
69 VERTICAL
70 };
71
73 enum class TABLE_TYPE
74 {
75 ARRAY_STRUCT = 0,
76 ARRAY_CLASS_POINTER,
77 GX_ARRAY,
78 GX_ARRAY_POINTER,
79 GX_LIST_CLASS_BASE,
80 GX_LIST_CLASS_BASE_POINTER
81 };
82
84 static constexpr u32 NAME_HEIGHT = 18;
86 static constexpr u32 VALUE_HEIGHT = 18;
87
89 static const u32 CAPTION_HEIGHT;
90
92 //-----------------------------------------------------------
94 //-----------------------------------------------------------
96public:
98 GxGuiPropertyTable(void);
100 GxGuiPropertyTable( const GxProperty& property, GxTypedObject* pObject, u32 index = 0, b32 useFilter = false, TYPE type = TYPE::HORIZON, b32 useIndex = false );
101
103 //-----------------------------------------------------------
105 //-----------------------------------------------------------
107public:
109 b32 initialize( void ) override;
111 void update( void ) override;
113 void postUpdate( void ) override;
114
116 void onSize(const GxSize& size) override;
117
119 void eventSort(void*);
120protected:
122 GX_FORCE_INLINE void onClick(const GxPoint2& /*position*/, u32 /*button*/) override { onClickParent(); }
123
125 void onNoClientDraw( void ) override;
127 GxSize getUseRegionSize( void ) const override;
129 GxRect calculateClientRect( const GxRect& clientRect ) const override;
130
132 b32 updateObjectList(void);
133
135 void createObjectListGui(void);
136
138 void filterObjectList(void);
139
141 void sortObjectList(void);
142
144 GX_CSTR getColumnName(u32 index) const;
145
147 b32 isInSelectList(void* pObject);
148
150 b32 getProperty(const GxRtti* pRtti, const GxTypedObject* pOwner, u32 index, GX_CSTR pName, const GxRtti*& pTargetRtti, const GxProperty*& pTargetProperty, const GxTypedObject*& pTargetOwner, u32& targetIndex, b32 searchParentFlag) const;
151
153 b32 analyzeProperty(const GxString& string, GxString& propertyName, u32& index, GxString& next) const;
154
156 //-----------------------------------------------------------
158 //-----------------------------------------------------------
160public:
162 void setAttributeColumn(u32 column, GxGuiBase::ATTRIBUTE attribute, b32 enable);
164 void setAttributeRow(u32 row, GxGuiBase::ATTRIBUTE attribute, b32 enable);
166 void setAttributeColumnRow(u32 column, u32 row, GxGuiBase::ATTRIBUTE attribute, b32 enable);
167
169 void addColumn( GX_CSTR name, u32 width, GX_CSTR displayName = nullptr );
170
172 void addColumn( GX_CSTR name, GX_CSTR displayName = nullptr );
173
175 void* getSelectObject( void );
176
178 void getSelectObject( GxArray& list );
179
181 void getSelectObject( GxArrayClassBase& listClassBase );
182
184 void getDispObject( GxArray& list );
185
187 void getDispObject( GxArrayClassBase& listClassBase );
188
190 GX_FORCE_INLINE void setUseMultiSelect( b32 use = true ){ _useMultiSelect = use; }
191
193 u32 getSelectObjectCount( void );
194
196 void addSelectList( void* pObject );
197
199 void addSelectList( u32 index );
200
202 void removeSelectList( void* pObject );
203
205 void removeAllSelectList( void );
206
208 void removeAllDispList(void);
209
211 GX_FORCE_INLINE void setDisableCheckProperty( b32 disable ){ _disableCheckProperty = disable; }
212
214 GX_FORCE_INLINE void setRequestCheckProperty( b32 request ){ _requestCheckProperty = request; }
215
217 void setColumnWidthAdjust( void );
218
220 //(0 は番号列なのでありえないため、保たないフラグとする)
221 constexpr void setMoveFocusColumn(u32 column) { _moveFocusColumn = column; }
222
224 GX_FORCE_INLINE void setUseUpdateWithFocus( b32 use ) { _useUpdateWithFocus = use; }
225
226 // 以下2関数は内部で使用するため使用非推奨
228 GX_FORCE_INLINE GxArray& getDisplayObjectArray( void ){ return _displayObjectArray; }
230 GX_FORCE_INLINE GxArray& getSelectObjectArray( void ){ return _selectObjectArray; }
231
233 // デフォルトは GxMouse::BUTTON_ALL で全てのボタンを使用する
234 constexpr void setSelectMouseButton(u32 buttons) { _selectMouseButton = buttons; }
235
237 GX_FORCE_INLINE void setCaption( GX_CSTR pCaption ){ GX_ASSERT( pCaption, "pCaption is nullptr" ); _caption = pCaption; _useCaption = true; }
239 GX_FORCE_INLINE void setDefaultCaptionBackgroundColor( const GxColor& color ) { _defaultCaptionBackgroundColor = color; }
241 GX_FORCE_INLINE void setActiveCaptionBackgroundColorStart( const GxColor& color ) { _activeCaptionBackgroundColorStart = color; }
243 GX_FORCE_INLINE void setActiveCaptionBackgroupdColorEnd( const GxColor& color ) { _activeCaptionBackgroundColorEnd = color; }
244
246 //-----------------------------------------------------------
248 //-----------------------------------------------------------
250protected:
251 GxProperty _property;
252 GxTypedObject* _pObject;
253 u32 _index;
254
255 TYPE _type;
256 GxGuiNameForm* _pGuiNameForm;
257 GxGuiValueForm* _pGuiValueForm;
258
259 GxArray _objectArray;
260 GxArray _filterObjectArray;
261 GxArray _temporaryObjectArray;
262 GxArray _displayObjectArray;
263 GxArray _selectObjectArray;
264
265 GxListClassBase::SORT _sortMode;
266 GxProperty* _pSortProperty;
267 b32 _useFilter;
268 b32 _useMultiSelect;
269 TABLE_TYPE _tableType;
270 GxArrayClassBaseReference _columnNameList;
271 s32 _selectPositionY;
272 b32 _useIndex;
273 b32 _requestCheckProperty;
274 b32 _disableCheckProperty;
275 u32 _moveFocusColumn;
276 b32 _useUpdateWithFocus;
277 u32 _selectMouseButton;
278
279 GxString _caption;
280 b32 _useCaption;
281 GxColor _defaultCaptionBackgroundColor;
282 GxColor _activeCaptionBackgroundColorStart;
283 GxColor _activeCaptionBackgroundColorEnd;
284
286};
287
288//===========================================================================
290//===========================================================================
291class GxColumnName : public GxClassBaseReference
292{
293 //-----------------------------------------------------------
295 //-----------------------------------------------------------
297public:
298 GX_RTTI_CLASS(GxColumnName, GxClassBaseReference)
299 // GxGuiPropertyTable継承クラス用禁止宣言
301 // new, delete定義
302 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
303
304
305 //-----------------------------------------------------------
307 //-----------------------------------------------------------
309public:
311 GxColumnName(void);
312
314 //-----------------------------------------------------------
316 //-----------------------------------------------------------
318public:
320 GX_FORCE_INLINE void setName( const GxString& name ){ _name = name; }
322 GX_FORCE_INLINE const GxString& getName( void ) const { return _name; }
323
325 GX_FORCE_INLINE void setDisplayName( const GxString& displayName ){ _displayName = displayName; }
327 GX_FORCE_INLINE const GxString& getDisplayName( void ) const { return _displayName; }
328
330 constexpr void setUseButton( GxGuiButton* pGuiButton ){ _pGuiButton = pGuiButton; }
332 constexpr GxGuiButton* getUseButton( void ) const { return _pGuiButton; }
333
335 //-----------------------------------------------------------
337 //-----------------------------------------------------------
339protected:
340 GxString _name;
341 GxString _displayName;
342 GxGuiButton* _pGuiButton;
343
345};
346
347//===========================================================================
349//===========================================================================
350class GxGuiNameForm : public GxGuiForm
351{
352 //-----------------------------------------------------------
354 //-----------------------------------------------------------
356public:
357 GX_RTTI_CLASS(GxGuiNameForm, GxGuiForm)
358 // GxGuiPropertyTable継承クラス用禁止宣言
360
361
362 //-----------------------------------------------------------
364 //-----------------------------------------------------------
366public:
368 GxGuiNameForm(void);
370 GxGuiNameForm( b32 useFilter );
371
373 //-----------------------------------------------------------
375 //-----------------------------------------------------------
377public:
379 b32 initialize( void ) override;
380
382 void cleanup( void ) override;
383
385 void update( void ) override;
386
387protected:
389 void onSize(const GxSize& size) override;
390
392 //-----------------------------------------------------------
394 //-----------------------------------------------------------
396public:
398 u32 getColumnCount( void );
399
401 s32 getControlColumnBarIndex( void );
402
404 void setColumnWidth( u32 width, u32 index );
406 u32 getColumnWidth( u32 index );
407
409 void updateLayout( void );
410
412 void addColumn( u32 width, GxGuiButton* pGuiButton );
413
415 b32 isChangeFilter( void ) const;
416
418 GX_CSTR getFilter( u32 index ) const;
419
421 GxSize getUseRegionSize( void ) const override;
422
424 constexpr GxGuiSplitterCross* getSplitterCross( void ) const { return _pSplitterCross; }
425
427 //-----------------------------------------------------------
429 //-----------------------------------------------------------
431protected:
432 GxGuiSplitterCross* _pSplitterCross;
433 b32 _useFilter;
434 GxArrayClassBase _filterList;
435 GX_CSTR _pFilterDammy;
436
438};
439
440//===========================================================================
442//===========================================================================
443class GxNameFilter : public GxClassBase
444{
445 //-----------------------------------------------------------
447 //-----------------------------------------------------------
449public:
450 GX_RTTI_CLASS(GxNameFilter, GxClassBase)
451 // GxGuiPropertyTable継承クラス用禁止宣言
452 GX_PROHIBIT_CLASS_BASE(GxNameFilter)
453 // new, delete定義
454 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
455
456
457 //-----------------------------------------------------------
459 //-----------------------------------------------------------
461public:
463 GxNameFilter(void) : _changeFilter(false){};
464
466 //-----------------------------------------------------------
468 //-----------------------------------------------------------
470public:
472 virtual void update( void );
473
475 //-----------------------------------------------------------
477 //-----------------------------------------------------------
479public:
481 GX_FORCE_INLINE const GxString& getFilter( void ) const { return _filter; }
483 GX_FORCE_INLINE GxProperty getFilterProperty( void ) const { return _PARAM(_filter); }
484
486 GX_FORCE_INLINE b32 isChangeFilter( void ) const { return _changeFilter; }
487
489 //-----------------------------------------------------------
491 //-----------------------------------------------------------
493protected:
494 GxString _filter;
495 GxString _oldFilter;
496
497 b32 _changeFilter;
498
500};
501
502//===========================================================================
504//===========================================================================
505class GxGuiValueForm : public GxGuiForm
506{
507 //-----------------------------------------------------------
509 //-----------------------------------------------------------
511public:
512 GX_RTTI_CLASS(GxGuiValueForm, GxGuiForm)
513 // GxGuiPropertyTable継承クラス用禁止宣言
515
516
517 //-----------------------------------------------------------
519 //-----------------------------------------------------------
521public:
523 GxGuiValueForm(void);
524
526 //-----------------------------------------------------------
528 //-----------------------------------------------------------
530public:
532 b32 initialize( void ) override;
533
535 void postDraw( void ) override;
536
537protected:
539 void onSize(const GxSize& size) override;
540
542 GxSize getUseRegionSize(void) const override;
543
545 void onKeyPress(GxKeyboard::KEY key) override;
546
548 void moveFocus(const GxPoint2& move);
549
551 //-----------------------------------------------------------
553 //-----------------------------------------------------------
555public:
557 s32 getControlColumnBarIndex( void );
558
560 void setColumnWidth( u32 width, u32 index );
561
563 u32 getColumnWidth( u32 index );
564
566 void updateLayout( void );
567
569 void createTable( u32 count );
570
572 void setGui( GxGuiBase* pGui, u32 column, u32 row );
573
575 void addColumn( u32 width );
576
578 s32 getActiveObjectPosition( void );
579
581 b32 setFocus( const GxPoint2& position );
582
584 GX_FORCE_INLINE void setDisableCtrlMoveFoucs(b32 disable){ _disableCtrlMoveFoucs = disable; }
585
587 constexpr GxGuiSplitterCross* getSplitterCross( void ) const { return _pSplitterCross; }
588
590 //-----------------------------------------------------------
592 //-----------------------------------------------------------
594protected:
595 GxGuiSplitterCross* _pSplitterCross;
596 b32 _disableCtrlMoveFoucs;
597
599};
600
601GX_CORE_NAMESPACE_END()
602
603#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
#define GX_PROHIBIT_CLASS_BASE(__CLASS__)
GxClassBase継承の禁止宣言
Definition GxBase.h:240
void GxTypedObject
その他
Definition GxDefine.h:213
配列クラス
Definition GxArrayClassBase.h:18
参照カウンタ用配列クラス
Definition GxArrayClassBase.h:145
配列クラス
Definition GxArray.h:18
オブジェクト基底クラス
Definition GxBase.h:88
参照オブジェクト基底クラス
Definition GxBase.h:122
SORT
ソート方法
Definition GxListClassBase.h:34
プロパティクラス
Definition GxProperty.h:48
実行時型情報クラス
Definition GxRtti.h:154
Definition GxColor.h:21
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173