15GX_CORE_NAMESPACE_BEGIN()
21class GxGuiProperty : public GxGuiBase
28 GX_RTTI_ABSTRACT_CLASS(GxGuiProperty, GxGuiBase)
41 enum GUI_PROPERTY_ATTRIBUTE
43 GUI_PROPERTY_ATTRIBUTE_NONE = 0,
44 GUI_PROPERTY_ATTRIBUTE_ARRAY_COUNT_OFF = (1UL << 1),
48 static const u32 FLAME_MARGIN_WIDTH;
50 static const u32 FLAME_MARGIN_HEIGHT;
52 static const u32 REGION_HEIGHT;
63 GxGuiProperty(
const GxProperty& propertyData,
GxTypedObject* pOwner,
const GxRtti& rtti, u32 index = 0, NAME_TYPE nameType = NAME_TYPE::NONE);
66 b32 initialize(
void )
override;
69 s32 release(
void )
override;
78 void update(
void )
override;
81 void updateName(
void);
85 GxSize getUseRegionSize(
void)
const override;
89 void onSize(
const GxSize& size)
override;
92 void onNoClientDraw(
void)
override;
95 void onNoClientMouseDown(
const GxPoint2& position, u32 button)
override;
98 void onNoClientMouseUp(
const GxPoint2& position, u32 button)
override;
101 GxRect calculateClientRect(
const GxRect& clientRect)
const override;
104 void onKeyDown(GxKeyboard::KEY key)
override;
114 constexpr void setNameType( NAME_TYPE nameType ){ _nameType = nameType; }
118 constexpr NAME_TYPE getNameType(
void )
const {
return _nameType; }
122 GX_FORCE_INLINE
const GxProperty& getProperty(
void)
const {
return _property; }
126 GX_FORCE_INLINE
GxProperty& getProperty(
void){
return _property; }
129 GX_FORCE_INLINE
void setProperty(
GxProperty* pProperty ) { _property = *pProperty; }
133 constexpr GxTypedObject* getOwner(
void )
const {
return _pOwner; }
137 GX_FORCE_INLINE
const GxRtti* getOwnerRtti(
void)
const {
return _pOwnerRtti; }
141 constexpr u32 getIndex(
void )
const {
return _index; }
145 template<
typename T>
void getPropertyValue( T& value )
const
147 _property.getValue( _pOwner,value,_index );
152 template<
typename T>
void setPropertyValue(
const T& value )
155 if( !isAttribute ( GxGuiBase::ATTRIBUTE_DISABLE )
156 && !isAttribute ( GxGuiBase::ATTRIBUTE_READONLY )
157 && !getGxGuiSystem()->isExistHistoryParam(
this) )
159 getGxGuiSystem()->addHistoryParam(
this);
162 _property.setValue( _pOwner, value, _index );
164 auto* parent = getParent();
167 parent->setPropertyValueFromChild();
171 if( !isAttribute ( GxGuiBase::ATTRIBUTE_DISABLE )
172 && !isAttribute ( GxGuiBase::ATTRIBUTE_READONLY ) )
174 getGxGuiSystem()->addHistoryParam(
this);
176 getGxGuiSystem()->onSetPropertyValue(
this);
181 GX_FORCE_INLINE
const GxRect& getNameRect(
void )
const {
return _nameRect; }
185 void setNameRect(
const GxRect& nameRect );
189 constexpr void setNameWidth( s32 width ){ _nameWidth = width; _nameWidthRate = 0; }
193 constexpr void setNameWidthRate( f32 rate ){ _nameWidthRate = rate; _nameWidth = 0; }
196 b32 isPropertyAttribute( GUI_PROPERTY_ATTRIBUTE attribute )
const;
199 void setPropertyAttribute( GUI_PROPERTY_ATTRIBUTE attribute,
b32 on );
203 GX_FORCE_INLINE
b32 isMouseDownOnName(
void)
const {
return _mouseDownOnName; }
206 GX_FORCE_INLINE
void setDefaultValueIcon(
b32 flag ) { _defaultValueIconFlag = flag; }
210 GX_FORCE_INLINE
virtual b32 isDefaultValue(
void) {
return true; }
213 template<
typename T>
b32 isDefaultValueSub(
void)
215 const auto* pDefaultObject =
const_cast<GxRtti*
>(getOwnerRtti())->getDefaultObject(_pOwner);
219 getPropertyValue(value);
221 getProperty().getValue(pDefaultObject, defaultValue, getIndex());
222 return value == defaultValue;
228 template<>
b32 isDefaultValueSub<GX_CSTR>(
void)
230 const auto* pDefaultObject =
const_cast<GxRtti*
>(getOwnerRtti())->getDefaultObject(_pOwner);
234 getPropertyValue(value);
235 GX_CSTR defaultValue;
236 getProperty().getValue(pDefaultObject, defaultValue, getIndex());
237 return GX_STRCMP(value, defaultValue) == 0;
243 template<>
b32 isDefaultValueSub<GxString*>(
void)
245 const auto* pDefaultObject =
const_cast<GxRtti*
>(getOwnerRtti())->getDefaultObject(_pOwner);
249 getProperty().getValue(getOwner(), pValue, getIndex());
251 getProperty().getValue(pDefaultObject, pDefaultValue, getIndex());
252 return *pValue == *pDefaultValue;
258 virtual void setDefaultValue(
void ){}
261 template<
typename T>
void setDefaultValueSub(
void )
263 const auto* pDefaultObject =
const_cast<GxRtti*
>(getOwnerRtti())->getDefaultObject(_pOwner);
267 getProperty().getValue( pDefaultObject, defaultValue, getIndex() );
268 setPropertyValue( defaultValue );
280 const GxRtti* _pOwnerRtti;
283 b32 _mouseDownOnName;
284 u32 _guiPropertyAttribute;
291 GxSize _clipDisplayNameSize;
296 GxRect _defaultValueIconRect;
297 f32 _defaultValueIconFlag;
302GX_CORE_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
void GxTypedObject
その他
Definition GxDefine.h:213
#define GX_STRCMP(__STRING0__, __STRING1__)
文字列比較
Definition GxString.h:616
プロパティクラス
Definition GxProperty.h:48
実行時型情報クラス
Definition GxRtti.h:154
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
サイズ
Definition GxStruct.h:730
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173