-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWindow.h
99 lines (78 loc) · 2.66 KB
/
Window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef __WINDOW_H__
#define __WINDOW_H__
#include "FairyGUIMacros.h"
#include "cocos2d.h"
#include "GComponent.h"
NS_FGUI_BEGIN
class IUISource : public cocos2d::Ref
{
public:
virtual const std::string& getFileName() = 0;
virtual void setFileName(const std::string& value) = 0;
virtual bool isLoaded() = 0;
virtual void load(std::function<void()> callback) = 0;
};
class Window : public GComponent
{
public:
Window();
virtual ~Window();
CREATE_FUNC(Window);
void show();
void hide();
void hideImmediately();
void toggleStatus();
void bringToFront();
bool isShowing() const { return _parent != nullptr; }
bool isTop() const;
bool isModal() const { return _modal; }
void setModal(bool value) { _modal = value; }
void showModalWait() { showModalWait(0); }
void showModalWait(int requestingCmd);
bool closeModalWait() { return closeModalWait(0); }
bool closeModalWait(int requestingCmd);
void initWindow();
void addUISource(IUISource* uiSource);
bool isBringToFrontOnClick() { return _bringToFontOnClick; }
void setBringToFrontOnClick(bool value) { _bringToFontOnClick = value; }
GComponent* getContentPane() const { return _contentPane; }
void setContentPane(GComponent* value);
GComponent* getFrame() const { return _frame; }
GObject* getCloseButton() const { return _closeButton; }
void setCloseButton(GObject* value);
GObject* getDragArea() const { return _dragArea; }
void setDragArea(GObject* value);
GObject* getContentArea() const { return _contentArea; }
void setContentArea(GObject* value) { _contentArea = value; }
GObject* getModalWaitingPane() const { return _modalWaitPane; }
protected:
virtual void handleInit() override;
virtual void onInit(); // lua can't override, send a event callback
virtual void onShown(); // lua can't override, send a event callback
virtual void onHide(); // lua can't override, send a event callback
virtual void doShowAnimation();
virtual void doHideAnimation();
virtual void onEnter() override;
virtual void onExit() override;
void closeEventHandler(EventContext*context);
GComponent* _contentPane;
private:
void layoutModalWaitPane();
void onUILoadComplete();
void _initWindow();
void onTouchBegin(EventContext* context);
void onDragStart(EventContext* context);
int _requestingCmd;
GComponent* _frame;
GObject* _modalWaitPane;
GObject* _closeButton;
GObject* _dragArea;
GObject* _contentArea;
bool _modal;
bool _bringToFontOnClick;
cocos2d::Vector<IUISource*> _uiSources;
bool _inited;
bool _loading;
};
NS_FGUI_END
#endif