ZFFramework
 
Loading...
Searching...
No Matches
ZFProtocolZFUIView.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFProtocolZFUIView_h_
7#define _ZFI_ZFProtocolZFUIView_h_
8
9#include "ZFCore/ZFProtocol.h"
10#include "ZFUIKit/ZFUIView.h"
12
17public:
32 virtual zfbool nativeViewCacheOnSave(ZF_IN void *nativeView) {
33 return zffalse;
34 }
35
39 ZF_IN ZFUIView *view
40 , ZF_IN void *nativeView
41 ) {
42 }
43
57 virtual void nativeViewDestroy(ZF_IN void *nativeView) zfpurevirtual;
58
70 virtual void nativeImplView(
71 ZF_IN ZFUIView *view
72 , ZF_IN void *nativeImplViewOld
73 , ZF_IN void *nativeImplView
74 , ZF_IN zfindex virtualIndex
75 , ZF_IN zfbool nativeImplViewRequireVirtualIndex
82 virtual void nativeImplViewFrame(
83 ZF_IN ZFUIView *view
84 , ZF_IN const ZFUIRect &rect
86
90 virtual zffloat UIScaleForImpl(ZF_IN void *nativeView) zfpurevirtual;
94 virtual zffloat UIScaleForPixel(ZF_IN void *nativeView) zfpurevirtual;
95
96 // ============================================================
97 // properties
98public:
100 virtual void visible(
101 ZF_IN ZFUIView *view
105 virtual void alpha(
106 ZF_IN ZFUIView *view
110 virtual void viewUIEnable(
111 ZF_IN ZFUIView *view
115 virtual void viewUIEnableTree(
116 ZF_IN ZFUIView *view
120 virtual void mouseHoverEnable(
121 ZF_IN ZFUIView *view
123 ) {
124 // no hover event support by default
125 }
126
127 virtual void bgColor(
128 ZF_IN ZFUIView *view
129 , ZF_IN const ZFUIColor &bgColor
131
132 // ============================================================
133 // children
134public:
143 virtual void child(
144 ZF_IN ZFUIView *parent
146 , ZF_IN zfindex virtualIndex
147 , ZF_IN ZFUIViewChildLayer childLayer
148 , ZF_IN zfindex childLayerIndex
155 virtual void childRemove(
156 ZF_IN ZFUIView *parent
158 , ZF_IN zfindex virtualIndex
159 , ZF_IN ZFUIViewChildLayer childLayer
160 , ZF_IN zfindex childLayerIndex
170
171 // ============================================================
172 // frame and layout
173public:
177 virtual void viewFrame(
178 ZF_IN ZFUIView *view
179 , ZF_IN const ZFUIRect &rect
190
194 virtual void measureNativeView(
195 ZF_OUT ZFUISize &ret
196 , ZF_IN void *nativeView
197 , ZF_IN const ZFUISize &sizeHint
199
200 // ============================================================
201 // callbacks that implementations must notify
202public:
209 ZF_IN ZFUIView *view
210 , ZF_IN const ZFUIRect &rect
211 ) {
212 view->_ZFP_ZFUIView_notifyLayoutView(ZFUIRectApplyScaleReversely(rect, view->UIScaleFixed()));
213 }
214
222 ZF_IN ZFUIView *view
223 , ZF_IN ZFUIEvent *uiEvent
224 ) {
225 uiEvent->_ZFP_ZFUIEvent_eventOnApplyScaleReversely(view->UIScaleFixed());
226 view->viewEventSend(uiEvent);
227 }
229
231#endif // #ifndef _ZFI_ZFProtocolZFUIView_h_
232
#define zffinal
dummy macro shows that a method or class is designed must not to be overrided
Definition ZFCoreTypeDef_ClassType.h:63
#define zfpurevirtual
dummy macro shows that a method is pure virtual method
Definition ZFCoreTypeDef_ClassType.h:68
#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
_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
_zft_zffloat zffloat
same as float, see zfindex
Definition ZFCoreTypeDef_CoreType.h:183
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
protocol definitions for ZFFramework
#define ZFPROTOCOL_INTERFACE_END(ModuleName)
for more information, please refer to ZFPROTOCOL_INTERFACE_BEGIN
Definition ZFProtocol.h:414
#define ZFPROTOCOL_INTERFACE_BEGIN(ZFLIB_, ModuleName)
declare a protocol interface for ZFFramework
Definition ZFProtocol.h:408
#define ZFLIB_ZFUIKit
used to export symbols
Definition ZFUIKitDef.h:16
_zft_ZFUIColor ZFUIColor
color with AARRGGBB format
Definition ZFUITypeDef.h:1184
ZFUIRect ZFUIRectApplyScaleReversely(const ZFUIRect &rect, zffloat scale)
return a scaled rect reversely
Definition ZFUITypeDef.h:859
base class of all UI views
v_ZFUIViewChildLayer::ZFEnumType ZFUIViewChildLayer
see v_ZFUIViewChildLayer
Definition ZFUIViewType.h:511
virtual void viewUIEnable(ZFUIView *view, zfbool viewUIEnable)=0
see ZFUIView
virtual void nativeImplViewFrame(ZFUIView *view, const ZFUIRect &rect)=0
see ZFUIView::nativeImplViewMarginUpdate
void notifyUIEvent(ZFUIView *view, ZFUIEvent *uiEvent)
implementation must notify when UI event occurred
Definition ZFProtocolZFUIView.h:221
void notifyLayoutView(ZFUIView *view, const ZFUIRect &rect)
implementations must notify when need layout if view's parent isn't ZFUIView
Definition ZFProtocolZFUIView.h:208
virtual void nativeViewCacheOnRestore(ZFUIView *view, void *nativeView)
see nativeViewCacheOnSave
Definition ZFProtocolZFUIView.h:38
virtual void bgColor(ZFUIView *view, const ZFUIColor &bgColor)=0
see ZFUIView
virtual void visible(ZFUIView *view, zfbool visible)=0
see ZFUIView
virtual void layoutRequest(ZFUIView *view)=0
called by ZFUIView to notify the implementation that the view needs layout
virtual zffloat UIScaleForPixel(void *nativeView)=0
get proper scale for physical pixel
virtual void viewFrame(ZFUIView *view, const ZFUIRect &rect)=0
set view's frame, no need to worry about layout param or auto resizing
virtual void childRemoveAllForDealloc(ZFUIView *parent)=0
called to remove all children during parent dealloc for performance
virtual void nativeViewDestroy(void *nativeView)=0
called when a ZFUIView destroyed, the internal nativeView could be accessed by ZFUIView....
virtual void alpha(ZFUIView *view, zffloat alpha)=0
see ZFUIView
virtual void childRemove(ZFUIView *parent, ZFUIView *child, zfindex virtualIndex, ZFUIViewChildLayer childLayer, zfindex childLayerIndex)=0
remove view, no need to worry about layout param or ZFUIView's internal views
virtual zfbool nativeViewCacheOnSave(void *nativeView)
called to save native view cache
Definition ZFProtocolZFUIView.h:32
virtual void viewUIEnableTree(ZFUIView *view, zfbool viewUIEnableTree)=0
see ZFUIView
virtual zffloat UIScaleForImpl(void *nativeView)=0
get proper scale for the view
virtual void measureNativeView(ZFUISize &ret, void *nativeView, const ZFUISize &sizeHint)=0
measure a native view, only called by ZFUINativeViewWrapper
virtual void child(ZFUIView *parent, ZFUIView *child, zfindex virtualIndex, ZFUIViewChildLayer childLayer, zfindex childLayerIndex)=0
add view, no need to worry about layout param or internal views
virtual void mouseHoverEnable(ZFUIView *view, zfbool mouseHoverEnable)
see ZFUIView
Definition ZFProtocolZFUIView.h:120
virtual void * nativeViewCreate(ZFUIView *view)=0
called when a ZFUIView created, to register native view to ZFUIView
virtual void nativeImplView(ZFUIView *view, void *nativeImplViewOld, void *nativeImplView, zfindex virtualIndex, zfbool nativeImplViewRequireVirtualIndex)=0
attach a native view to this view, see ZFUINativeViewWrapper
base class of all ui event
Definition ZFUIEvent.h:15
2D rectangle
Definition ZFUITypeDef.h:636
2D size
Definition ZFUITypeDef.h:397
base class of all UI views
Definition ZFUIView.h:93