-
Notifications
You must be signed in to change notification settings - Fork 4
/
agui.hpp
233 lines (186 loc) · 5.31 KB
/
agui.hpp
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#pragma once
#include <vector>
#include <iostream>
#include <assert.h>
#include <algorithm>
#include <Windows.h>
//#include <d3dx9.h>
#include "adrawing.hpp"
namespace agui {
enum controlType {
WINDOW,
TITLE,
RIBBON,
TAB,
FRAME,
BUTTON,
SLIDER,
CHECKBOX,
HOTKEY,
LABEL,
CONSOLELABEL,
TEXTBOX,
COMBOBOX
};
struct guiFunc;
struct window;
struct titlebar;
struct ribbon;
struct tab;
struct frame;
struct guiObj {
window* win;
guiObj* up;
controlType cType;
int xPos;
int yPos;
int width;
int height;
char* caption;
int id;
//bool mouseOver;
bool bigFont;
MY_D3DRECT rect;
MY_D3DRECT mRect;
guiObj(window* winPtr, guiObj* upPtr, controlType ct, char* srcCaption, int x, int y, int w, int h);
void styleUpdate(bool _bigFont = false);
virtual void drawBackground();
virtual void drawBorder();
virtual void drawStr();
virtual void drawExtra();
virtual void draw();
virtual void updateRectPosition() = 0;
virtual void functionUpdate();
};
struct guiFunc {
window* activeWindow;
titlebar* activeTitlebar;
ribbon* activeRibbon;
tab* activeTab;
frame* activeFrame;
int gObjCounter;
bool setStartTab;
guiFunc();
~guiFunc();
void init();
void drawAll();
int getTabCount(guiObj* desTab, int& pos);
void updateInFramePos(guiObj* o);
};
inline guiFunc* gFunc = nullptr;
void setGuiFunc(guiFunc* newGuiFunc);
struct window : public guiObj {
std::vector<guiObj*> pGuiObj;
bool* active;
int* myKey;
window(char* Caption, bool* show, int* key, int xPos = 100, int yPos = 100, int width = 480, int height = 270);
void updateRectPosition() override;
void functionUpdate() override;
};
struct titlebar : public guiObj {
bool onMoving;
POINT mousePos;
MY_D3DRECT oldWinPos;
titlebar(char* Caption, window* wPtr = gFunc->activeWindow, int height = 25);
void updateRectPosition() override;
void drawBackground() override;
void moveWindow();
};
struct ribbon : public guiObj {
std::vector<guiObj*> ribbonObj;
ribbon(char* Caption, window* wPtr = gFunc->activeWindow, int xPos = 0, int yPos = 10, int width = 480, int height = 40);
void updateRectPosition() override;
};
struct tab : public guiObj {
bool active = true;
tab(char* Caption, window* wPtr = gFunc->activeWindow, ribbon* rPtr = gFunc->activeRibbon);
void updateRectPosition() override;
void drawBackground() override;
void drawBorder() override;
void functionUpdate() override;
};
struct frame : public guiObj {
std::vector<guiObj*> frameObj;
frame(char* Caption, window* wPtr = gFunc->activeWindow, tab* tPtr = gFunc->activeTab);
void updateRectPosition() override;
void drawStr() override;
};
struct button : public guiObj {
bool* btnActive;
unsigned long lastTick;
button(char* Caption, bool* btn, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawExtra() override;
void drawButton(const MY_D3DRECT& rect);
void drawStr() override;
void functionUpdate() override;
};
struct slider : public guiObj {
int* actual;
int maximal;
bool onMoving;
POINT oldMousePos;
POINT newMousePos;
slider(char* Caption, int* is, int max, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawExtra() override;
void drawSlider(const MY_D3DRECT& sldRect);
void drawStr() override;
void functionUpdate() override;
};
struct checkbox : public guiObj {
bool* active;
checkbox(char* Caption, bool* isActive, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawExtra() override;
void drawCheckbox(const MY_D3DRECT& rect);
void drawStr() override;
void functionUpdate() override;
};
struct hotkey : public guiObj {
int* myKey;
int onSearch;
unsigned long lastTick;
hotkey(char* Caption, int* key, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawExtra() override;
void drawHotkey(const MY_D3DRECT& hkyRect);
void drawStr() override;
void functionUpdate() override;
};
struct label : public guiObj {
label(char* Caption, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawStr() override;
};
struct consoleLabel : public guiObj {
char** ptrPtrStr;
consoleLabel(char* Caption, char** ppStr, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawStr() override;
};
struct textbox : public guiObj {
bool onInput;
int charCounter;
int lastKey;
int newKey;
unsigned long lastTick;
textbox(char* Caption, window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawExtra() override;
void drawStr() override;
void functionUpdate() override;
};
struct combobox : public guiObj {
int maximal;
char** str;
int* actual;
bool isOpen;
combobox(char* Caption, int* selected, int argc, char* argv[], window* wPtr = gFunc->activeWindow, frame* fPtr = gFunc->activeFrame);
void updateRectPosition() override;
void drawExtra() override;
void drawMenu();
void drawStr() override;
void functionUpdate() override;
};
}