ZFFramework
 
Loading...
Searching...
No Matches
ZFUIFlowLayout.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUIFlowLayout_h_
7#define _ZFI_ZFUIFlowLayout_h_
8
9#include "ZFUIWidgetDef.h"
11
12// ============================================================
13// ZFUIFlowLayoutParam
22zfclass ZFLIB_ZFUIWidget ZFUIFlowLayoutParam : zfextend ZFUILayoutParam {
23 ZFOBJECT_DECLARE(ZFUIFlowLayoutParam, ZFUILayoutParam)
24
25
29
31 propertyValue = v_ZFUIAlign::e_Center;
32 }
33
34public:
36 /* ZFTAG_TRICKS: util for chained call to build view tree */
37 inline zfanyT<ZFUIFlowLayoutParam> child(
38 ZF_IN const zfany &view
39 , ZF_IN_OPT zfindex atIndex = zfindexMax()
40 ) {
41 return zfsuper::child(view, atIndex);
42 }
44};
45
46// ============================================================
47// ZFUIFlowLayout
61zfclass ZFLIB_ZFUIWidget ZFUIFlowLayout : zfextend ZFUIView {
62 ZFOBJECT_DECLARE(ZFUIFlowLayout, ZFUIView)
64
65public:
66 // ============================================================
67 // properties
90
96
102
108
114
127
128 // ============================================================
129 // override ZFUIView
130public:
132 /* ZFTAG_TRICKS: util for chained call to build view tree */
134 ZF_IN const zfany &view
135 , ZF_IN_OPT zfindex atIndex = zfindexMax()
136 ) {
137 return zfsuper::child(view, atIndex);
138 }
140protected:
142 virtual const ZFClass *layoutParamClass(void) {
144 }
145
147 virtual void layoutOnMeasure(
148 ZF_OUT ZFUISize &ret
149 , ZF_IN const ZFUISize &sizeHint
150 , ZF_IN const ZFUISizeParam &sizeParam
151 );
153 virtual void layoutOnLayout(ZF_IN const ZFUIRect &bounds);
154};
155
157#endif // #ifndef _ZFI_ZFUIFlowLayout_h_
158
#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_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:184
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:188
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
_zft_zffloat zffloat
same as float, see zfindex
Definition ZFCoreTypeDef_CoreType.h:183
#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_INIT_INLINE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:226
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#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
v_ZFUIOrientation::ZFEnumType ZFUIOrientation
see v_ZFUIOrientation
Definition ZFUITypeDef.h:1145
v_ZFUIScaleType::ZFEnumType ZFUIScaleType
see v_ZFUIScaleType
Definition ZFUITypeDef.h:1487
global header for ZFUIWidget module
#define ZFLIB_ZFUIWidget
used to export symbols
Definition ZFUIWidgetDef.h:17
see v_ZFUIAlign, ZFUIAlignFlagsToString, ZFUIAlignFlagsFromString
Definition ZFUITypeDef.h:1075
virtual zfindex & childCountPerLine()
max child count per line, 0 means no limit
Definition ZFUIFlowLayout.h:106
virtual zffloat & childSpaceY()
extra space between each child independent from children's layout param, in y direction,...
Definition ZFUIFlowLayout.h:125
virtual ZFUIMargin & childMargin()
extra margin independent from children's layout param's margin, ZFUIMarginZero by default
Definition ZFUIFlowLayout.h:112
virtual ZFUIScaleType & childScaleType()
valid only when gridMode, indicates how to scale children
Definition ZFUIFlowLayout.h:100
virtual zffloat & childSpaceX()
extra space between each child independent from children's layout param, in x direction,...
Definition ZFUIFlowLayout.h:119
virtual ZFUIOrientation & orientation()
main direction to layout children, v_ZFUIOrientation::e_Left by default
Definition ZFUIFlowLayout.h:74
virtual const ZFClass * layoutParamClass(void)
see layoutParamCreate
Definition ZFUIFlowLayout.h:142
virtual void layoutOnLayout(const ZFUIRect &bounds)
called by viewFrame to layout the view and children
virtual ZFUIOrientation & orientationSecondary()
secondary direction to layout children, v_ZFUIOrientation::e_Top by default
Definition ZFUIFlowLayout.h:88
virtual void layoutOnMeasure(ZFUISize &ret, const ZFUISize &sizeHint, const ZFUISizeParam &sizeParam)
called by layoutMeasure to decide the view's size
virtual zfbool & gridMode()
whether in grid mode, which makes all children have same size
Definition ZFUIFlowLayout.h:94
layout param for ZFUIFlowLayout
Definition ZFUIFlowLayout.h:22
static const ZFClass * ClassData(void)
get class info
Definition ZFUIFlowLayout.h:23
virtual zfbool & reserveSpace()
whether reserve space if child is not visible, false by default
Definition ZFUIFlowLayout.h:28
virtual ZFUIAlignFlags & align()
see ZFUILayoutParam, default is (v_ZFUIAlign::e_Left | v_ZFUIAlign::e_Top)
Definition ZFUIViewType.h:153
margin
Definition ZFUITypeDef.h:147
2D rectangle
Definition ZFUITypeDef.h:636
2D size
Definition ZFUITypeDef.h:397
2D size
Definition ZFUIViewType.h:41
zfanyT< ZFUILayoutParam > child(const zfany &view, zfindex atIndex=((zfindex) -1))
add child and return child's layoutParam, see childWithParam
@ e_Center
Center(0)
Definition ZFUITypeDef.h:1056
orientation types for UI in ZFFramework
Definition ZFUITypeDef.h:1135
scale type when stretch items
Definition ZFUITypeDef.h:1434
util method to cast ZFObject types freely
Definition zfany.h:35
see zfany
Definition zfany.h:106