OROCHI
 
Loading...
Searching...
No Matches
GxGuiForm.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//===========================================================================
21//===========================================================================
22class GxGuiForm : public GxGuiBase
23{
24 //-----------------------------------------------------------
26 //-----------------------------------------------------------
28public:
29 GX_RTTI_CLASS(GxGuiForm, GxGuiBase)
30 // GxClassBaseReference継承クラス用禁止宣言
32
33 class GxScrollBar;
34
36 static const u32 SCROLLBAR_CURSOR_MIN_WIDTH;
38 static const u32 SCROLLBAR_CURSOR_MAX_WIDTH;
40 static const u32 SCROLLBAR_BUTTON_WIDTH;
42 static const u32 SCROLLBAR_BUTTON_HEIGHT;
43
45 static const u32 AUTO_SCROLL_LINE_WIDTH;
47 static const u32 AUTO_SCROLL_POINT_SIZE;
48
50 static const u32 CAPTION_HEIGHT;
51
53 //-----------------------------------------------------------
55 //-----------------------------------------------------------
57public:
59 GxGuiForm(void);
60
62 //-----------------------------------------------------------
64 //-----------------------------------------------------------
66public:
68 void setFormSize( const GxSize& formSize );
69
72 GX_FORCE_INLINE const GxSize& getFormSize( void ) const { return _formSize; }
73
75 void setScrollOffset( const GxPoint2& offset, b32 focus = true );
76
78 constexpr void setScrollBarTargetPositionX( s32 positionX ){ _scrollTargetOffset._x = positionX; }
80 constexpr void setScrollBarTargetPositionY( s32 positionY ){ _scrollTargetOffset._y = positionY; }
81
83 void setTargetScrollOffset( const GxPoint2& offset );
84
87 constexpr void setHorizonScrollOffsetAdd( s32 add ){ _scrollOffsetAdd._x = add; _scrollOffsetAddRate._x = 0; }
88
91 constexpr void setHorizonScrollOffsetAdd( f32 add ){ _scrollOffsetAdd._x = 0; _scrollOffsetAddRate._x = add; }
92
95 constexpr void setVerticalScrollOffsetAdd( s32 add ){ _scrollOffsetAdd._y = add; _scrollOffsetAddRate._y = 0; }
96
99 constexpr void setVerticalScrollOffsetAdd( f32 add ){ _scrollOffsetAdd._y = 0; _scrollOffsetAddRate._y = add; }
100
102 s32 getScrollOffsetAddX( void ) const;
103
105 s32 getScrollOffsetAddY( void ) const;
106
109 GX_FORCE_INLINE GxPoint2 getScrollOffset( void ) const override { return _scrollOffset; }
110
112 void setScrollBar( b32 horizon, b32 vertical );
113
116 GX_FORCE_INLINE b32 useScrollBarHorizon( void ) const { return _pHorizonScrollBar != nullptr; }
117
120 GX_FORCE_INLINE b32 useScrollBarVertical( void ) const { return _pVerticalScrollBar != nullptr; }
121
124 GX_FORCE_INLINE void setCaption( GX_CSTR pCaption ){ GX_ASSERT( pCaption, "pCaption is nullptr" ); _caption = pCaption; _useCaption = true; }
125
126protected:
128 void cleanup( void ) override;
129
131 void update( void ) override;
132
134 void postDraw( void ) override;
135
137 void onNoClientDraw( void ) override;
138
139public:
141 GxSize getUseRegionSize(void) const override;
142
143protected:
145 GxRect calculateClientRect(const GxRect& clientRect) const override;
146
148 void onSize(const GxSize& size) override;
149
151 void onMouseDown(const GxPoint2& position, u32 button) override;
152
154 void onNoClientMouseDown(const GxPoint2& position, u32 button) override;
155
157 void onMouseWheel(const GxPoint2& position, s32 rot) override;
158
160 void onNoClientMouseWheel(const GxPoint2& position, s32 rot) override;
161
163 //-----------------------------------------------------------
165 //-----------------------------------------------------------
167public:
169 GX_FORCE_INLINE void requestInFocus( void ){ _requestInFocus = true; }
170
172 void isActiveScrollBar( b32& isActiveHorizon,b32& isActiveVertical ) const;
173
175 //-----------------------------------------------------------
177 //-----------------------------------------------------------
179protected:
180 GxScrollBar* _pHorizonScrollBar;
181 GxScrollBar* _pVerticalScrollBar;
182
183 GxPoint2 _scrollOffset;
184 GxPoint2 _scrollOffsetAdd;
185 GxVector2 _scrollOffsetAddRate;
186
187 GxPoint2 _scrollTargetOffset;
188
189 GxSize _formSize;
190
191 b32 _autoScroll;
192 GxPoint2 _autoScrollBasePosition;
193 GxPoint2 _autoScrollControlPosition;
194
195 b32 _requestInFocus;
196
197 GxString _caption;
198 b32 _useCaption;
199
201};
202
203//===========================================================================
205//===========================================================================
206class GxGuiForm::GxScrollBar : public GxClassBaseReference
207{
208 //-----------------------------------------------------------
210 //-----------------------------------------------------------
212public:
213 GX_RTTI_CLASS(GxGuiForm::GxScrollBar, GxClassBaseReference)
214 // 基底継承クラス用禁止宣言
216 // new, delete定義
217 GX_OPERATOR_NEW_DELETE(GxAllocatorList::ALLOCATOR_TYPE::DEVELOP)
218
219
220 enum class TYPE
221 {
222 HORIZON = 0,
223 VERTICAL
224 };
225
227 enum class STATE
228 {
229 OFF_ = 0,
230 BAR_GRIPED,
231 SUB_BUTTON_PUSHED,
232 ADD_BUTTON_PUSHED,
233 ADD_BAR_PUSHED,
234 SUB_BAR_PUSHED
235 };
236
238 //-----------------------------------------------------------
240 //-----------------------------------------------------------
242public:
244 GxScrollBar( void );
246 GxScrollBar( GxGuiForm* pOwner, TYPE type );
247
249 //-----------------------------------------------------------
251 //-----------------------------------------------------------
253public:
255 b32 isActive( void );
257 void getRect( GxRect& barRect, GxRect& cursorSubRect, GxRect& cursorAddRect, GxRect& cursorRect );
259 void onMouseMove( const GxPoint2& position );
261 void onMouseDown( const GxPoint2& position, u32 button );
263 void onMouseUp( const GxPoint2& position, u32 button );
264
266 constexpr STATE getState( void ) const { return _state; }
267
269 s32 getOffset( void );
271 void setOffset( s32 offset ) const;
272
274 //-----------------------------------------------------------
276 //-----------------------------------------------------------
278protected:
279 GxGuiForm* _pOwner;
280 TYPE _type;
281
282 STATE _state;
283 s32 _clickOffset;
284
285 GxRect _button1Rect;
286 GxRect _button2Rect;
287 GxRect _borderRect;
288 GxRect _cursorRect;
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 GxBase.h:122
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
2次元ベクトル
Definition GxVector.h:34
32bitブーリアン
Definition GxDefine.h:173