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 "../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
81 virtual void nativeImplViewFrame(
82 ZF_IN ZFUIView *view
83 , ZF_IN const ZFUIRect &rect
85
89 virtual zffloat UIScaleForImpl(ZF_IN void *nativeView) zfpurevirtual;
93 virtual zffloat UIScaleForPixel(ZF_IN void *nativeView) zfpurevirtual;
94
95 // ============================================================
96 // properties
97public:
99 virtual void visible(
100 ZF_IN ZFUIView *view
104 virtual void alpha(
105 ZF_IN ZFUIView *view
109 virtual void viewUIEnable(
110 ZF_IN ZFUIView *view
114 virtual void viewUIEnableTree(
115 ZF_IN ZFUIView *view
119 virtual void mouseHoverEnable(
120 ZF_IN ZFUIView *view
122 ) {
123 // no hover event support by default
124 }
125
126 virtual void bgColor(
127 ZF_IN ZFUIView *view
128 , ZF_IN const ZFUIColor &bgColor
130
131 // ============================================================
132 // children
133public:
142 virtual void child(
143 ZF_IN ZFUIView *parent
145 , ZF_IN zfindex virtualIndex
146 , ZF_IN ZFUIViewChildLayer childLayer
147 , ZF_IN zfindex childLayerIndex
154 virtual void childRemove(
155 ZF_IN ZFUIView *parent
157 , ZF_IN zfindex virtualIndex
158 , ZF_IN ZFUIViewChildLayer childLayer
159 , ZF_IN zfindex childLayerIndex
169
170 // ============================================================
171 // frame and layout
172public:
176 virtual void viewFrame(
177 ZF_IN ZFUIView *view
178 , ZF_IN const ZFUIRect &rect
189
193 virtual void measureNativeView(
194 ZF_OUT ZFUISize &ret
195 , ZF_IN void *nativeView
196 , ZF_IN const ZFUISize &sizeHint
198
199 // ============================================================
200 // callbacks that implementations must notify
201public:
208 ZF_IN ZFUIView *view
209 , ZF_IN const ZFUIRect &rect
210 ) {
211 view->_ZFP_ZFUIView_notifyLayoutView(ZFUIRectApplyScaleReversely(rect, view->UIScaleFixed()));
212 }
213
221 ZF_IN ZFUIView *view
222 , ZF_IN ZFUIEvent *uiEvent
223 ) {
224 uiEvent->_ZFP_ZFUIEvent_eventOnApplyScaleReversely(view->UIScaleFixed());
225 view->viewEventSend(uiEvent);
226 }
228
230#endif // #ifndef _ZFI_ZFProtocolZFUIView_h_
231
#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:184
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:192
_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:412
#define ZFPROTOCOL_INTERFACE_BEGIN(ZFLIB_, ModuleName)
declare a protocol interface for ZFFramework
Definition ZFProtocol.h:406
#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:509
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:220
void notifyLayoutView(ZFUIView *view, const ZFUIRect &rect)
implementations must notify when need layout if view's parent isn't ZFUIView
Definition ZFProtocolZFUIView.h:207
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 ZFUINativeView
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:119
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)=0
attach a native view to this view, see ZFUINativeView
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:90