ZFFramework
 
Loading...
Searching...
No Matches
ZFUISysWindow.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUISysWindow_h_
7#define _ZFI_ZFUISysWindow_h_
8
9#include "ZFUIRootView.h"
11
20ZFEVENT_GLOBAL(ZFLIB_ZFUIKit, SysWindowMainWindowOnAttach)
22
23// ============================================================
25zfclassFwd _ZFP_ZFUISysWindowPrivate;
34zffinal zfclass ZFLIB_ZFUIKit ZFUISysWindow : zfextend ZFObject {
35 ZFOBJECT_DECLARE(ZFUISysWindow, ZFObject)
36
37 // ============================================================
38 // observer events
39public:
46 ZFEVENT(SysWindowOnCreate)
52 ZFEVENT(SysWindowOnDestroy)
58 ZFEVENT(SysWindowOnResume)
64 ZFEVENT(SysWindowOnPause)
71 ZFEVENT(SysWindowOnRotate)
78 ZFEVENT(SysWindowMarginOnUpdate)
79
87 ZFEVENT(SysWindowOnKeyEvent)
88
89public:
107 static zfautoT<ZFUISysWindow> nativeWindowEmbed(ZF_IN ZFUISysWindowEmbedImpl *embedImpl);
108
113
121
130 , ZFMP_IN(void *, nativeParent)
132
147 , ZFMP_IN(void *, nativeParent)
148 , ZFMP_IN(const zfstring &, sysWindowName)
154 , ZFMP_IN(const zfstring &, sysWindowName)
156
157public:
170 , ZFMP_IN(ZFUISysWindow *, window)
187
192 , ZFMP_IN(ZFUISysWindow *, window)
198
199public:
209
210public:
220 void _ZFP_ZFUISysWindow_sysWindowMargin(ZF_IN const ZFUIMargin &sysWindowMargin);
221protected:
225 virtual void sysWindowMarginOnUpdate(ZF_IN const ZFUIMargin &sysWindowMarginOld);
226
227 ZFOBJECT_PRIVATE_ALLOC("can only be created by ZFUISysWindow::modalWindowShow")
228protected:
230 virtual void objectOnInit(void);
232 virtual void objectOnInitFinish(void);
234 virtual void objectOnDeallocPrepare(void);
236 virtual void objectOnDealloc(void);
237
238public:
247
248public:
274
275public:
290
296
297public:
320
321public:
326
334
335public:
336 zffinal ZFUIRect _ZFP_ZFUISysWindow_measureWindow(ZF_IN const ZFUIRect &rootRefRect);
337 zffinal void _ZFP_ZFUISysWindow_onCreate(ZF_IN void *nativeWindow);
338 zffinal void _ZFP_ZFUISysWindow_onDestroy(void);
339 zffinal void _ZFP_ZFUISysWindow_onResume(void);
340 zffinal void _ZFP_ZFUISysWindow_onPause(void);
341 zffinal void _ZFP_ZFUISysWindow_onRotate(void);
342 zffinal void _ZFP_ZFUISysWindow_sysWindowLayoutUpdate(void);
343 zffinal void _ZFP_ZFUISysWindow_keyEvent(ZF_IN ZFUIKeyEvent *event) {
345 }
346
347private:
348 _ZFP_ZFUISysWindowPrivate *d;
349};
350
351// ============================================================
355zfinterface ZFLIB_ZFUIKit ZFUISysWindowEmbedImpl : zfextend ZFInterface {
356 ZFINTERFACE_DECLARE_WITH_CUSTOM_CTOR(ZFUISysWindowEmbedImpl, ZFInterface)
357
358public:
359 zfanyT<ZFUISysWindow> _ZFP_ownerZFUISysWindow;
364 return this->_ZFP_ownerZFUISysWindow;
365 }
366
367public:
369 ZFUISysWindowEmbedImpl(void) : _ZFP_ownerZFUISysWindow(zfnull) {}
371
372 // ============================================================
373public:
377 virtual void nativeWindowOnCleanup(ZF_IN ZFUISysWindow *sysWindow) {
378 }
379
387 ZF_IN ZFUISysWindow *sysWindow
388 , ZF_OUT_OPT void *&nativeParentView
394
402 virtual void modalWindowFinish(
403 ZF_IN ZFUISysWindow *sysWindowOwner
404 , ZF_IN ZFUISysWindow *sysWindowToFinish
406
412 }
413
417 }
418
425
430 ZF_IN ZFUISysWindow *sysWindow
431 , ZF_IN const ZFUIOrientationFlags &flags
432 ) {
433 }
434
435 // ============================================================
436 // callbacks that implementations must notify
437public:
446 ZF_IN ZFUISysWindow *sysWindow
447 , ZF_IN const ZFUIRect &rootRefRect
448 , ZF_IN const ZFUIMargin &sysWindowMargin
449 ) {
450 sysWindow->_ZFP_ZFUISysWindow_sysWindowMargin(sysWindowMargin);
451 return sysWindow->_ZFP_ZFUISysWindow_measureWindow(rootRefRect);
452 }
453
457 ZF_IN ZFUISysWindow *sysWindow
458 , ZF_IN void *nativeWindow
459 ) {
460 sysWindow->_ZFP_ZFUISysWindow_onCreate(nativeWindow);
461 }
462
466 sysWindow->_ZFP_ZFUISysWindow_onDestroy();
467 }
468
473 sysWindow->_ZFP_ZFUISysWindow_onResume();
474 }
475
480 sysWindow->_ZFP_ZFUISysWindow_onPause();
481 }
482
486 sysWindow->_ZFP_ZFUISysWindow_onRotate();
487 }
488
492 ZF_IN ZFUISysWindow *sysWindow
493 , ZF_IN ZFUIKeyEvent *event
494 ) {
495 sysWindow->_ZFP_ZFUISysWindow_keyEvent(event);
496 }
497};
498
500#endif // #ifndef _ZFI_ZFUISysWindow_h_
501
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:192
#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 zfpurevirtual
dummy macro shows that a method is pure virtual method
Definition ZFCoreTypeDef_ClassType.h:68
#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:180
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
#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(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_STATIC_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1042
#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_END(NameSpace)
end namespace
Definition ZFNamespace.h:60
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define ZF_NAMESPACE_BEGIN(NameSpace)
begin namespace
Definition ZFNamespace.h:40
#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 ZFINTERFACE_DECLARE_WITH_CUSTOM_CTOR(InterfaceName, ParentInterface,...)
see ZFINTERFACE_DECLARE
Definition ZFObjectInterface.h:94
#define zfinterface
shows the type is an interface, see ZFInterface
Definition ZFObjectInterface.h:20
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:328
#define ZFEVENT_GLOBAL(ZFLIB_, YourEvent)
declare a observer event in global scope, see ZFEVENT
Definition ZFObjectObserver.h:369
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#define ZFPROPERTY_ON_ATTACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:248
#define ZFLIB_ZFUIKit
used to export symbols
Definition ZFUIKitDef.h:16
root view for holding a ZFUIView's tree
v_ZFUIOrientation::ZFEnumType ZFUIOrientation
see v_ZFUIOrientation
Definition ZFUITypeDef.h:1145
void observerNotify(zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull)
notify the observer with eventId
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
see v_ZFUIOrientation, ZFUIOrientationFlagsToString, ZFUIOrientationFlagsFromString
Definition ZFUITypeDef.h:1145
2D rectangle
Definition ZFUITypeDef.h:636
root view for holding a ZFUIView's tree
Definition ZFUIRootView.h:20
2D size
Definition ZFUITypeDef.h:397
impl for ZFUISysWindow::nativeWindowEmbed
Definition ZFUISysWindow.h:355
ZFUIRect notifyMeasureWindow(ZFUISysWindow *sysWindow, const ZFUIRect &rootRefRect, const ZFUIMargin &sysWindowMargin)
implementation must call this method to measure window's frame, and layout window using the result fr...
Definition ZFUISysWindow.h:445
void notifyOnRotate(ZFUISysWindow *sysWindow)
implementation must call this to notify when window rotate
Definition ZFUISysWindow.h:485
virtual void modalWindowFinish(ZFUISysWindow *sysWindowOwner, ZFUISysWindow *sysWindowToFinish)=0
see ZFUISysWindow::modalWindowFinish
void notifyOnDestroy(ZFUISysWindow *sysWindow)
implementation must call this to notify before window destroy
Definition ZFUISysWindow.h:465
void notifyOnResume(ZFUISysWindow *sysWindow)
implementation must call this to notify after window resume, note that rotate a window should not not...
Definition ZFUISysWindow.h:472
virtual void sysWindowOrientationFlags(ZFUISysWindow *sysWindow, const ZFUIOrientationFlags &flags)
see ZFUISysWindow::sysWindowOrientationFlags, impl should have v_ZFUIOrientation::e_Top as init value
Definition ZFUISysWindow.h:429
virtual zfautoT< ZFUISysWindow > modalWindowShow(ZFUISysWindow *sysWindowOwner)=0
see ZFUISysWindow::modalWindowShow
void notifyKeyEvent(ZFUISysWindow *sysWindow, ZFUIKeyEvent *event)
implementation must call this to notify key event
Definition ZFUISysWindow.h:491
zfanyT< ZFUISysWindow > const & ownerZFUISysWindow(void)
the attached ZFUISysWindow
Definition ZFUISysWindow.h:363
virtual void nativeWindowRootViewOnRemove(ZFUISysWindow *sysWindow)=0
called to remove root view to native window container
virtual void sysWindowLayoutParamOnUpdate(ZFUISysWindow *sysWindow)
called when window layout param changed
Definition ZFUISysWindow.h:416
virtual void nativeWindowOnCleanup(ZFUISysWindow *sysWindow)
called when owner ZFUISysWindow is about to destroy
Definition ZFUISysWindow.h:377
virtual void sysWindowLayoutParamOnInit(ZFUISysWindow *sysWindow)
called to update suggested window layout param, fill with no margin by default
Definition ZFUISysWindow.h:411
virtual ZFUIOrientation sysWindowOrientation(ZFUISysWindow *sysWindow)
see ZFUISysWindow::sysWindowOrientation
Definition ZFUISysWindow.h:422
void notifyOnCreate(ZFUISysWindow *sysWindow, void *nativeWindow)
implementation must call this to notify after window create
Definition ZFUISysWindow.h:456
void notifyOnPause(ZFUISysWindow *sysWindow)
implementation must call this to notify before window pause, note that rotate a window should not not...
Definition ZFUISysWindow.h:479
virtual void nativeWindowRootViewOnAdd(ZFUISysWindow *sysWindow, void *&nativeParentView)=0
called to add root view to native window container
root native window
Definition ZFUISysWindow.h:34
static zfidentity E_SysWindowOnKeyEvent(void)
see ZFObject::observerNotify
virtual zfanyT< ZFUISysWindow > modalWindowShowing()
get self's current showing modal window
virtual zfanyT< ZFUISysWindow > modalWindowOwner()
get self's owner if self is a showing modal window
virtual void sysWindowOrientationFlags(const ZFUIOrientationFlags &sysWindowOrientationFlags)
set supported orientation, orientation may or may not change immediately
virtual zfbool & preferFullscreen()
whether prefer fullscreen
Definition ZFUISysWindow.h:294
static void keyWindow(ZFUISysWindow *window)
default window that ZFUIWindow would attach to, set null to use mainWindow
virtual zfautoT< ZFUISysWindow > modalWindowShow()
show a new modal window, may or may not show immediately, may have different behavior on different im...
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
virtual const ZFUIMargin & sysWindowMargin()
native window margin according to impl
virtual void objectOnInit(void)
override this to init your object
virtual zfanyT< ZFUILayoutParam > sysWindowLayoutParam()
get window's layout param, fill parent by default
static zfanyT< ZFUISysWindow > mainWindow()
get application's main window
virtual zfbool nativeWindowIsResumed()
true if sys window resumed
virtual ZFUIOrientation sysWindowOrientation()
get current orientation
virtual ZFUISysWindowEmbedImpl * nativeWindowEmbedImpl(void)
see nativeWindowEmbed
virtual void modalWindowFinish()
finish and destroy self as a modal window
virtual void * nativeWindow()
access the internal native window
static void nativeWindowEmbedNativeViewCleanup(const zfstring &sysWindowName)
remove window attached by nativeWindowEmbedNativeView
static zfautoT< ZFUISysWindow > nativeWindowEmbedNativeView(void *nativeParent)
default impl to attach window to native view
virtual const ZFUISize & sysWindowSize()
native window's size
static zfautoT< ZFUISysWindow > nativeWindowEmbed(ZFUISysWindowEmbedImpl *embedImpl)
used to embed ZFUISysWindow to existing UI framework
static zfbool mainWindowAttached()
whether mainWindow has attached
static void mainWindowRegister(ZFUISysWindow *window)
manually register main window, must be called before accessing mainWindow
virtual void sysWindowMarginOnUpdate(const ZFUIMargin &sysWindowMarginOld)
see E_SysWindowMarginOnUpdate
virtual void nativeWindowEmbedImplDestroy()
util to destroy the window created by nativeWindowEmbed
virtual zfbool nativeWindowIsCreated()
true if sys window created
virtual void objectOnInitFinish(void)
called after objectOnInit, safe to call virtual functions here
virtual zfanyT< ZFUIRootView > rootView()
access the root view of the window
virtual void objectOnDealloc(void)
override this to destroy your object
@ e_Top
Top(1 << 1)
Definition ZFUITypeDef.h:1137
see zfany
Definition zfany.h:106
type restrict version of zfauto
Definition zfautoFwd.h:110
Definition ZFApp.h:13