ZFFramework
 
Loading...
Searching...
No Matches
ZFUIButtonBasic.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUIButtonBasic_h_
7#define _ZFI_ZFUIButtonBasic_h_
8
9#include "ZFUIButton.h"
11
12// ============================================================
13// ZFUIButtonBasic
14zfclassFwd _ZFP_ZFUIButtonBasicPrivate;
33zfclass ZFLIB_ZFUIWidget ZFUIButtonBasic : zfextend ZFUIButton {
34 ZFOBJECT_DECLARE(ZFUIButtonBasic, ZFUIButton)
35 ZFSTYLE_DEFAULT_DECLARE(ZFUIButtonBasic)
36
37public:
38 // ============================================================
39 // content layout
56
61
62 // ============================================================
63 // label
69
75
81
87
93
94 // ============================================================
95 // icon
101
107
113
119
125
126 // ============================================================
127 // background
133
139
145
151
157
158 // ============================================================
159 // util method
160public:
165 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
171 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
177 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
179
203 , ZFMP_IN(const zfstring &, propertyName)
204 , ZFMP_IN(const zfstring &, styleKey)
205 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
209 , ZFMP_IN(const zfstring &, propertyName)
210 , ZFMP_IN(const zfstring &, styleKey)
211 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
215 , ZFMP_IN(const zfstring &, propertyName)
216 , ZFMP_IN(const zfstring &, styleKey)
217 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
219
243 , ZFMP_IN(const zfstring &, propertyName)
244 , ZFMP_IN(ZFObject *, value)
245 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
249 , ZFMP_IN(const zfstring &, propertyName)
250 , ZFMP_IN(ZFObject *, value)
251 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
255 , ZFMP_IN(const zfstring &, propertyName)
256 , ZFMP_IN(ZFObject *, value)
257 , ZFMP_IN_OPT(ZFUIButtonState, forState, v_ZFUIButtonState::e_Normal)
259
260protected:
262 virtual void objectOnInit(void);
264 virtual void objectOnDealloc(void);
265
268
270 virtual void layoutOnMeasure(
271 ZF_OUT ZFUISize &ret
272 , ZF_IN const ZFUISize &sizeHint
273 , ZF_IN const ZFUISizeParam &sizeParam
274 );
276 virtual void internalViewOnLayout(ZF_IN const ZFUIRect &bounds);
278 virtual zfbool internalViewShouldLayout(ZF_IN ZFUIView *internalView);
279
281 virtual void buttonStateOnUpdate(void);
282
283protected:
287 virtual const ZFClass *labelViewClass(void);
291 virtual const ZFClass *iconViewClass(void);
295 virtual const ZFClass *bgViewClass(void);
296
297public:
310
311private:
312 _ZFP_ZFUIButtonBasicPrivate *d;
313 friend zfclassFwd _ZFP_ZFUIButtonBasicPrivate;
314};
315
317#endif // #ifndef _ZFI_ZFUIButtonBasic_h_
318
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_zft_zffloat zffloat
same as float, see zfindex
Definition ZFCoreTypeDef_CoreType.h:183
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:693
#define ZFMETHOD_DECLARE_3(ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMethod
Definition ZFMethodDeclare.h:1206
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:854
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFPROPERTY_ON_DETACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:258
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#define ZFPROPERTY_ON_INIT_DECLARE(Type, Name)
override life cycle callback for the property
Definition ZFPropertyDeclare.h:208
#define ZFPROPERTY_RETAIN_READONLY(Type, Name, InitValueOrEmpty)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:110
#define ZFPROPERTY_ON_ATTACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:248
#define ZFSTYLE_DEFAULT_DECLARE(YourStyle)
used to declare a default style, see ZFStyleable
Definition ZFStyleable.h:262
abstract button
v_ZFUIButtonState::ZFEnumType ZFUIButtonState
see v_ZFUIButtonState
Definition ZFUIButton.h:29
v_ZFUIOrientation::ZFEnumType ZFUIOrientation
see v_ZFUIOrientation
Definition ZFUITypeDef.h:1145
ZFUIMargin const & ZFUIMarginZero(void)
(0, 0, 0, 0)
Definition ZFUITypeDef.h:173
ZFUIMargin ZFUIMarginCreate(zffloat const &left, zffloat const &top, zffloat const &right, zffloat const &bottom)
make a margin
Definition ZFUITypeDef.h:183
#define ZFLIB_ZFUIWidget
used to export symbols
Definition ZFUIWidgetDef.h:17
ZFObject's class info.
Definition ZFClass.h:67
base class of all objects
Definition ZFObjectCore.h:209
void styleKey(const zfstring &styleKey)
see ZFStyleSet
see v_ZFUIAlign, ZFUIAlignFlagsToString, ZFUIAlignFlagsFromString
Definition ZFUITypeDef.h:1075
virtual zfanyT< ZFUIImageView > const & iconHighlighted()
icon style in highlighted state
Definition ZFUIButtonBasic.h:103
virtual zfanyT< ZFUIImageView > const & iconCheckedHighlighted()
icon style in checked highlighted state
Definition ZFUIButtonBasic.h:115
virtual const ZFClass * bgViewClass(void)
must be type of ZFUIImageView, by default it's ZFUIImageView
virtual void objectOnInit(void)
override this to init your object
virtual ZFUIMargin & bgMargin()
button background's layout margin, ZFUIMarginZero by default
Definition ZFUIButtonBasic.h:60
virtual void labelProp(const zfstring &propertyName, ZFObject *value, ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
util method to apply label style
virtual zfanyT< ZFUITextView > const & labelHighlighted()
label style in highlighted state
Definition ZFUIButtonBasic.h:71
virtual void bgStyle(const zfstring &propertyName, const zfstring &styleKey, ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
see labelStyle
virtual zfanyT< ZFUIImageView > const & iconChecked()
icon style in checked state
Definition ZFUIButtonBasic.h:109
virtual zfanyT< ZFUIImageView > iconView()
button's icon view, style of this view must be changed by ZFUIButtonBasic::iconNormal,...
virtual zffloat & contentSpace()
button icon and label's space, ZFUIGlobalStyle::itemSpace by default
Definition ZFUIButtonBasic.h:55
virtual zfanyT< ZFUIImageView > const & iconNormal()
icon style in normal state
Definition ZFUIButtonBasic.h:97
virtual zfanyT< ZFUIImageView > const & bgCheckedHighlighted()
background style in checked highlighted state
Definition ZFUIButtonBasic.h:147
virtual zfanyT< ZFUITextView > const & labelChecked()
label style in checked state
Definition ZFUIButtonBasic.h:77
virtual zfanyT< ZFUIImageView > icon(ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
util method to get button icon's style
virtual zfanyT< ZFUIImageView > const & bgNormal()
background style in normal state
Definition ZFUIButtonBasic.h:129
virtual zfanyT< ZFUITextView > const & labelDisabled()
label style in disabled state
Definition ZFUIButtonBasic.h:89
virtual void iconProp(const zfstring &propertyName, ZFObject *value, ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
see labelProp
static zfanyT< ZFUIButtonBasic > DefaultStyle(void)
virtual const ZFClass * labelViewClass(void)
must be type of ZFUITextView, by default it's ZFUITextView
virtual const ZFClass * iconViewClass(void)
must be type of ZFUIImageView, by default it's ZFUIImageView
virtual ZFUIOrientation & iconPosition()
button icon's orientation (relative to label), v_ZFUIOrientation::e_Left by default
Definition ZFUIButtonBasic.h:43
virtual zfanyT< ZFUIImageView > const & iconDisabled()
icon style in disabled state
Definition ZFUIButtonBasic.h:121
virtual void layoutOnMeasure(ZFUISize &ret, const ZFUISize &sizeHint, const ZFUISizeParam &sizeParam)
called by layoutMeasure to decide the view's size
virtual void objectOnDealloc(void)
override this to destroy your object
virtual zfanyT< ZFUITextView > const & labelNormal()
label style in normal state
Definition ZFUIButtonBasic.h:65
virtual ZFUIMargin & contentMargin()
button content(icon, label)'s layout margin, ZFUIGlobalStyle::itemMargin by default
Definition ZFUIButtonBasic.h:51
virtual zfanyT< ZFUIImageView > const & bgChecked()
background style in checked state
Definition ZFUIButtonBasic.h:141
virtual void bgProp(const zfstring &propertyName, ZFObject *value, ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
see labelProp
virtual zfanyT< ZFUIImageView > const & bgHighlighted()
background style in highlighted state
Definition ZFUIButtonBasic.h:135
virtual zfanyT< ZFUITextView > labelView()
button's label view, style of this view must be changed by ZFUIButtonBasic::labelNormal,...
virtual void objectInfoImplAppend(zfstring &ret)
see objectInfo
virtual zfanyT< ZFUIImageView > bg(ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
util method to get button icon's style
virtual zfanyT< ZFUIImageView > const & bgDisabled()
background style in disabled state
Definition ZFUIButtonBasic.h:153
virtual zfbool internalViewShouldLayout(ZFUIView *internalView)
called to check whether the internal view should be layouted using default layout logic,...
virtual void iconStyle(const zfstring &propertyName, const zfstring &styleKey, ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
see labelStyle
virtual void buttonStateOnUpdate(void)
see E_ButtonStateOnUpdate
virtual void labelStyle(const zfstring &propertyName, const zfstring &styleKey, ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
util method to apply label style
virtual ZFUIAlignFlags & contentAlign()
button content(icon, label)'s layout align, v_ZFUIAlign::e_Center by default
Definition ZFUIButtonBasic.h:47
virtual void internalViewOnLayout(const ZFUIRect &bounds)
see internalBgViewAdd
virtual zfanyT< ZFUITextView > const & labelCheckedHighlighted()
label style in checked highlighted state
Definition ZFUIButtonBasic.h:83
virtual zfanyT< ZFUIImageView > bgView()
button's background view, style of this view must be changed by ZFUIButtonBasic::bgNormal,...
virtual zfanyT< ZFUITextView > label(ZFUIButtonState forState=(v_ZFUIButtonState::e_Normal))
util method to get button label's style
global style for ui elements
Definition ZFUIGlobalStyle.h:15
native image view
Definition ZFUIImageView.h:18
margin
Definition ZFUITypeDef.h:147
2D rectangle
Definition ZFUITypeDef.h:636
2D size
Definition ZFUITypeDef.h:397
2D size
Definition ZFUIViewType.h:41
view to display plain text
Definition ZFUITextView.h:21
align types for UI in ZFFramework
Definition ZFUITypeDef.h:1055
button state
Definition ZFUIButton.h:17
orientation types for UI in ZFFramework
Definition ZFUITypeDef.h:1135
see zfany
Definition zfany.h:106
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157