ZFFramework
 
Loading...
Searching...
No Matches
ZFUIWebJSBridge.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUIWebJSBridge_h_
7#define _ZFI_ZFUIWebJSBridge_h_
8
9#include "ZFUIWebView.h"
11
12// ============================================================
13zfclassFwd _ZFP_ZFUIWebJSBridgePrivate;
17zfclass ZFLIB_ZFUIWebKit ZFUIWebJSBridge : zfextend ZFObject {
18 ZFOBJECT_DECLARE(ZFUIWebJSBridge, ZFObject)
19
20public:
21 // ============================================================
22 // event
29 ZFEVENT(OnSend)
36 ZFEVENT(OnRecv)
37
38public:
47 )
48
49public:
54
55public:
62 , ZFMP_IN_OUT(ZFJson &, data)
63 )
64 zffinal void _ZFP_ZFUIWebJSBridge_notifyWebMessageRecv(ZF_IN_OUT ZFJson &data) {
65 this->onRecv(data);
66 }
67
68 ZFOBJECT_PRIVATE_ALLOC("can only be created by ZFUIWebJSBridge::instanceForWebView")
69protected:
71 virtual void objectOnInit(void);
73 virtual void objectOnDealloc(void);
74
75protected:
77 virtual inline void onSend(ZF_IN_OUT ZFJson &data) {
79 }
80
81 virtual inline void onRecv(ZF_IN_OUT ZFJson &data) {
83 }
84
85private:
86 _ZFP_ZFUIWebJSBridgePrivate *d;
87};
88
90#endif // #ifndef _ZFI_ZFUIWebJSBridge_h_
91
#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_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:196
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
#define ZFMP_IN_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:117
#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_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:870
#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 ZFOBJECT_PRIVATE_ALLOC(...)
mark this object can not be allocated directly
Definition ZFObjectDeclare.h:245
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:328
#define ZFLIB_ZFUIWebKit
used to export symbols
Definition ZFUIWebKitDef.h:17
JSON item.
Definition ZFJson.h:167
void observerNotify(zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull)
notify the observer with eventId
virtual ZFUIWebView * webView()
owner of this JS bridge
static zfidentity E_OnRecv(void)
see ZFObject::observerNotify
virtual void objectOnDealloc(void)
override this to destroy your object
virtual void objectOnInit(void)
override this to init your object
virtual void send(ZFJson &data)
send message to web
static zfidentity E_OnSend(void)
see ZFObject::observerNotify
virtual void onSend(ZFJson &data)
see E_OnSend
Definition ZFUIWebJSBridge.h:77
static ZFUIWebJSBridge * instanceForWebView(ZFUIWebView *webView)
access the bridge via the webView
virtual void onRecv(ZFJson &data)
see E_OnRecv
Definition ZFUIWebJSBridge.h:81
web view
Definition ZFUIWebView.h:17
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157