-
Notifications
You must be signed in to change notification settings - Fork 1
/
GCP_Form.h
100 lines (92 loc) · 4.09 KB
/
GCP_Form.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
100
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////GCP_Form
/////////////////////////////////////Êëàññ ôîðìû èíòåðôåéñà
////////////////////////////////////////////////////////////////////////////////////////////
///////
///////_subForms
// ñïèñîê âñåõ ôîðì, ïðèêðåïëåííûõ ê ýòîé ôîðìå
// Ïðè îòðèñîâêå ñíà÷àëà ðèñóþòñÿ âñå êîìïîíåíòû, çàòåì ïðèêðåïëåííûå ôîðìû
// Ïðè îáðàáîòêå ñîáûòèé ñíà÷àëà îáðàáàòûâàþòñÿ âñå ôîðìû, çàòåì êîìïîíåíòû
// (åñëè ôîðìû íå çàáëîêèðóþò îáðàáîòêó)
///////_components
// Ñïèñîê âñåõ êîìïîíåíò êîòîðûì ïåðåäàþòñÿ ãëîáàëüíûå ñîáûòèÿ
// è äëÿ êîòîðûõ âû÷èñëÿþòñÿ ñîáûòèÿ ëîêàëüíûå. (êëèê ïî êîìïîíåíòó)
///////_contextmenus
// Ñïèñîê êíîïîê êîòîðûå îòîáðàæàþòñ êîíòåêñòíûå ìåíþ (ìåíþ ïðàâîé êíîïêè)
// Êîãäà ôîðìà ðèñóåò êîíòåêñòíîå ìåíþ. ñîáûòèÿ îñòàëüíûõ êîìïîíåíò íå îáðàáàòûâàþòñÿ
////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
#ifndef GCP_FormH
#define GCP_FormH
#include "GCP_ContextMenu.h"
#include "GCP_Edit.h"
#include "GCP_Label.h"
#include "GCP_Graph.h"
#include "GCP_CheckBox.h"
#include "GCP_Select.h"
namespace gcp
{
class GCP_Form;
typedef GCP_SPointer<GCP_Form> gcp_spForm;
class GCP_Form : public GCP_FormComponent
{
protected:
typedef std::pair<string, GCP_UID> childNameMap;
GCP_Vector<childNameMap> _childNames; //need map here!
GCP_Vector<gcp_spForm> _subForms;
GCP_Vector<gcp_spFormComponent> _components;
GCP_Vector<gcp_spContextMenu> _contextmenus;
GCP_SPointer<GCP_FormComponent> _componentThatWasLeftClicked;
int _swidth, _sheight;
bool _isLocked, _isClickedOnTopHeader, _isContextMenuOpened, _isComponentClicked;
GCP_SPointer<GCP_Button> xbutton, xpanel;
GCP_SPointer<GCP_Form> messagebox;
GCP_SPointer<GCP_Label> messagelabel;
GCP_SPointer<GCP_ContextMenu> formTopRightButtons;
SDL_Renderer* sdlRenderer;
GCP_Vector<string> _messages;
GCP_Vector<string> _messages_caption;
gcp_spForm _pBlockingForm;
void onParentFormStartBlocking();
void onParentFormEndBlocking();
void addToNameMap(const gcp_spFormComponent& component, const string& name);
void removeFromNameMap(const gcp_spFormComponent& component);
public:
bool isParentLocking;
bool isShowTopRightButtons;
bool isDraggingSomeComponent;
bool isTransparent;
bool isLocalEventsLocked;
short int iPosition;
int mouse_x, mouse_y;
bool isLocked;
GCP_Form(){/*ÍÓÆÅÍ ÄËß ÌÅÑÑÀÄÆ ÁÎÊÑ*/ };
GCP_Form(int _width, int _height);
void setBufferSize(int screenw, int screenh);
void setFont(string dir);
~GCP_Form();
const GCP_FormComponent* getComponent(const string& name) const;
void addComponent(const GCP_SPointer<GCP_ContextMenu> &component, string name = "default");
void addComponent(const GCP_SPointer<GCP_FormComponent> &component, string name = "default");
void removeComponent(const GCP_SPointer<GCP_FormComponent> &component);
void removeComponent(string const& name);
void setPosition(const GCP_Rect<int>& position);
void setPosition(int x, int y, int width, int height);
void setPosition(int x, int y);
void toogleTopRightButtons(bool enabled);
void toggleVisibility(void* obj);
void addSubForm(const GCP_SPointer<GCP_Form> &form, string name = "default");
void showmessage(const string &text, const string &caption, bool block = false);
void showmessage(int text, const string &captionbool, bool block = false);
void OnDraw(const GCP_Event &event);
void setCaption(const std::string& str);
gcp_formEvent OnEvent(const GCP_Event &event);
//bool OnTextInput(const GCP_Event& event);
//bool OnTextEdit(const GCP_Event& event);
gcp_formEvent OnMouseGlobalLeftHoldMotion(const GCP_Event &event);
};
}
#endif