ZFFramework
 
Loading...
Searching...
No Matches
ZFUIView.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUIView_h_
7#define _ZFI_ZFUIView_h_
8
9#include "ZFUIViewType.h"
10#include "ZFUIMouseEvent.h"
11#include "ZFUIKeyEvent.h"
12#include "ZFUIWheelEvent.h"
13
15
17#define ZFSerializableKeyword_ZFUIView_internalImplView "internalImplView"
19#define ZFSerializableKeyword_ZFUIView_internalBgView "internalBgView"
21#define ZFSerializableKeyword_ZFUIView_internalFgView "internalFgView"
22
24#define ZFSerializableKeyword_ZFUIView_child "child"
26#define ZFSerializableKeyword_ZFUIView_layoutParam "layoutParam"
27
28// ============================================================
34
35// ============================================================
36// ZFUIView
37zfclassFwd _ZFP_ZFUIViewPrivate;
90zfclass ZFLIB_ZFUIKit ZFUIView : zfextend ZFStyle {
91 ZFOBJECT_DECLARE(ZFUIView, ZFStyle)
93
94public:
95 // ============================================================
96 // events
102 ZFEVENT(ViewTreeInWindowOnUpdate)
108 ZFEVENT(ViewTreeVisibleOnUpdate)
115 ZFEVENT(ViewChildOnUpdate)
123 ZFEVENT(ViewChildOnAdd)
131 ZFEVENT(ViewChildOnRemove)
138 ZFEVENT(ViewOnAddToParent)
144 ZFEVENT(ViewOnRemoveFromParent)
156 ZFEVENT(ViewFocusOnUpdate)
162 ZFEVENT(ViewOnEvent)
168 ZFEVENT(ViewLayoutOnLayoutRequest)
177 ZFEVENT(ViewLayoutOnMeasurePrepare)
184 ZFEVENT(ViewLayoutOnMeasure)
193 ZFEVENT(ViewLayoutOnLayoutPrepare)
201 ZFEVENT(ViewLayoutOnLayout)
208 ZFEVENT(ViewLayoutOnLayoutFinish)
214 ZFEVENT(NativeImplViewMarginOnUpdate)
215
216 // ============================================================
217 // serialize
218public:
231protected:
234 ZF_IN const ZFSerializableData &serializableData
235 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
236 , ZF_OUT_OPT ZFSerializableData *outErrorPos = zfnull
237 );
240 ZF_IN_OUT ZFSerializableData &serializableData
241 , ZF_OUT_OPT zfstring *outErrorHint = zfnull
242 , ZF_IN_OPT ZFSerializable *refOwner = zfnull
243 );
252 return zftrue;
253 }
254
255public:
256 // ============================================================
257 // properties
267
268
273
286
287 zffinal void _ZFP_ZFUIView_viewTreeInWindow(ZF_IN zfbool viewTreeInWindow);
288
295
302
309
318
324
334
348 , ZFMP_IN(ZFUIRect const &, viewFrame)
350
353
356
359
364 , ZFMP_IN(zffloat const &, propertyValue)
370 , ZFMP_IN(zffloat const &, propertyValue)
376 , ZFMP_IN(zffloat const &, propertyValue)
382 , ZFMP_IN(zffloat const &, propertyValue)
388 , ZFMP_IN(zffloat const &, propertyValue)
394 , ZFMP_IN(zffloat const &, propertyValue)
396
401 , ZFMP_IN(const ZFUISize &, size)
418
424
425 // ============================================================
426 // transform
453
463
473
483
484 // ============================================================
485 // util
486public:
512 , ZFMP_IN(ZFObject *, owner)
513 , ZFMP_IN(const zfstring &, propertyName)
548 , ZFMP_IN(const zfstring &, eventName)
549 , ZFMP_IN(ZFObject *, owner)
550 , ZFMP_IN(const zfstring &, methodName)
556 , ZFMP_IN(zfidentity, eventId)
557 , ZFMP_IN(ZFObject *, owner)
558 , ZFMP_IN(const zfstring &, methodName)
560
561 // ============================================================
562 // init and dealloc
563protected:
565 virtual void objectOnInit(void);
567 virtual void objectOnDealloc(void);
569 virtual void objectOnDeallocPrepare(void);
570
571protected:
574
575 // ============================================================
576public:
608
609protected:
613 virtual void nativeImplView(
615 , ZF_IN ZFUIViewNativeImplViewDeleteCallback nativeImplViewDeleteCallback
616 );
623
629
633 ZF_OUT ZFUIRect &ret
634 , ZF_IN const ZFUIRect &bounds
636 ) {
638 }
639
640 // ============================================================
641protected:
651 virtual void implChildOnAdd(
652 ZF_IN ZFUIView *child
653 , ZF_IN zfindex virtualIndex
654 , ZF_IN ZFUIViewChildLayer childLayer
655 , ZF_IN zfindex childLayerIndex
656 );
660 virtual void implChildOnRemove(
661 ZF_IN ZFUIView *child
662 , ZF_IN zfindex virtualIndex
663 , ZF_IN ZFUIViewChildLayer childLayer
664 , ZF_IN zfindex childLayerIndex
665 );
677
678public:
690 static void _ZFP_ZFUIView_nativeViewNotifyAdd(
691 ZF_IN ZFUIView *view
692 , ZF_IN void *nativeParentView
693 );
694 static void _ZFP_ZFUIView_nativeViewNotifyRemove(ZF_IN ZFUIView *view);
695
696 // ============================================================
697 // view focus
698public:
710 , ZFMP_IN(zfbool, focus)
712 zffinal void _ZFP_ZFUIView_focusOnUpdate(void) {
713 this->focusOnUpdate();
714 }
719protected:
721 virtual inline void focusOnUpdate(void) {
723 }
724
725 // ============================================================
726 // parent
727public:
728 zffinal void _ZFP_ZFUIView_parentOnUpdate(
729 ZF_IN ZFUIView *parentView
730 , ZF_IN ZFUILayoutParam *layoutParam
731 , ZF_IN ZFUIViewChildLayer viewLayer
732 );
737
738
744
745 // ============================================================
746 // scale settings
747public:
808protected:
814 virtual void UIScaleOnUpdate(void);
815
816 // ============================================================
817 // layout logic
818public:
825protected:
831 virtual const ZFClass *layoutParamClass(void);
837
838public:
847 ZFMETHOD_DECLARE_1(void, layoutParam
848 , ZFMP_IN(ZFUILayoutParam *, layoutParam)
857
858public:
881 , ZFMP_IN(const ZFUISize &, sizeHintOrig)
882 , ZFMP_IN(const ZFUISizeParam &, sizeParam)
903
904public:
905 void _ZFP_ZFUIView_notifyLayoutView(ZF_IN const ZFUIRect &viewFrame);
906protected:
910 virtual void layoutOnLayoutRequest(void);
914 virtual inline void layoutOnMeasurePrepare(
915 ZF_IN const ZFUISize &sizeHintOrig
916 , ZF_IN const ZFUISizeParam &sizeParam
917 ) {
918 }
919
941 virtual inline void layoutOnMeasure(
942 ZF_OUT ZFUISize &ret
943 , ZF_IN const ZFUISize &sizeHint
944 , ZF_IN const ZFUISizeParam &sizeParam
945 ) {
946 }
947
948 virtual inline void layoutOnMeasureFinish(
949 ZF_IN_OUT ZFUISize &measuredSize
950 , ZF_IN const ZFUISize &sizeHint
951 , ZF_IN const ZFUISizeParam &sizeParam
952 ) {
953 }
954
955 virtual inline void layoutOnLayoutPrepare(ZF_IN const ZFUIRect &bounds) {
956 }
957
965 virtual void layoutOnLayout(ZF_IN const ZFUIRect &bounds);
967 virtual inline void layoutOnLayoutFinish(ZF_IN const ZFUIRect &bounds) {
968 }
969
971 }
972
973 // ============================================================
974 // children management
975public:
980 , ZFMP_IN(const zfstring &, viewId)
981 , ZFMP_IN_OPT(zfbool, findRecursively, zftrue)
982 , ZFMP_IN_OPT(zfbool, includeInternalViews, zffalse)
988 , ZFMP_IN(const ZFClass *, cls)
989 , ZFMP_IN_OPT(zfbool, findRecursively, zftrue)
990 , ZFMP_IN_OPT(zfbool, includeInternalViews, zffalse)
1004 , ZFMP_IN(const ZFListener &, impl)
1005 , ZFMP_IN_OPT(zfbool, findRecursively, zftrue)
1006 , ZFMP_IN_OPT(zfbool, includeInternalViews, zffalse)
1008
1009public:
1019 , ZFMP_IN(ZFUIView *, view)
1021 , ZFMP_IN_OPT(zfindex, atIndex, zfindexMax())
1027 ZF_IN const zfany &view
1028 , ZF_IN_OPT zfindex atIndex = zfindexMax()
1029 );
1034 , ZFMP_IN(ZFUIView *, view)
1040 , ZFMP_IN(zfindex, index)
1054 , ZFMP_IN(zfindex, fromIndex)
1055 , ZFMP_IN(zfindex, toIndexOrIndexMax)
1061 , ZFMP_IN(ZFUIView *, child)
1062 , ZFMP_IN(zfindex, toIndexOrIndexMax)
1069 , ZFMP_IN(zfindex, atIndex)
1070 , ZFMP_IN(ZFUIView *, toReplace)
1080 , ZFMP_IN(zfindex, index)
1086 , ZFMP_IN(ZFUIView *, view)
1092
1106
1107 // ============================================================
1108 // events
1109protected:
1111 virtual void viewTreeInWindowOnUpdate(void);
1113 virtual void viewTreeVisibleOnUpdate(void);
1115 virtual void viewChildOnUpdate(void);
1117 virtual void viewChildOnAdd(
1118 ZF_IN ZFUIView *child
1119 , ZF_IN ZFUIViewChildLayer childLayer
1120 );
1122 virtual void viewChildOnRemove(
1123 ZF_IN ZFUIView *child
1124 , ZF_IN ZFUIViewChildLayer childLayer
1125 );
1127 virtual void viewOnAddToParent(ZF_IN ZFUIView *parent);
1129 virtual void viewOnRemoveFromParent(ZF_IN ZFUIView *parent);
1130
1131 // ============================================================
1132 // internal views
1133public:
1136 , ZFMP_IN(ZFUIView *, view)
1138 , ZFMP_IN_OPT(zfbool, addAsTopMost, zftrue)
1142 , ZFMP_IN(ZFUIView *, view)
1146
1147public:
1166 , ZFMP_IN(ZFUIView *, view)
1168 , ZFMP_IN_OPT(zfbool, addAsTopMost, zftrue)
1172 , ZFMP_IN(ZFUIView *, view)
1178
1179public:
1182 , ZFMP_IN(ZFUIView *, view)
1184 , ZFMP_IN_OPT(zfbool, addAsTopMost, zftrue)
1188 , ZFMP_IN(ZFUIView *, view)
1192
1193 // ============================================================
1194 // other internal view logic
1195public:
1208 , ZFMP_IN(const zfstring &, tag)
1212 , ZFMP_IN(const zfstring &, tag)
1222
1223protected:
1228 virtual inline zfbool internalViewShouldLayout(ZF_IN ZFUIView *internalView) {
1229 return zftrue;
1230 }
1231
1232 virtual void internalViewOnLayout(ZF_IN const ZFUIRect &bounds);
1233
1234 // ============================================================
1235 // UI events
1236public:
1241 , ZFMP_IN(ZFUIEvent *, event)
1243protected:
1251 virtual void viewEventOnEvent(ZF_IN ZFUIEvent *event);
1252
1253 // ============================================================
1254 // events
1255protected:
1268 virtual void viewEventOnMouseEvent(ZF_IN ZFUIMouseEvent *mouseEvent);
1269
1282 virtual void viewEventOnKeyEvent(ZF_IN ZFUIKeyEvent *keyEvent);
1290
1301 virtual void viewEventOnWheelEvent(ZF_IN ZFUIWheelEvent *wheelEvent);
1302
1303 // ============================================================
1304 // override
1305protected:
1310 virtual void styleableOnCopyFrom(ZF_IN ZFObject *anotherStyleable);
1311
1312protected:
1314 virtual void observerOnAdd(ZF_IN zfidentity eventId);
1316 virtual void observerOnRemove(ZF_IN zfidentity eventId);
1317
1318private:
1319 _ZFP_ZFUIViewPrivate *d;
1320 friend zfclassFwd _ZFP_ZFUIViewPrivate;
1321};
1322
1324#endif // #ifndef _ZFI_ZFUIView_h_
1325
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:196
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#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:184
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:188
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:192
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:200
#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_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
#define zftrue
bool true type
Definition ZFCoreTypeDef_CoreType.h:107
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#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 zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFMP_IN_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:117
#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_STATIC_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:708
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1025
#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 ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:316
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#define ZFPROPERTY_ON_UPDATE_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:238
#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:260
key event for ui elements
#define ZFLIB_ZFUIKit
used to export symbols
Definition ZFUIKitDef.h:16
mouse event for ui elements
_zft_ZFUIColor ZFUIColor
color with AARRGGBB format
Definition ZFUITypeDef.h:1184
ZFUIColor const & ZFUIColorZero(void)
zero color
Definition ZFUITypeDef.h:1188
void ZFUIRectApplyMarginT(ZFUIRect &ret, const ZFUIRect &rect, const ZFUIMargin &margin)
return a rect excluding the margin
Definition ZFUITypeDef.h:950
ZFUISize const & ZFUISizeInvalid(void)
(-1, -1)
Definition ZFUITypeDef.h:428
void(* ZFUIViewNativeImplViewDeleteCallback)(zfanyT< ZFUIView > const &view)
see ZFUIView::nativeImplView
Definition ZFUIView.h:33
additional class for ZFUIView
v_ZFUIViewChildLayer::ZFEnumType ZFUIViewChildLayer
see v_ZFUIViewChildLayer
Definition ZFUIViewType.h:509
wheel event for ui elements
light weight array
Definition ZFCoreArray.h:331
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
void observerNotify(zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull)
notify the observer with eventId
ZFSerializable's data container, see ZFSerializable.
Definition ZFSerializableData.h:74
base class of all ui event
Definition ZFUIEvent.h:15
key event for ui elements
Definition ZFUIKeyEvent.h:17
base class of all layout param in ZFUIView
Definition ZFUIViewType.h:123
margin
Definition ZFUITypeDef.h:147
mouse event for ui elements
Definition ZFUIMouseEvent.h:52
2D point
Definition ZFUITypeDef.h:62
2D rectangle
Definition ZFUITypeDef.h:636
2D size
Definition ZFUITypeDef.h:397
2D size
Definition ZFUIViewType.h:41
see v_ZFUITransform, ZFUITransformFlagsToString, ZFUITransformFlagsFromString
Definition ZFUIViewType.h:593
base class of all UI views
Definition ZFUIView.h:90
virtual void removeFromParent()
remove this view from parent or do nothing if no parent
virtual void internalFgViewRemove(ZFUIView *view)
see internalBgViewAdd
virtual ZFCoreArray< zfstring > internalViewAutoSerializeTagGetAll()
see internalViewAutoSerializeTagAdd
virtual zfbool & viewUIEnableTree()
whether the view as well as all its children should receive user interaction, see viewUIEnable
Definition ZFUIView.h:307
virtual zffloat & alpha()
view's alpha, 1 by default
Definition ZFUIView.h:292
virtual void viewFrameReset()
see viewFrame
virtual zffloat width()
see viewFrame
virtual ZFUISize & viewSizeMax()
max size, negative value means not set, ZFUISizeInvalid by default
Definition ZFUIView.h:416
virtual void implChildOnRemoveAllForDealloc(void)
called to remove all children during parent dealloc for performance
virtual void layoutOnLayoutFinish(const ZFUIRect &bounds)
see E_ViewLayoutOnLayoutFinish
Definition ZFUIView.h:967
virtual zffloat & rotateX()
see transformAvailable
Definition ZFUIView.h:475
virtual void observerOnAdd(zfidentity eventId)
called when add first observer
virtual zfbool & mouseHoverEnable()
whether enable mouse hover event, see ZFUIView::viewEventOnMouseEvent, false by default
Definition ZFUIView.h:322
zfanyT< ZFUILayoutParam > child(const zfany &view, zfindex atIndex=((zfindex) -1))
add child and return child's layoutParam, see childWithParam
virtual void nativeImplViewMarginImplUpdate(ZFUIMargin &nativeImplViewMargin)
see nativeImplViewMargin, subclass must call super and "append" to existing margin
Definition ZFUIView.h:621
virtual zfbool focused()
whether the view currently focused
virtual zfbool serializableOnCheckNeedSerializeChildren(void)
whether we should serialize all children
Definition ZFUIView.h:251
virtual zffloat UIScaleForImpl()
see UIScale
virtual void * nativeImplView()
native implementation view
virtual void objectInfoImplAppend(zfstring &ret)
see objectInfo
virtual zfbool viewTreeVisible()
true only if added to ZFUIRootWindow and all of parents are visible
virtual void internalViewOnLayout(const ZFUIRect &bounds)
see internalBgViewAdd
virtual zfstring & viewId()
used to identify a view, empty by default
Definition ZFUIView.h:266
virtual zfbool layouting()
true if currently being layouted
virtual void * nativeView()
native container view
virtual const ZFClass * layoutParamClass(void)
see layoutParamCreate
virtual void internalViewAutoSerializeTagRemoveAll()
see internalViewAutoSerializeTagAdd
virtual ZFCoreArray< zfautoT< ZFUIView > > childRawArray()
return all children including internal views, see childArray
virtual void nativeImplViewMarginOnUpdate(void)
see E_NativeImplViewMarginOnUpdate
Definition ZFUIView.h:626
virtual ZFUIViewChildLayer viewLayer()
this view belongs to which layer of parent, valid only if parent is not null
static zfidentity E_NativeImplViewMarginOnUpdate(void)
see ZFObject::observerNotify
virtual void objectOnDealloc(void)
override this to destroy your object
virtual zfanyT< ZFUILayoutParam > internalImplViewAdd(ZFUIView *view, ZFUILayoutParam *layoutParam=(zft_zfnull), zfbool addAsTopMost=(_ZFT_t_zftrue))
see internalBgViewAdd
virtual ZFCoreArray< zfautoT< ZFUIView > > internalImplViewArray()
see internalBgViewAdd
virtual zffloat UIScaleFixed()
see UIScale
virtual void viewSizeFixed(const ZFUISize &size)
util method to set fixed size, by setting both of viewSizeMin and viewSizeMax
virtual zfanyT< ZFUILayoutParam > internalFgViewAdd(ZFUIView *view, ZFUILayoutParam *layoutParam=(zft_zfnull), zfbool addAsTopMost=(_ZFT_t_zftrue))
see internalBgViewAdd
virtual void layoutRequest()
set need layout
virtual void viewOnRemoveFromParent(ZFUIView *parent)
see E_ViewOnRemoveFromParent
virtual void childRemoveAt(zfindex index)
remove view at index or assert fail if index out of range
virtual zfbool layoutRequested()
true if need layout
virtual zfbool viewFrameOverrided()
true if viewFrame changed by user, use viewFrameReset to reset
virtual void internalViewAutoSerializeTagGetAllT(ZFCoreArray< zfstring > &ret)
see internalViewAutoSerializeTagAdd
virtual void viewEventOnEvent(ZFUIEvent *event)
notified when a ZFUIEvent occurred
virtual void implChildOnAdd(ZFUIView *child, zfindex virtualIndex, ZFUIViewChildLayer childLayer, zfindex childLayerIndex)
called to add or remove view to impl
virtual zfbool & viewUIEnable()
whether the view should receive user interaction (doesn't affect children, see viewUIEnableTree)
Definition ZFUIView.h:300
virtual void focusOnUpdate(void)
see E_ViewFocusOnUpdate
Definition ZFUIView.h:721
virtual zffloat & UIScale()
UI scale for view tree.
Definition ZFUIView.h:797
virtual zfbool serializableOnSerializeFromData(const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull)
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to s...
virtual void bindEvent(const zfstring &eventName, ZFObject *owner, const zfstring &methodName)
util method to bind this view's event to owner's method
virtual zfbool viewUIEnableTreeFixed()
true if viewUIEnableTree and all of parents are viewUIEnableTree
virtual zffloat UIScaleForPixel()
see UIScale
virtual void viewEventOnWheelEvent(ZFUIWheelEvent *wheelEvent)
called when wheel event occurred
virtual zffloat & scaleX()
see transformAvailable
Definition ZFUIView.h:465
virtual ZFUIRect const & viewFrame()
the view's frame
virtual void objectOnInit(void)
override this to init your object
virtual zffloat & rotateZ()
see transformAvailable
Definition ZFUIView.h:481
virtual zffloat & translateY()
see transformAvailable
Definition ZFUIView.h:458
virtual void viewEventOnMouseEvent(ZFUIMouseEvent *mouseEvent)
called when mouse event occurred
virtual void internalBgViewRemove(ZFUIView *view)
see internalBgViewAdd
virtual zfbool serializableOnSerializeToData(ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
corresponding to serializableOnSerializeFromData, return whether the task is success,...
static zfidentity E_ViewFocusOnUpdate(void)
see ZFObject::observerNotify
virtual void layoutOnLayout(const ZFUIRect &bounds)
called by viewFrame to layout the view and children
virtual void implChildOnRemove(ZFUIView *child, zfindex virtualIndex, ZFUIViewChildLayer childLayer, zfindex childLayerIndex)
see implChildOnAdd, implChildOnRemoveAllForDealloc
virtual const ZFUIRect & nativeImplViewFrame()
frame of nativeImplView
virtual void layoutOnLayoutRequest(void)
called during layoutRequest
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
virtual void childRemove(ZFUIView *view)
remove view or do nothing if view isn't added to this view
virtual void layoutOnMeasurePrepare(const ZFUISize &sizeHintOrig, const ZFUISizeParam &sizeParam)
called during layoutMeasure
Definition ZFUIView.h:914
virtual zfautoT< ZFUILayoutParam > layoutParamCreate()
create layout param, calling layoutParamClass to create instance and layoutParamOnUpdate to update
virtual ZFUIColor & bgColor()
background color, ZFUIColorZero by default
Definition ZFUIView.h:422
virtual zfanyT< ZFUIView > childAt(zfindex index)
get child view at index or assert fail if out of range
virtual zffloat & rotateY()
see transformAvailable
Definition ZFUIView.h:478
static ZFUITransformFlags transformAvailable()
whether transform is supported
virtual zfanyT< ZFUIView > childFindByClass(const ZFClass *cls, zfbool findRecursively=(_ZFT_t_zftrue), zfbool includeInternalViews=(_ZFT_t_zffalse))
find view by class, return the view or null if not found
virtual ZFCoreArray< zfautoT< ZFUIView > > internalBgViewArray()
usually for debug use only, try to avoid use this in your app for other purpose
virtual void viewChildOnAdd(ZFUIView *child, ZFUIViewChildLayer childLayer)
see E_ViewChildOnAdd
virtual zffloat height()
see viewFrame
virtual void viewEventSend(ZFUIEvent *event)
directly send a event, use with caution
virtual void internalViewAutoSerializeTagAdd(const zfstring &tag)
used to apply auto serialize logic to internal views
virtual zfindex childFind(ZFUIView *view)
return index of view or zfindexMax() if not child of this view
virtual void viewTreeVisibleOnUpdate(void)
see E_ViewTreeVisibleOnUpdate
virtual zffloat & translateX()
see transformAvailable
Definition ZFUIView.h:455
virtual const ZFUISize & layoutMeasuredSize()
get measured size, invalid if not measured
virtual void layoutOnLayoutPrepare(const ZFUIRect &bounds)
see E_ViewLayoutOnLayoutPrepare
Definition ZFUIView.h:955
virtual void childReplaceAt(zfindex atIndex, ZFUIView *toReplace)
replace child at index, assert fail if index out of range or view to replace already has parent
virtual void UIScaleOnUpdate(void)
see UIScale, ensured called only when scale value actually changed
virtual void viewChildOnUpdate(void)
see E_ViewChildOnUpdate
virtual void observerOnRemove(zfidentity eventId)
called when remove last observer
virtual zfauto childForEach(const ZFListener &impl, zfbool findRecursively=(_ZFT_t_zftrue), zfbool includeInternalViews=(_ZFT_t_zffalse))
call custom impl for each child
virtual void viewEventOnKeyEvent(ZFUIKeyEvent *keyEvent)
called when key occurred
virtual zfbool internalViewShouldLayout(ZFUIView *internalView)
called to check whether the internal view should be layouted using default layout logic,...
Definition ZFUIView.h:1228
virtual zfindex childCount()
get child view count
virtual void layoutParamOnUpdate(ZFUILayoutParam *layoutParam)
see layoutParamCreate
Definition ZFUIView.h:835
virtual const ZFUIRect & viewFramePrev()
previous viewFrame
virtual zfanyT< ZFUILayoutParam > childWithParam(ZFUIView *view, ZFUILayoutParam *layoutParam, zfindex atIndex=(((zfindex) -1)))
add view with layout param, param must be created by layoutParamCreate
virtual void layoutChildOffsetOnUpdate(ZFUIPoint &ret)
see layoutChildOffset
Definition ZFUIView.h:970
virtual zfbool & focusObtainWhenClick()
whether try to obtain focus when clicked down, true by default
Definition ZFUIView.h:333
virtual ZFCoreArray< zfautoT< ZFUIView > > childArray()
get the child view array
virtual zfbool viewTreeInWindow()
true if added to ZFUIRootWindow
virtual zfbool viewUIEnableFixed()
true if viewUIEnable and all of parents are viewUIEnableTree
virtual void internalViewAutoSerializeTagRemove(const zfstring &tag)
see internalViewAutoSerializeTagAdd
virtual void layoutOnMeasureFinish(ZFUISize &measuredSize, const ZFUISize &sizeHint, const ZFUISizeParam &sizeParam)
see E_ViewLayoutOnMeasure
Definition ZFUIView.h:948
virtual zfanyT< ZFUIView > parent()
parent view or null if none
virtual zffloat UIScaleInherited()
see UIScale
virtual zffloat & translateZ()
see transformAvailable
Definition ZFUIView.h:461
virtual void viewChildOnRemove(ZFUIView *child, ZFUIViewChildLayer childLayer)
see E_ViewChildOnRemove
virtual const ZFUIMargin & nativeImplViewMargin()
inner margin between ZFUIView and the internal nativeImplView
virtual const ZFUISize & layoutMeasure(const ZFUISize &sizeHintOrig, const ZFUISizeParam &sizeParam)
measure the view
virtual void layoutParam(ZFUILayoutParam *layoutParam)
manually set layout param
virtual zffloat centerX()
see viewFrame
virtual ZFCoreArray< zfautoT< ZFUIView > > internalFgViewArray()
see internalBgViewAdd
virtual void nativeImplViewMarginUpdate()
see nativeImplViewMargin, layoutRequest if the final value actually changed
virtual void nativeImplViewOnLayout(ZFUIRect &ret, const ZFUIRect &bounds, const ZFUIMargin &nativeImplViewMargin)
called to layout nativeImplView
Definition ZFUIView.h:632
virtual ZFUIPoint layoutChildOffset()
get child offset to this view
virtual void internalImplViewRemove(ZFUIView *view)
see internalBgViewAdd
virtual zfanyT< ZFUIView > focusFind()
recursively to find focused child, take care of performance
virtual void focusRequest(zfbool focus)
request to obtain or resign focus, result can be checked by focused
virtual void bind(ZFObject *owner, const zfstring &propertyName)
util method to bind this view to owner's property, and auto setup viewId if not set
virtual zffloat x()
see viewFrame
virtual zfbool & visible()
visible or not, zftrue by default
Definition ZFUIView.h:271
virtual zfanyT< ZFUILayoutParam > internalBgViewAdd(ZFUIView *view, ZFUILayoutParam *layoutParam=(zft_zfnull), zfbool addAsTopMost=(_ZFT_t_zftrue))
internal view which is independent from normal view
virtual void layoutIfNeed()
force to layout if need
virtual void childRemoveAll()
remove all child view
virtual void styleableOnCopyFrom(ZFObject *anotherStyleable)
for a view, copy style would also copy all of it's children
virtual void viewTreeInWindowOnUpdate(void)
see E_ViewTreeInWindowOnUpdate
virtual zfbool & focusable()
whether the view can be focused, false by default
Definition ZFUIView.h:328
virtual ZFUISize & viewSizeMin()
min size, ZFUISizeZero by default
Definition ZFUIView.h:411
virtual zffloat centerY()
see viewFrame
virtual zffloat & scaleY()
see transformAvailable
Definition ZFUIView.h:468
virtual void viewEventOnKeyEventResolveFocus(ZFUIKeyEvent *keyEvent)
called by viewEventOnKeyEvent to resolve focus move key event
virtual void layoutOnMeasure(ZFUISize &ret, const ZFUISize &sizeHint, const ZFUISizeParam &sizeParam)
called by layoutMeasure to decide the view's size
Definition ZFUIView.h:941
virtual void viewOnAddToParent(ZFUIView *parent)
see E_ViewOnAddToParent
virtual zffloat & scaleZ()
see transformAvailable
Definition ZFUIView.h:471
virtual void serializableRefLayoutParam(ZFUILayoutParam *serializableRefLayoutParam)
store ref layout param for this view for reducing serialization output size
virtual zffloat y()
see viewFrame
virtual void childMove(zfindex fromIndex, zfindex toIndexOrIndexMax)
move view, make toIndexOrIndexMax as zfindexMax() to move to top most, and 0 to bottom most,...
wheel event for ui elements
Definition ZFUIWheelEvent.h:16
util method to cast ZFObject types freely
Definition zfany.h:35
see zfany
Definition zfany.h:113
a ZFObject holder which would release content object automatically when destroyed
Definition zfautoFwd.h:34
type restrict version of zfauto
Definition zfautoFwd.h:108