-
Notifications
You must be signed in to change notification settings - Fork 0
/
Afc.h
585 lines (427 loc) · 11.4 KB
/
Afc.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
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#ifndef AFC_H
#define AFC_H
//AFC Version
#define AFC_VERSION 3.11
#define AFC_TYPE 3
//EditBox Notification
#define EN_ENTER WM_APP + 1
//Button States
#define BS_NORMAL 0x0001
#define BS_PUSHED 0x0002
//Button Styles
#define BS_CLICK 0x0010
#define BS_PUSH 0x0020
#define BS_CHECK 0x0040
#define BS_TAB 0x0080
#define BS_TRANSPARENT 0x0100
#define BS_INVISIBLE 0x0200
#define BS_IMAGE16 0x0400
#define BS_IMAGE24 0x0800
//Dropdown Menu Styles
#define DMS_DOWNWARD 0x0001
#define DMS_UPWARD 0x0002
#define DMS_IMAGE16 0x0004
#define DMS_IMAGE24 0x0008
//Button Messages // 90 .. 139
#define BM_RELEASE WM_APP + 90
#define BM_PUSH WM_APP + 91
#define BM_HIGHLIGHT WM_APP + 92
#define BM_UNHIGHLIGHT WM_APP + 93
#define BM_IS_PUSHED WM_APP + 94
#define BM_ADD_SUBBUTTON WM_APP + 95
#define BM_REMOVE_SUBBUTTON WM_APP + 96
#define BM_SELECT_SUBBUTTON WM_APP + 97
#define BM_ADD_SUBIMAGE WM_APP + 98
#define BM_REMOVE_SUBIMAGE WM_APP + 99
#define BM_SELECT_SUBIMAGE WM_APP + 100
#define BM_SET_PUSHED_IMAGE WM_APP + 101
#define BM_SET_DISABLED_IMAGE WM_APP + 102
#define BM_SET_TOOLTIP WM_APP + 103
#define BM_SET_DROPDOWN_STYLE WM_APP + 105
#define BM_ENABLE WM_APP + 106
#define BM_DISABLE WM_APP + 107
//ToolTip Messages
#define TTM_SHOW WM_APP + 110
#define TTM_HIDE WM_APP + 111
//Button Notification
#define BN_RELEASED WM_APP + 120
#define BN_HIGHLIGHTED WM_APP + 121
//ScrollBar Messages // 140 .. 159
#define ASBM_SETHANDLE_SIZE WM_APP + 140
#define ASBM_GETHANDLE_SIZE WM_APP + 141
#define ASBM_SETHANDLE_POS WM_APP + 142
#define ASBM_GETHANDLE_POS WM_APP + 143
#define ASBM_SET_RANGE WM_APP + 144
#define ASBM_GET_RANGE WM_APP + 145
//ScrollBar Notification
#define ASBN_SCROLLING WM_APP + 20
//ScrollBar Variables
#define ScrlBarRange 0
#define ScrlBarHandleSize 4
#define ScrlBarHandlePos 8
#define ScrlBarHMOffset 12
//DialogBar Messages // 160 .. 189
#define DBM_DRAG_START WM_APP + 160
//ControlGroup Messages
#define ACGM_OPEN WM_APP + 170
#define ACGM_CLOSE WM_APP + 171
#define ACGM_SETCTRL_STATE WM_APP + 172
#define ACGM_GETCTRL_STATE WM_APP + 173
#define ACGM_GET_DLG WM_APP + 174
#define ACGM_SET_STATE WM_APP + 175
#define ACGM_GET_STATE WM_APP + 176
//ControlGroup Notification
#define ACGN_OPENED WM_APP + 180
#define ACGN_CLOSED WM_APP + 181
//ControlGroup States
#define ACGS_NORMAL 1
#define ACGS_CLOSED 2
//ControlGroup Variables
#define CtrlGroupPosition 0
#define CtrlGroupState 4
#define CtrlGroupHeightOpen 8
#define CtrlGroupHeightClosed 12
#define CtrlGroupWidth 16
#define CtrlGroupDialog 20
#define CtrlGroupMargin 24
#define CtrlGroupParent 28
//TrackBar Messages // 190 .. 239
#define ATBM_SETHANDLE_SIZE WM_APP + 190
#define ATBM_GETHANDLE_SIZE WM_APP + 191
#define ATBM_SETHANDLE_POS WM_APP + 192
#define ATBM_GETHANDLE_POS WM_APP + 193
#define ATBM_GET_HANDLE WM_APP + 194
#define ATBM_SET_RANGE WM_APP + 195
#define ATBM_GET_RANGE WM_APP + 196
//TrackBar Notification
#define ATBN_SCROLLING WM_APP + 200
//TrackBar Variables
#define TrackBarRangeStart 0
#define TrackBarRangeEnd 4
#define TrackBarHandleSize 8
#define TrackBarHandlePos 12
#define TrackBarHMOffset 16
//Spinner Variables
#define AS_STATE_NORMAL 1
#define AS_STATE_UP 2
#define AS_STATE_DOWN 3
#define AS_STATE_BOTH 4
//Spinner Messages // 240 .. 259
#define ASM_UPDATE WM_APP + 240
#define ASM_SET_VAL_INT WM_APP + 241
#define ASM_GET_VAL_INT WM_APP + 242
#define ASM_SET_VAL_FLOAT WM_APP + 243
#define ASM_GET_VAL_FLOAT WM_APP + 244
//ToolBar Styles
#define TBS_HSCROLL 0x0001
#define TBS_VSCROLL 0x0002
#define TBS_STATIC_EDGE 0x0004
#define TBS_MARGIN_TOP 0x0010
#define TBS_MARGIN_BOTTOM 0x0020
#define TBS_MARGIN_LEFT 0x0040
#define TBS_MARGIN_RIGHT 0x0080
#define TBS_ALIGN_TOP 0x0100
#define TBS_ALIGN_BOTTOM 0x0200
#define TBS_ALIGN_LEFT 0x0400
#define TBS_ALIGN_RIGHT 0x0800
//ToolBar Messages // 260 .. 269
#define TBM_DRAG_START WM_APP + 260
void InitControlsAFC( HINSTANCE hInst );
struct tSpinnerData
{
float Value;
float Step;
Float2 Range;
POINT MousePos;
UINT State;
float ValueStart;
POINT MousePosStart;
BOOL Dragging;
BOOL Pushed;
HWND hBuddy;
};
struct tTrackBarData
{
UINT Position;
UINT Range;
int RangeStart;
int RangeEnd;
BOOL Selected;
int SelectionStart;
int SelectionEnd;
int *pKeyPosition;
UINT KeyCount;
};
struct tSubButtonInfo
{
UINT ID;
UINT ImageIndex;
};
struct tButtonInfo
{
//Basic Data
UINT State;
UINT Style;
SIZE Size;
UINT ID;
COLORREF Color;
bool HighLighted;
bool Enabled;
UINT ImageIndex;
UINT Group;
HWND hParent;
HWND hWnd;
//Extended State Images
bool HasPushedImage;
UINT PushedIndex;
bool HasDisabledImage;
UINT DisabledIndex;
//SubImage Extension
int ActiveSubImage;
UINT *pSubImageIndex;
UINT SubImageCount;
//DropDown Menu Extension
int ActiveSubButton;
int LastSubButton;
UINT DropdownMenuStyle;
bool DropdownMenuVisible;
UINT SubButtonCount;
tSubButtonInfo *pSubButton;
//TooTip Information
bool ToolTipVisible;
POINT LastMousePos;
HWND hToolTip;
bool ShowToolTip;
};
struct tControlGroupInfo
{
UINT DialogRes;
UINT State;
DLGPROC DlgProc;
};
struct tGroupData
{
UINT ID;
UINT Position;
};
struct tDialogData
{
UINT Height;
int Position;
int RealPos;
int HandlePos;
HWND hWnd;
UINT ID;
DLGPROC Proc;
tGroupData *pGroup;
UINT GroupCount;
UINT *pGroupOrdered;
UINT OrderedCount;
};
///////////////////////////////////////////////////////////////////
////**** CLASS: (ACustomUI) ****////
///////////////////////////////////////////////////////////////////
class ACustomUI
{
public:
ACustomUI();
~ACustomUI();
void DrawColorSwatch( HDC *pHdc, int xPos, int yPos, int xSize, int ySize, COLORREF color, bool selected );
void DrawSeparator( HDC *pHdc, int xPos, int yPos, int size, bool horizontal );
void DrawStaticEdge( HDC *pHdc, int xPos, int yPos, int xSize, int ySize, UINT type );
void DrawImage16( HDC *pHdc, int xPos, int yPos, UINT index );
void DrawImage24( HDC *pHdc, int xPos, int yPos, UINT index );
void DrawMarker( HDC *pHdc, int xPos, int yPos );
UINT AddImages16( LPSTR BitmapPath, LPSTR BitmapPath_a );
void RemoveImage16( UINT index );
void SetButtonImage16( HWND dialog, UINT controlID, UINT imageIndex );
UINT AddImages24( LPSTR BitmapPath, LPSTR BitmapPath_a );
void RemoveImage24( UINT index );
void SetButtonImage24( HWND dialog, UINT controlID, UINT imageIndex );
void DrawADropdownMenu( HWND hButton, UINT style );
void DrawAGroupControlUI( HWND hWnd );
void DrawAGroupControlButton( HWND hWnd );
void DrawASpinner( HWND hWnd, UINT state );
void DrawAButton( HWND hWnd, tButtonInfo *pInfo );
void DrawATrackBar( HWND hWnd );
void DrawAScrollBar( HWND hWnd );
void DrawADialogBar( HWND hWnd );
COLORREF Color3DLight;
COLORREF Color3DShadow;
COLORREF Color3DFace;
COLORREF Color3DDarkShadow;
COLORREF Color3DLightShadow;
HPEN Pen3DLight;
HPEN Pen3DShadow;
HPEN Pen3DFace;
HPEN Pen3DDarkShadow;
HPEN PenBlack;
HPEN PenWhite;
HPEN PenVoid;
HBRUSH Brush3DDarkShadow;
HBRUSH Brush3DLightShadow;
HBRUSH Brush3DFace;
HBRUSH Brush3DShadow;
HBRUSH BrushOrange;
HBRUSH BrushRed;
HBRUSH BrushBlack;
HBRUSH BrushWhite;
HBRUSH BrushVoid;
HBRUSH BrushToolTip;
HFONT FontArialSmall;
HFONT FontArialMedium;
COLORREF Color1;
HDC hMemoryDC;
HBITMAP hBitmap1;
POINT Point1;
POINT Point2;
SIZE Size1;
SIZE Size2;
RECT Rect1;
RECT Rect2;
CHAR Buffer1[64];
CHAR Buffer2[64];
PAINTSTRUCT PaintStruct;
HDC hdc;
UINT Style;
HIMAGELIST hImageList16;
HIMAGELIST hImageList24;
HINSTANCE hInstance;
private:
tSubButtonInfo *pMenuButton;
UINT MenuButtonCount;
HWND hMenuWindow;
UINT SelectedButton;
};
///////////////////////////////////////////////////////////////////
////**** CLASS: (AToolBar) ****////
///////////////////////////////////////////////////////////////////
//Needs Size Notification ( WM_SIZE )
class AToolBar
{
public:
AToolBar();
~AToolBar();
//Dialog Functions
void AddDialog( UINT resId, DLGPROC procedure );
void RemoveDialog();
void SetDialogPosition( int position );
HWND GetDialog();
int GetPosition();
HWND GetControl( UINT id );
//Main Functions
void Create( HWND parent, HINSTANCE hInst, UINT style );
void SetBarPosition( UINT x, UINT y, UINT width, UINT height );
HWND GetWindow();
UINT GetStyle();
POINT DragStartMousePos;
int DragStartPosition;
bool Dragging;
bool Dragable;
RECT FullRect;
RECT ViewRect;
private:
UINT MarginTop;
UINT MarginBottom;
UINT MarginLeft;
UINT MarginRight;
HINSTANCE hInstance;
HWND hParent;
HWND hWnd;
HWND hDialog;
DLGPROC DialogProc;
int Position;
UINT Style;
};
///////////////////////////////////////////////////////////////////
////**** CLASS: (ADialogBar) ****////
///////////////////////////////////////////////////////////////////
//Needs Size Notification ( WM_SIZE )
class ADialogBar
{
public:
UINT CreatedCount;
ADialogBar();
~ADialogBar();
//Dialog Functions
void AddDialog( UINT resId, DLGPROC procedure );
void RemoveDialog( UINT index );
void SelectDialog( UINT index );
void ResetCurrentDialog();
void SetDialogPosition( UINT index, int position );
void Initialize();
HWND GetDialog( UINT index );
HWND GetGroup( UINT dialog, UINT id );
HWND GetGroupDialog( UINT dialog, UINT id );
bool IsGroupDialog( UINT dialog, UINT id );
HWND GetGroupControl( UINT dialog, UINT id, UINT controlId );
HWND GetTabBar();
HWND GetScrollBar();
UINT GetCurrentDialog();
UINT GetDialogCount();
//Group Functions
void SelectGroup( UINT dialog, UINT id, DLGPROC dlgProc );
// void HideGroup( UINT dialog, UINT id );
void ClearDialogGroups( UINT dialog );
void ReArrangeGroups();
//Main Functions
void Create( HWND parent, HINSTANCE hInst, UINT scrollBarId );
void SetBarPosition( UINT x, UINT y, UINT width, UINT height );
void SetTabBar( UINT resId, DLGPROC procedure );
//DialogBar Variables
HWND hParent;
HWND hWnd;
UINT MarginSize;
//Drawing Variables
RECT Rect;
RECT DialogMargin;
RECT DialogRect;
UINT TabBarHeight;
//Dragging Variables
POINT DragStartMousePos;
int DragStartPosition;
bool Dragging;
bool Dragable;
tDialogData *pDialog;
private:
//ScrollBar Variables
int ScrollPosition;
UINT ScrollBarID;
SIZE ScrollBarSize;
POINT ScrollBarPos;
HWND hScrollBar;
//Dialog Variables
UINT DialogCount;
UINT DialogCurrent;
//TabBar Variables
HWND hTabBar;
UINT TabBarID;
HINSTANCE hInstance;
};
///////////////////////////////////////////////////////////////////
////**** CLASS: (ATrackBar) ****////
///////////////////////////////////////////////////////////////////
//Needs Size Notification ( WM_SIZE )
class ATrackBar
{
public:
ATrackBar();
~ATrackBar();
void Create( HWND parent, HINSTANCE hInst );
HWND GetHandle();
void SetBarPosition( UINT x, UINT y, UINT width, UINT height );
void SetRange( int start, int end );
void SetHandlePos( int position );
void GetHandlePos();
HWND hWnd;
HWND hParent;
RECT Rect;
UINT MarginSize;
HINSTANCE hInstance;
int RangeStart;
int RangeEnd;
int Range;
int HandlePosition;
UINT HandleSize;
};
#endif