-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGTKControl.h
206 lines (184 loc) · 4.55 KB
/
GTKControl.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
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
#ifndef __GTKCONTROL_H
#define __GTKCONTROL_H
#include "BasicMessages.h"
#include "EventHandler.h"
#include "AnsiList.h"
#include "TreeColumn.h"
#define MAX_COLUMNS 0xFFF
enum MyPackOptions {
MyPACK_SHRINK,
MyPACK_EXPAND_PADDING,
MyPACK_EXPAND_WIDGET
};
class NotebookTab {
public:
void *object;
void *image;
void *button;
bool close_button;
long button_id;
AnsiString title;
void *header;
bool visible;
NotebookTab() {
object = NULL;
image = NULL;
button = NULL;
header = NULL;
close_button = false;
visible = false;
button_id = -1;
}
};
class TreeData {
public:
int currentindex;
QStringList columns;
QStringList attributes;
QList<TreeColumn *> meta;
short icon;
short text;
short markup;
short hint;
short hidden;
int extra;
char orientation;
TreeData() {
currentindex = 0;
icon = -1;
text = -1;
markup = -1;
hint = -1;
extra = -1;
hidden = -1;
orientation = 1;
}
void RemoveColumn(int index) {
int size = meta.size();
for (int i = 0; i < size; i++) {
TreeColumn *td = meta[i];
if ((td) && (td->index == index)) {
meta.removeAt(i);
delete td;
size--;
}
}
meta.clear();
}
TreeColumn *GetColumn(int index) {
int size = meta.size();
for (int i = 0; i < size; i++) {
TreeColumn *td = meta[i];
if ((td) && (td->index == index))
return td;
}
return NULL;
}
void ClearColumns() {
currentindex = 0;
icon = -1;
text = -1;
markup = -1;
hint = -1;
extra = -1;
int size = meta.size();
for (int i = 0; i < size; i++)
delete meta[i];
meta.clear();
}
~TreeData() {
ClearColumns();
}
};
class GTKControl {
public:
int type;
long ID;
long ID_Adjustment;
long ID_HAdjustment;
void *ptr;
void *ptr2;
void *ptr3;
void *parent;
void *events;
int *extraptr;
void *ref;
int index;
unsigned short flags;
signed char visible;
signed char use_stock;
signed char packtype;
AnsiList *pages;
signed char minset = 0;
GTKControl() {
ID = 0;
ID_Adjustment = -1;
ID_HAdjustment = -1;
type = 0;
flags = 0;
use_stock = 0;
extraptr = 0;
events = 0;
visible = -1;
ref = 0;
index = -1;
pages = 0;
ptr = 0;
ptr2 = 0;
ptr3 = 0;
packtype = -1;
minset = 0;
}
int AdjustIndex(NotebookTab *NT) {
int index = 0;
int i = 0;
while (true) {
NotebookTab *item = (NotebookTab *)pages->Item(i++);
if ((!item) || (item == NT))
break;
if (item->visible)
index++;
}
return index;
}
int AdjustIndexReversed(int index) {
int i = 0;
while (true) {
NotebookTab *item = (NotebookTab *)pages->Item(i);
if (!item)
break;
if (item->visible) {
if (!index)
return i;
index--;
}
i++;
}
return -1;
}
void Clear() {
if (extraptr) {
delete[] extraptr;
extraptr = NULL;
}
if (events) {
delete (ClientEventHandler *)events;
events = NULL;
}
if (pages) {
int i = 0;
while (true) {
NotebookTab *item = (NotebookTab *)pages->Item(i++);
if (!item)
break;
delete item;
}
delete pages;
pages = NULL;
}
}
~GTKControl() {
Clear();
}
};
#endif //__GTKCONTROL_H