OROCHI
 
Loading...
Searching...
No Matches
GxGuiSplitter.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 GxGuiSplitter : public GxGuiBase
21{
22 //-----------------------------------------------------------
24 //-----------------------------------------------------------
26public:
27 GX_RTTI_CLASS(GxGuiSplitter, GxGuiBase)
28 // ClassBaseReference継承クラス用禁止宣言
30
31
32 // 親サイズ変更時等、どこを基準にスプリットを動かすか
33 enum class OFFSET_BASIS
34 {
35 LEFT,
36 RIGHT,
37 TOP,
38 BOTTOM
39 };
40
42 static constexpr u32 CONTROL_BAR_MOUSE_BUTTON = GxMouse::BUTTON_LEFT;
43private:
45 static constexpr u32 SPLIT_VIEW_WIDTH_DEFAULT = 4;
47 static constexpr u32 SPLIT_CONTROL_WIDTH_DEFAULT = 4;
48
50 //-----------------------------------------------------------
52 //-----------------------------------------------------------
54public:
56 GxGuiSplitter(void);
57
59 GxGuiSplitter( OFFSET_BASIS mode, s32 offset, u32 viewWidth = SPLIT_VIEW_WIDTH_DEFAULT, u32 controlWidth = SPLIT_CONTROL_WIDTH_DEFAULT, b32 useControl = true );
60
62 //-----------------------------------------------------------
64 //-----------------------------------------------------------
66public:
68 b32 initialize( void ) override;
69
71 void cleanup( void ) override;
72
74 void update( void ) override;
75
77 void onDraw( void ) override;
78
81 constexpr s32 getOffset(void) const { return _offset; }
84 constexpr void setOffset( s32 offset ){ _offset = offset; }
85
88 constexpr OFFSET_BASIS getOffsetBasis(void) const { return _offsetBasis; }
91 constexpr void setOffsetBasis( OFFSET_BASIS offsetBasis ){ _offsetBasis = offsetBasis; }
92
95 b32 setGui0( GxGuiBase* pGui0 );
96
99 constexpr GxGuiBase* getGui0( void ) const { return _pGui0; }
100
103 b32 setGui1( GxGuiBase* pGui1 );
104
107 constexpr GxGuiBase* getGui1( void ) const { return _pGui1; }
108
110 void setSplitPosition( s32 offset );
111
113 constexpr s32 getSplitPosition( void ) const { return _offset; }
114
117 constexpr void setSplitterViewWidth( u32 width ){ _viewWidth = width; }
118
121 constexpr void setSplitterControlWidth( u32 width ){ _controlWidth = width; }
122
125 GX_FORCE_INLINE void setUseControl( b32 use ){ _useControl = use; }
126
129 GX_FORCE_INLINE b32 useControl( void ) const { return _useControl; }
130
133 GX_FORCE_INLINE b32 isControl( void ) const { return _controlBar; }
134
136 GX_FORCE_INLINE void setDrawFrame( b32 draw ) { _drawFrame = draw; }
137protected:
139 void controlBar(void);
140private:
142 b32 controlBarOnMouseDown(const GxPoint2& position, u32 button);
143
145 void controlBarMouseMove(const GxPoint2& position);
146
147protected:
149 GxGuiGraphics::MOUSE_CURSOR getMouseCursor(void) override;
150
152 GxSize getClampedRegionSize(const GxSize& requestSize) const override;
153
155 void onSize(const GxSize& size) override;
156
158 void onMouseDown(const GxPoint2& position, u32 button) override;
159
161 //-----------------------------------------------------------
163 //-----------------------------------------------------------
165public:
167 void updateLayout(b32 force = false);
168
171 GX_FORCE_INLINE void setUpdateSizeFormParentCliantRegion( b32 isUpdateSizeFormParentCliantRegion ){ _isUpdateSizeFormParentCliantRegion = isUpdateSizeFormParentCliantRegion; }
172
173protected:
175 GxRect getBarRect(void) const;
176private:
177 // バーの上か判定
178 b32 isOnControl(const GxPoint2& position);
179
181 //-----------------------------------------------------------
183 //-----------------------------------------------------------
185private:
186 GxGuiBase* _pGui0;
187 GxGuiBase* _pGui1;
188
189 OFFSET_BASIS _offsetBasis;
190 s32 _offset;
191
192 u32 _viewWidth;
193 u32 _controlWidth;
194 u32 _state;
195
196 b32 _drawFrame;
197 b32 _useControl;
198 b32 _controlBar;
199 GxPoint2 _clickOffset;
200
201 b32 _isUpdateSizeFormParentCliantRegion;
202
204};
205
206GX_CORE_NAMESPACE_END()
207
208#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
32bitブーリアン
Definition GxDefine.h:173