ZFFramework
 
Loading...
Searching...
No Matches
ZFPInterface_ZFUIView Class Referenceabstract

protocol for ZFUIView More...

#include <ZFProtocolZFUIView.h>

Inheritance diagram for ZFPInterface_ZFUIView:
ZFProtocol

Public Member Functions

virtual const zfcharprotocolName (void) const
 get the name of the protocol module, e.g. "ZFObject"
 
virtual zfbool nativeViewCacheOnSave (void *nativeView)
 called to save native view cache
 
virtual void nativeViewCacheOnRestore (ZFUIView *view, void *nativeView)
 see nativeViewCacheOnSave
 
virtual void * nativeViewCreate (ZFUIView *view)=0
 called when a ZFUIView created, to register native view to ZFUIView
 
virtual void nativeViewDestroy (void *nativeView)=0
 called when a ZFUIView destroyed, the internal nativeView could be accessed by ZFUIView.nativeView
 
virtual void nativeImplView (ZFUIView *view, void *nativeImplViewOld, void *nativeImplView, zfindex virtualIndex, zfbool nativeImplViewRequireVirtualIndex)=0
 attach a native view to this view, see ZFUINativeViewWrapper
 
virtual void nativeImplViewFrame (ZFUIView *view, const ZFUIRect &rect)=0
 see ZFUIView::nativeImplViewMarginUpdate
 
virtual zffloat UIScaleForImpl (void *nativeView)=0
 get proper scale for the view
 
virtual zffloat UIScaleForPixel (void *nativeView)=0
 get proper scale for physical pixel
 
virtual void visible (ZFUIView *view, zfbool visible)=0
 see ZFUIView
 
virtual void alpha (ZFUIView *view, zffloat alpha)=0
 see ZFUIView
 
virtual void viewUIEnable (ZFUIView *view, zfbool viewUIEnable)=0
 see ZFUIView
 
virtual void viewUIEnableTree (ZFUIView *view, zfbool viewUIEnableTree)=0
 see ZFUIView
 
virtual void mouseHoverEnable (ZFUIView *view, zfbool mouseHoverEnable)
 see ZFUIView
 
virtual void bgColor (ZFUIView *view, const ZFUIColor &bgColor)=0
 see ZFUIView
 
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 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 void childRemoveAllForDealloc (ZFUIView *parent)=0
 called to remove all children during parent dealloc for performance
 
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 layoutRequest (ZFUIView *view)=0
 called by ZFUIView to notify the implementation that the view needs layout
 
virtual void measureNativeView (ZFUISize &ret, void *nativeView, const ZFUISize &sizeHint)=0
 measure a native view, only called by ZFUINativeViewWrapper
 
void notifyLayoutView (ZFUIView *view, const ZFUIRect &rect)
 implementations must notify when need layout if view's parent isn't ZFUIView
 
void notifyUIEvent (ZFUIView *view, ZFUIEvent *uiEvent)
 implementation must notify when UI event occurred
 
- Public Member Functions inherited from ZFProtocol
virtual void protocolOnInit (void)
 called to init the protocol
 
virtual void protocolOnInitFinish (void)
 see protocolOnInit
 
virtual void protocolOnDeallocPrepare (void)
 see protocolOnInit
 
virtual void protocolOnDealloc (void)
 see protocolOnInit
 
virtual ZFProtocolInstanceState protocolInstanceState (void)
 protocol instance's state
 
virtual const zfcharprotocolImplName (void) const
 get the name of the protocol implementation, e.g. "ZFObject_default"
 
virtual ZFProtocolLevel protocolImplLevel (void) const
 get the level of the protocol implementation
 
virtual const zfcharprotocolImplPlatformHint (void) const
 get type hint of the implementation or empty string if not defined, e.g. "iOS:NSString" for iOS's string impl, use ZFPROTOCOL_IMPLEMENTATION_PLATFORM_HINT to register
 
virtual void objectInfoT (zfstring &ret) const
 see objectInfo
 
virtual zfstring objectInfo (void) const
 get a short info about this object
 

Protected Types

typedef ZFProtocol zfsuper
 class ref to super
 
typedef ZFPInterface_ZFUIView zfself
 class ref to self
 

Detailed Description

protocol for ZFUIView

Member Function Documentation

◆ protocolName()

virtual const zfchar * ZFPInterface_ZFUIView::protocolName ( void ) const
inlinevirtual

get the name of the protocol module, e.g. "ZFObject"

Reimplemented from ZFProtocol.

◆ nativeViewCacheOnSave()

virtual zfbool ZFPInterface_ZFUIView::nativeViewCacheOnSave ( void * nativeView)
inlinevirtual

called to save native view cache

reset your native view's state and return true if your impl support cache

here's a list of state you should take care to reset:

◆ nativeViewCreate()

virtual void * ZFPInterface_ZFUIView::nativeViewCreate ( ZFUIView * view)
pure virtual

called when a ZFUIView created, to register native view to ZFUIView

return a native view token, which is automatically saved to ZFUIView.nativeView

◆ nativeViewDestroy()

virtual void ZFPInterface_ZFUIView::nativeViewDestroy ( void * nativeView)
pure virtual

called when a ZFUIView destroyed, the internal nativeView could be accessed by ZFUIView.nativeView

it's ensured that view has been remove from parent before destroy

◆ nativeImplView()

virtual void ZFPInterface_ZFUIView::nativeImplView ( ZFUIView * view,
void * nativeImplViewOld,
void * nativeImplView,
zfindex virtualIndex,
zfbool nativeImplViewRequireVirtualIndex )
pure virtual

attach a native view to this view, see ZFUINativeViewWrapper

set null to remove the attached native view, and it's ensured set null before view destroy

nativeImplView has two use:

  • used to store native view for ZFUINativeViewWrapper
  • used to store native view for different view's implementation such as EditText

◆ nativeImplViewFrame()

virtual void ZFPInterface_ZFUIView::nativeImplViewFrame ( ZFUIView * view,
const ZFUIRect & rect )
pure virtual

see ZFUIView::nativeImplViewMarginUpdate

note, may be called even if nativeImplView is null

◆ child()

virtual void ZFPInterface_ZFUIView::child ( ZFUIView * parent,
ZFUIView * child,
zfindex virtualIndex,
ZFUIViewChildLayer childLayer,
zfindex childLayerIndex )
pure virtual

add view, no need to worry about layout param or internal views

you should not retain or release those views
virtualIndex shows the absolute index of the child, impl should not care about the actual meanning of this index, simply add to the specified index

◆ childRemove()

virtual void ZFPInterface_ZFUIView::childRemove ( ZFUIView * parent,
ZFUIView * child,
zfindex virtualIndex,
ZFUIViewChildLayer childLayer,
zfindex childLayerIndex )
pure virtual

remove view, no need to worry about layout param or ZFUIView's internal views

see child

◆ childRemoveAllForDealloc()

virtual void ZFPInterface_ZFUIView::childRemoveAllForDealloc ( ZFUIView * parent)
pure virtual

called to remove all children during parent dealloc for performance

see ZFUIView::implChildOnRemoveAllForDealloc
you must remove all children EXCEPT the nativeImplView

◆ layoutRequest()

virtual void ZFPInterface_ZFUIView::layoutRequest ( ZFUIView * view)
pure virtual

called by ZFUIView to notify the implementation that the view needs layout

implementations should ensure next layout step would layout the view by calling notifyLayoutView
you have no need worry about parent, parent's layoutRequest would be called by ZFUIView if necessary

◆ notifyLayoutView()

void ZFPInterface_ZFUIView::notifyLayoutView ( ZFUIView * view,
const ZFUIRect & rect )
inline

implementations must notify when need layout if view's parent isn't ZFUIView

typically, you should call this method only if the view's parent is not type of ZFUIView

◆ notifyUIEvent()

void ZFPInterface_ZFUIView::notifyUIEvent ( ZFUIView * view,
ZFUIEvent * uiEvent )
inline

implementation must notify when UI event occurred

here is a list of UI events you may want to take care:


The documentation for this class was generated from the following file: