Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[r6995]: main / trunk / extensions / platform / windows / oodialog / ooDialog.hpp Maximize Restore History

Download this file

ooDialog.hpp    865 lines (764 with data), 33.6 kB

  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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
/*----------------------------------------------------------------------------*/
/* */
/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
/* Copyright (c) 2005-2010 Rexx Language Association. All rights reserved. */
/* */
/* This program and the accompanying materials are made available under */
/* the terms of the Common Public License v1.0 which accompanies this */
/* distribution. A copy is also available at the following address: */
/* http://www.oorexx.org/license.html */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in */
/* the documentation and/or other materials provided with the distribution. */
/* */
/* Neither the name of Rexx Language Association nor the names */
/* of its contributors may be used to endorse or promote products */
/* derived from this software without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/*----------------------------------------------------------------------------*/
#ifndef oodDialog_Included
#define oodDialog_Included
#define NTDDI_VERSION NTDDI_LONGHORN
#define _WIN32_WINNT 0x0600
#define _WIN32_IE 0x0600
#define WINVER 0x0501
#define STRICT
#define OEMRESOURCE
#include <windows.h>
#include <CommCtrl.h>
#include "oorexxapi.h"
#define NR_BUFFER 15
#define DATA_BUFFER 8192
#define MAXCHILDDIALOGS 20
#define MAXDIALOGS 20
#define MAXTABPAGES MAXPROPPAGES
#define MAXMANAGEDTABS 4
#define DEFAULT_FONTNAME "MS Shell Dlg"
#define DEFAULT_FONTSIZE 8
#define MAX_DEFAULT_FONTNAME 256
#define MAX_LIBRARYNAME 256
/*
* The number of table entries is per dialog. 100 controls per dialog seems
* like more than plenty.
*/
#define DEF_MAX_BT_ENTRIES 50
#define DEF_MAX_DT_ENTRIES 100
#define DEF_MAX_CT_ENTRIES 100
#define DEF_MAX_IT_ENTRIES 20
#define DEF_MAX_NOTIFY_MSGS 100
#define DEF_MAX_COMMAND_MSGS 100
#define DEF_MAX_MISC_MSGS 50
/* User defined window messages used for RexxDlgProc() */
#define WM_USER_CREATECHILD WM_USER + 0x0601
#define WM_USER_INTERRUPTSCROLL WM_USER + 0x0602
#define WM_USER_GETFOCUS WM_USER + 0x0603
#define WM_USER_GETSETCAPTURE WM_USER + 0x0604
#define WM_USER_GETKEYSTATE WM_USER + 0x0605
#define WM_USER_SUBCLASS WM_USER + 0x0606
#define WM_USER_SUBCLASS_REMOVE WM_USER + 0x0607
#define WM_USER_HOOK WM_USER + 0x0608
#define WM_USER_CONTEXT_MENU WM_USER + 0x0609
#define WM_USER_CREATECONTROL_DLG WM_USER + 0x060A
#define WM_USER_CREATECONTROL_RESDLG WM_USER + 0x060B
#define WM_USER_CREATEPROPSHEET_DLG WM_USER + 0x060C
#define OODDLL "oodialog.dll"
#define OOD_LVL_MAJOR 4
#define OOD_LVL_MINOR 2
#define OOD_LVL_BIT 0
/* Flags for the get icon functions. Indicates the source of the icon. */
#define ICON_FILE 0x00000001
#define ICON_OODIALOG 0x00000002
#define ICON_DLL 0x00000004
/* Defines for the different possible versions of comctl32.dll up to Windows
* XP SP2. These DWORD "packed version" numbers are calculated using the
* following macro:
*/
#define MAKEVERSION(major,minor) MAKELONG(minor,major)
#define COMCTL32_4_0 262144
#define COMCTL32_4_7 262151
#define COMCTL32_4_71 262215
#define COMCTL32_4_72 262216
#define COMCTL32_5_8 327688
#define COMCTL32_5_81 327761
#define COMCTL32_6_0 393216
#define COMCTL32_6_10 393226 // Probably should use this as the latest version
#define COMCTL32_6_16 393232 // Latest version I've seen on an updated Windows 7
/**
* A 'tag' is used in processing the mapping of Windows messages to user
* defined methods. It allows the user mapping to dictate different processing
* of a Windows message based on the tag.
*
* The least significant byte is used to define the type of control. This byte
* can be isolated using TAG_CTRLMASK.
*/
#define TAG_CTRLMASK 0x000000FF
#define TAG_NOTHING 0x00000000
#define TAG_DIALOG 0x00000001
#define TAG_BUTTON 0x00000004
#define TAG_TREEVIEW 0x00000006
#define TAG_LISTVIEW 0x00000007
#define TAG_TRACKBAR 0x00000008
#define TAG_TAB 0x00000009
#define TAG_UPDOWN 0x0000000A
#define TAG_DATETIMEPICKER 0x0000000B
#define TAG_MONTHCALENDAR 0x0000000C
/**
* The next 2 bytes are generic 'flags' that can be isolated using TAG_FLAGMASK.
* The individual flags are not necessarily unique, but rather are unique when
* combined with a specific CTRL byte. For instance, the help and menu related
* flags are only used with TAG_DIALOG. So, it doesn't matter that TAG_HELP has
* the same value as TAG_STATECHANGED.
*/
#define TAG_FLAGMASK 0x00FFFF00
#define TAG_HELP 0x00000100
#define TAG_CONTEXTMENU 0x00000200
#define TAG_MENUCOMMAND 0x00000400
#define TAG_SYSMENUCOMMAND 0x00000800
#define TAG_MENUMESSAGE 0x00001000
#define TAG_STATECHANGED 0x00000100
#define TAG_CHECKBOXCHANGED 0x00000200
#define TAG_SELECTCHANGED 0x00000400
#define TAG_FOCUSCHANGED 0x00000800
/**
* The last byte is for, well 'extra' information. Use TAG_EXTRAMASK to
* isolate the byte.
*/
#define TAG_EXTRAMASK 0xFF000000
// Reply TRUE in dialog procedure, not FALSE. Reply FALSE passes message on to
// the system for processing. TRUE indicates the message was handled.
#define TAG_MSGHANDLED 0x01000000
// The message reply comes from Rexx. I.e., from the programmer. The return
// will be a .Pointer, unwrap it and use it as the message reply. (This is a
// first cut at this, may change.)
#define TAG_REPLYFROMREXX 0x02000000
// Describes how a message searched for in the message table should be handled.
typedef enum
{
ContinueProcessing = 0, // Message not matched, continue in RexxDlgProc()
ReplyFalse = 1, // Message matched and handled return FALSE to the system from RexxDlgProc()
ReplyTrue = 2, // Message matched and handled return TRUE to the system from RexxDlgProc()
ContinueSearching = 3 // Continue searching message table before returning to RexxDlgProc()
} MsgReplyType;
// Identifies an error, that should never happen, discovered in RexxDlgProc().
// Used in endDialogPremature() to determine what message to display.
typedef enum
{
NoPCPBDpased = 0, // pCPlainBaseDialog not passed in the WM_INITDIALOG message
NoPCPSPpased = 1, // pCPropertySheet not passed in the WM_INITDIALOG message
NoThreadAttach = 2, // Failed to attach the thread context.
NoThreadContext = 3, // The thread context pointer is null.
RexxConditionRaised = 4, // The invocation of a Rexx event handler method raised a condition.
} DlgProcErrType;
#define NO_PCPBD_PASSED_MSG "RexxDlgProc() ERROR in WM_INITDIALOG. PlainBaseDialog\nCSELF is null.\n\n\tpcpdb=%p\n\thDlg=%p\n"
#define NO_PCPSP_PASSED_MSG "RexxDlgProc() ERROR in WM_INITDIALOG. PropertySheetPage\nCSELF is null.\n\n\tpcpsp=%p\n\thDlg=%p\n"
#define NO_THREAD_ATTACH_MSG "RexxDlgProc() ERROR in WM_INITDIALOG. Failed to attach\nthread context.\n\n\tpcpdb=%p\n\thDlg=%p\n"
#define NO_THREAD_CONTEXT_MSG "RexxDlgProc() ERROR. Thread context is null.\n\n\tdlgProcContext=%p\n\thDlg=%pn"
// Enum for the type of Windows dialog control.
typedef enum
{
winStatic = 1,
winPushButton = 2,
winCheckBox = 3,
winRadioButton = 4,
winGroupBox = 5,
winEdit = 6,
winComboBox = 7,
winListBox = 8,
winScrollBar = 9,
winTreeView = 10,
winListView = 11,
winTrackBar = 12,
winProgressBar = 13,
winTab = 14,
winDateTimePicker = 15,
winMonthCalendar = 16,
winUpDown = 17,
// A special value used by the data table / data table connection functions.
winNotAControl = 42,
winUnknown = 55
} oodControl_t;
// Enum for the type of an ooDialog class. Types to be added as needed.
typedef enum
{
oodPlainBaseDialog, oodCategoryDialog, oodUserDialog, oodRcDialog, oodResDialog,
oodControlDialog, oodUserControlDialog, oodRcControlDialog, oodResControlDialog, oodUserPSPDialog,
oodRcPSPDialog, oodResPSPDialog, oodDialogControl, oodStaticControl, oodButtonControl,
oodEditControl, oodListBox, oodProgressBar, oodUnknown
} oodClass_t;
// How the Global constDir is to be used
typedef enum {globalOnly, globalFirst, globalLast, globalNever} oodConstDir_t;
inline LONG_PTR setWindowPtr(HWND hwnd, int index, LONG_PTR newPtr)
{
#ifndef __REXX64__
#pragma warning(disable:4244)
#endif
return SetWindowLongPtr(hwnd, index, newPtr);
#ifndef __REXX64__
#pragma warning(default:4244)
#endif
}
inline LONG_PTR getWindowPtr(HWND hwnd, int index)
{
return GetWindowLongPtr(hwnd, index);
}
inline LONG_PTR setClassPtr(HWND hwnd, int index, LONG_PTR newPtr)
{
#ifndef __REXX64__
#pragma warning(disable:4244)
#endif
return SetClassLongPtr(hwnd, index, newPtr);
#ifndef __REXX64__
#pragma warning(default:4244)
#endif
}
inline LONG_PTR getClassPtr(HWND hwnd, int index)
{
return GetClassLongPtr(hwnd, index);
}
/* structures to manage the dialogs */
typedef struct {
PCHAR rexxMethod;
WPARAM wParam;
ULONG_PTR wpFilter;
LPARAM lParam;
ULONG_PTR lpfilter;
uint32_t msg;
uint32_t msgFilter;
uint32_t tag;
} MESSAGETABLEENTRY;
typedef struct {
oodControl_t type;
uint32_t id;
uint32_t category;
} DATATABLEENTRY;
typedef struct {
uint32_t buttonID;
HBITMAP bitmapID;
HBITMAP bmpFocusID;
HBITMAP bmpSelectID;
HBITMAP bmpDisableID;
int32_t displaceX;
int32_t displaceY;
uint32_t loaded;
bool frame;
} BITMAPTABLEENTRY;
typedef struct {
bool isSysBrush;
ULONG itemID;
INT ColorBk;
INT ColorFG;
HBRUSH ColorBrush;
} COLORTABLEENTRY;
typedef struct {
ULONG iconID;
PCHAR fileName;
} ICONTABLEENTRY;
// Structure used for context menus
typedef struct {
HMENU hMenu;
HWND hWnd;
UINT flags;
POINT point;
LPTPMPARAMS lptpm;
DWORD dwErr;
} TRACKPOP, *PTRACKPOP;
// A generic structure used for subclassing controls with the Windows
// subclassing helper functions and for the keyboard hook function.
typedef struct {
RexxThreadContext *dlgProcContext; /* Attached thread context of dialog. */
RexxObjectPtr rexxDialog; /* Rexx dialog matching thread context. */
RexxObjectPtr rexxControl; /* Rexx dialog control being subclassed. */
HWND hCtrl; /* Window handle of subclassed control. */
void *pData; /* Pointer to subclass specific data. */
UINT uID; /* Resource ID of subclassed control. */
} SUBCLASSDATA;
/* Stuff for key press subclassing and keyboard hooks */
#define MAX_KEYPRESS_METHODS 63
#define COUNT_KEYPRESS_KEYS 256
#define CCH_METHOD_NAME 197
typedef struct {
BOOL none; /* If none, neither of shift, control, or alt can be pressed */
BOOL shift;
BOOL alt;
BOOL control;
BOOL and; /* If 'and' is false, filter is 'or' */
BOOL virt; /* If virtual use GetKeyState to see if control, alt, or shift is down. */
} KEYFILTER, *PKEYFILTER;
typedef struct {
BYTE key[COUNT_KEYPRESS_KEYS]; /* Value of key[x] is index to pMethods[] */
UINT usedMethods; /* Count of used slots in pMethods[] */
UINT topOfQ; /* Top of next free queue, 0 if empty */
PCHAR pMethods[MAX_KEYPRESS_METHODS + 1]; /* Index 0 intentionally left empty */
KEYFILTER *pFilters[MAX_KEYPRESS_METHODS + 1]; /* If null, no filter */
UINT nextFreeQ[MAX_KEYPRESS_METHODS]; /* Used only if existing connection removed */
} KEYPRESSDATA;
// It is anticpated that the connectKeyEvent() method will be extended some time
// soon, so we have a KEYEVENTDATA struct even though it is not technically
// needed at this point.
typedef struct {
char *method; /* Name of method to invoke. */
} KEYEVENTDATA;
// Masks for lParam of key messages. WM_KEYDOWN, WM_CHAR, etc..
#define KEY_RELEASED 0x80000000 // Transition state: 1 key is being released / 0 key is being pressed.
#define KEY_WASDOWN 0x40000000 // Previous state: 1 key was down / 0 key was up.
#define KEY_ALTHELD 0x20000000 // Context code: 1 ALT key was held when key pressed / 0 otherwise.
#define KEY_ISEXTENDED 0x01000000 // Key is an extended key: 1 if an extended key / 0 otherwise
// Masks for GetAsyncKeyState() and GetKeyState() returns.
#define TOGGLED 0x00000001 // GetKeyState()
#define ISDOWN 0x8000 // GetAsyncKeyState()
/* Microsoft does not define these, just has this note:
*
* VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
* 0x40 : unassigned
* VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
*/
#define VK_0 0x30
#define VK_1 0x31
#define VK_2 0x32
#define VK_3 0x33
#define VK_4 0x34
#define VK_5 0x35
#define VK_6 0x36
#define VK_7 0x37
#define VK_8 0x38
#define VK_9 0x39
#define VK_A 0x41
#define VK_B 0x42
#define VK_C 0x43
#define VK_D 0x44
#define VK_E 0x45
#define VK_F 0x46
#define VK_G 0x47
#define VK_H 0x48
#define VK_I 0x49
#define VK_J 0x4A
#define VK_K 0x4B
#define VK_L 0x4C
#define VK_M 0x4D
#define VK_N 0x4E
#define VK_O 0x4F
#define VK_P 0x50
#define VK_Q 0x51
#define VK_R 0x52
#define VK_S 0x53
#define VK_T 0x54
#define VK_U 0x55
#define VK_V 0x56
#define VK_W 0x57
#define VK_X 0x58
#define VK_Y 0x59
#define VK_Z 0x5A
/* The extended dialog template struct. Microsoft does not supply this in any
* header, just provided the definition in the MSDN docs.
*/
typedef struct {
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
WCHAR menu; // Actually variable length array of 16-bit values
WCHAR windowClass; // Actually variable length array of 16-bit values
WCHAR title; // Actually variable length array of 16-bit values
WORD pointsize;
WORD weight;
BYTE italic;
BYTE charset;
WCHAR typeface; // Actually variable length array of 16-bit values
} DLGTEMPLATEEX;
typedef struct {
DWORD helpID;
DWORD exStyle;
DWORD style;
short x;
short y;
short cx;
short cy;
DWORD id;
WORD windowClass;
WORD title;
WORD extraCount;
} DLGITEMTEMPLATEEX;
/* Struct for the WindowBase object CSelf. */
typedef struct _wbCSelf {
HWND hwnd;
RexxObjectPtr rexxHwnd;
RexxObjectPtr rexxSelf;
wholenumber_t initCode;
uint32_t sizeX;
uint32_t sizeY;
double factorX;
double factorY;
} CWindowBase;
typedef CWindowBase *pCWindowBase;
/* Struct for the EventNotification object CSelf. */
typedef struct _enCSelf {
MESSAGETABLEENTRY *notifyMsgs;
MESSAGETABLEENTRY *commandMsgs;
MESSAGETABLEENTRY *miscMsgs;
size_t nmSize; // Size of table.
size_t nmNextIndex; // Next free index in table.
size_t cmSize;
size_t cmNextIndex;
size_t mmSize;
size_t mmNextIndex;
HWND hDlg;
RexxObjectPtr rexxSelf;
HHOOK hHook;
SUBCLASSDATA *pHookData;
} CEventNotification;
typedef CEventNotification *pCEventNotification;
// Struct for the PlainBaseDialog class CSelf.
typedef struct _pbdcCSelf {
char fontName[MAX_DEFAULT_FONTNAME];
uint32_t fontSize;
} CPlainBaseDialogClass;
typedef CPlainBaseDialogClass *pCPlainBaseDialogClass;
/* Struct for the WindowExtensions object CSelf. */
typedef struct _weCSelf {
pCWindowBase wndBase;
HWND hwnd;
RexxObjectPtr rexxSelf;
} CWindowExtensions;
typedef CWindowExtensions *pCWindowExtensions;
/* Struct for the PlainBaseDialog object CSelf. The struct itself is
* allocated using interpreter memory and therefore garbage collected by the
* interpreter. But, there are still things like the table allocated externally
* to the interpreter and require normal C/C++ memory management. Also things
* like brushes, bitmaps, etc., still need to be released.
*/
typedef struct _pbdCSelf {
char fontName[MAX_DEFAULT_FONTNAME];
char library[MAX_LIBRARYNAME];
void *previous; // Previous pCPlainBaseDialog used for stored dialogs
size_t tableIndex; // Index of this dialog in the stored dialog table
HWND activeChild; // The active child dialog, used for CategoryDialogs
HWND childDlg[MAXCHILDDIALOGS+1];
HINSTANCE hInstance; // Handle to loaded DLL instance, ooDialog.dll or a resource DLL for a ResDialog
HANDLE hDlgProcThread;
RexxInstance *interpreter;
RexxThreadContext *dlgProcContext;
RexxObjectPtr resourceID;
HICON sysMenuIcon;
HICON titleBarIcon;
pCWindowBase wndBase;
pCEventNotification enCSelf;
pCWindowExtensions weCSelf;
RexxObjectPtr rexxSelf; // This dialog's Rexx dialog object
HWND hDlg;
RexxObjectPtr rexxOwner; // This dialog's Rexx owner dialog object
HWND hOwnerDlg;
RexxObjectPtr rexxParent; // This dialog's Rexx parent dialog object
void *dlgPrivate; // Subclasses can store data unique to the subclass
void *initPrivate; // Subclasses can store init data unique to the subclass
DATATABLEENTRY *DataTab;
ICONTABLEENTRY *IconTab;
COLORTABLEENTRY *ColorTab;
BITMAPTABLEENTRY *BmpTab;
size_t DT_nextIndex;
size_t DT_size;
size_t IT_nextIndex;
size_t IT_size;
size_t CT_nextIndex;
size_t CT_size;
size_t BT_nextIndex;
size_t BT_size;
HBRUSH bkgBrush;
HBITMAP bkgBitmap;
WPARAM stopScroll;
HPALETTE colorPalette;
logical_t autoDetect;
DWORD threadID;
uint32_t fontSize;
bool onTheTop;
bool isCategoryDlg; // Need to use IsNestedDialogMessage()
bool isControlDlg; // Dialog was created as DS_CONTROL | WS_CHILD
bool isOwnedDlg; // Dialog has an owner dialog
bool isManagedDlg; // Dialog has an owner dialog, which is a tab owner dialog
bool isPageDlg; // Dialog is a property sheet page dialog
bool isPropSheetDlg; // Dialog is a property sheet dialog
bool isTabOwnerDlg; // Dialog is a tab owner dialog
bool sharedIcon;
bool didChangeIcon;
bool isActive;
bool dlgAllocated;
bool abnormalHalt;
bool scrollNow; // For scrolling text in windows.
} CPlainBaseDialog;
typedef CPlainBaseDialog *pCPlainBaseDialog;
// Struct for the DialogControl object CSelf.
//
// Note that for a control in a category dialog page, the hDlg is the handle of
// the actual dialog the control resides in. This is differnent than the dialog
// handle of the Rexx owner dialog.
typedef struct _dcCSelf {
bool isInCategoryDlg;
uint32_t id;
oodControl_t controlType;
int lastItem;
pCWindowBase wndBase;
RexxObjectPtr rexxSelf; // The Rexx dialog control object
HWND hCtrl; // Handle of the dialog control
RexxObjectPtr oDlg; // The Rexx owner dialog object
HWND hDlg; // Handle of the dialog the control is in.
} CDialogControl;
typedef CDialogControl *pCDialogControl;
/* Struct for the DynamicDialog object CSelf. */
typedef struct _ddCSelf {
pCPlainBaseDialog pcpbd;
RexxObjectPtr rexxSelf;
DLGTEMPLATEEX *base; // Base pointer to dialog template (basePtr)
void *active; // Pointer to current location in dialog template (activePtr)
void *endOfTemplate; // Pointer to end of allocated memory for the template
uint32_t expected; // Expected dialog item count
uint32_t count; // Dialog item count (dialogItemCount)
} CDynamicDialog;
typedef CDynamicDialog *pCDynamicDialog;
/* Struct for the ControlDialogInfo object CSelf. */
typedef struct _cdiCSelf {
SIZE size;
RexxObjectPtr owner;
char *title;
HINSTANCE hInstance; // resources attribute, C++ part of .ResourceImage
HICON hIcon; // tabIcon attribute, C++ part if using .Image
uint32_t iconID; // tabIcon attribute, C++ part if using resource ID
bool managed;
} CControlDialogInfo;
typedef CControlDialogInfo *pCControlDialogInfo;
/* Struct for the ControlDialog object CSelf. */
typedef struct _cdCSelf {
SIZE size;
pCPlainBaseDialog pcpbd;
RexxObjectPtr rexxSelf;
char *pageTitle;
oodClass_t pageType;
HICON hIcon; // tabIcon attribute, C++ part if using .Image
uint32_t iconID; // tabIcon attribute, C++ part if using resource ID
uint32_t pageNumber; // Page number, zero-based index
bool activated; // Was the page visited by the user
bool isInitializing;
bool isManaged;
} CControlDialog;
typedef CControlDialog *pCControlDialog;
/* Struct for the ManagedTab object CSelf. */
typedef struct _mtCSelf {
RexxArrayObject pages; // Used to protect from garbage collection, until transferred to tab owner dialog
RexxObjectPtr *rexxPages;
pCControlDialog *cppPages;
uint32_t tabID; // tab resource ID
uint32_t count; // count of pages
bool wantNotifications; // Send the dialog all tab notifications.
} CManagedTab;
typedef CManagedTab *pCManagedTab;
/* Struct for the TabOwnerDlgInfo object CSelf. */
typedef struct _todiCSelf {
RexxArrayObject pages[MAXMANAGEDTABS]; // Used to protect from garbage collection, for a space.
pCManagedTab mts[MAXMANAGEDTABS];
uint32_t count;
bool useResourceImage;
} CTabOwnerDlgInfo;
typedef CTabOwnerDlgInfo *pCTabOwnerDlgInfo;
/* Struct for the TabOwnerDialog object CSelf. */
typedef struct _todCSelf {
pCManagedTab mts[MAXMANAGEDTABS];
uint32_t tabIDs[MAXMANAGEDTABS];
RexxThreadContext *dlgProcContext;
RexxObjectPtr rexxSelf;
HWND hDlg;
pCPlainBaseDialog pcpbd;
uint32_t countMTs;
} CTabOwnerDialog;
typedef CTabOwnerDialog *pCTabOwnerDialog;
/* Struct for the PropertySheetPage object CSelf. */
typedef struct _pspCSelf {
RexxInstance *interpreter;
RexxThreadContext *dlgProcContext;
pCPlainBaseDialog pcpbd;
pCDynamicDialog pcdd; // DynmicDialog CSelf, may be null.
RexxObjectPtr rexxSelf;
HPROPSHEETPAGE hPropSheetPage; // If added to existing property sheet.
PROPSHEETPAGE *psp; // Allocated prop sheet page struct, needs to be freed.
HWND hPage; // Dialog handle of page.
void *cppPropSheet; // PropertySheetDialog CSelf.
RexxObjectPtr rexxPropSheet; // Rexx PropertySheetDialog object.
HINSTANCE hInstance; // resources attribute, C++ part of .ResourceImage
RexxStringObject extraOpts; // Storage for extra options, used by RcPSPDialog, available for other uses.
HICON hIcon; // tabIcon attribute, C++ part if using .Image
uint32_t iconID; // tabIcon attribute, C++ part if using resource ID
INT_PTR pageID; // Identifies the page to the Windows property sheet, resource ID or pointer
char *pageTitle;
char *headerTitle;
char *headerSubTitle;
oodClass_t pageType;
uint32_t cx; // Width and height of the dialog.
uint32_t cy;
uint32_t pageFlags;
uint32_t resID; // Resource ID of dlg template for a ResPSPDialog (converted from symbolic if needed.)
uint32_t pageNumber; // Page number, zero-based index
bool activated; // Was the page visited by the user
bool abort; // Used to force a modal property sheet to close
bool wantAccelerators; // User wants PSN_TRANSLATEACCELERATOR notifications
bool wantGetObject; // User wants PSN_GETOBJECT notifications
bool isWizardPage;
bool inRemovePage; // Signals running in PropertySheetDialg::removePage()
} CPropertySheetPage;
typedef CPropertySheetPage *pCPropertySheetPage;
/* Struct for the PropertySheetDialog object CSelf. */
typedef struct _psdCSelf {
RexxThreadContext *dlgProcContext;
RexxObjectPtr rexxSelf;
HWND hDlg;
RexxObjectPtr *rexxPages;
pCPropertySheetPage *cppPages;
pCPlainBaseDialog pcpbd;
HINSTANCE hInstance; // resources attribute, C++ part of .ResourceImage
HICON hIcon; // icon attribute, C++ part if using .Image
uint32_t iconID; // icon attribute, C++ part if using resource ID
HBITMAP hWatermark; // waterMark attribute, C++ part if using .Image
uint32_t watermarkID; // watermark attribute, C++ part if useing resource ID
HBITMAP hHeaderBitmap; // headerBitmap attribute, C++ part if using .Image
uint32_t headerBitmapID; // headerBitmap attribute, C++ part if useing resource ID
HPALETTE hplWatermark; // Palette to use when drawing watermark and / or header bitmap
HIMAGELIST imageList; // imageList attribute, C++ part of .ImageList
uint32_t startPage; // Index of start page, 1-based. If 0 not set;
char *caption;
uint32_t pageCount;
uint32_t propSheetFlags;
int getResultValue; // Storage for the return from PSM_GETRESULT
bool modeless;
bool isNotWizard;
bool isWiz97;
bool isWizLite;
bool isAeroWiz;
} CPropertySheetDialog;
typedef CPropertySheetDialog *pCPropertySheetDialog;
#define COMCTL32_VERSION_STRING_LEN 31
// All global variables are defined in oodPackageEntry.cpp
extern HINSTANCE MyInstance;
extern pCPlainBaseDialog DialogTable[];
extern pCPlainBaseDialog TopDlg;
extern size_t CountDialogs;
extern CRITICAL_SECTION crit_sec;
extern CRITICAL_SECTION ps_crit_sec;
extern DWORD ComCtl32Version;
extern char ComCtl32VersionStr[];
extern RexxObjectPtr TheTrueObj;
extern RexxObjectPtr TheFalseObj;
extern RexxObjectPtr TheNilObj;
extern RexxObjectPtr TheZeroObj;
extern RexxObjectPtr TheTwoObj;
extern RexxObjectPtr TheOneObj;
extern RexxObjectPtr TheNegativeOneObj;
extern RexxObjectPtr TheApplicationObj;
extern RexxDirectoryObject TheConstDir;
extern oodConstDir_t TheConstDirUsage;
extern RexxDirectoryObject TheDotLocalObj;
extern RexxPointerObject TheNullPtrObj;
extern RexxClassObject ThePlainBaseDialogClass;
extern RexxClassObject TheDynamicDialogClass;
extern RexxClassObject TheDialogControlClass;
extern RexxClassObject ThePropertySheetPageClass;
extern RexxClassObject TheControlDialogClass;
extern RexxClassObject TheSizeClass;
extern RexxClassObject TheRectClass;
extern HBRUSH searchForBrush(pCPlainBaseDialog pcpbd, size_t *index, uint32_t id);
extern bool _isVersion(DWORD, DWORD, unsigned int, unsigned int, unsigned int);
extern bool _is32on64Bit(void);
// Enum for a Windows OS, don't need many right now.
typedef enum
{
XP_OS, Vista_OS, Windows7_OS
} os_name_t;
inline bool _is64Bit(void)
{
#if defined(_WIN64)
return true;
#else
return false;
#endif
}
inline bool _isW2K(void)
{
return _isVersion(5, 0, 0, 0, VER_EQUAL);
}
inline bool _isAtLeastW2K(void)
{
return _isVersion(5, 0, 4, 0, VER_GREATER_EQUAL);
}
inline bool _isXP(void)
{
return (_isVersion(5, 1, 0, 0, VER_EQUAL) || _isVersion(5, 2, 0, VER_NT_WORKSTATION, VER_EQUAL));
}
inline bool _isXP32(void)
{
return _isVersion(5, 1, 0, 0, VER_EQUAL);
}
inline bool _isXP64(void)
{
return _isVersion(5, 2, 0, VER_NT_WORKSTATION, VER_EQUAL);
}
inline bool _isAtLeastXP(void)
{
return _isVersion(5, 1, 2, 0, VER_GREATER_EQUAL);
}
inline bool _isW2K3(void)
{
return (_isVersion(5, 2, 0, VER_NT_DOMAIN_CONTROLLER, VER_EQUAL) ||
_isVersion(5, 2, 0, VER_NT_SERVER, VER_EQUAL));
}
inline bool _isAtLeastW2K3(void)
{
return (_isVersion(5, 2, 1, VER_NT_DOMAIN_CONTROLLER, VER_EQUAL) ||
_isVersion(5, 2, 1, VER_NT_SERVER, VER_EQUAL));
}
inline bool _isVista(void)
{
return _isVersion(6, 0, 0, VER_NT_WORKSTATION, VER_EQUAL);
}
inline bool _isServer2008(void)
{
return (_isVersion(6, 0, 0, VER_NT_DOMAIN_CONTROLLER, VER_EQUAL) ||
_isVersion(6, 0, 0, VER_NT_SERVER, VER_EQUAL));
}
inline bool _isAtLeastVista(void)
{
return _isVersion(6, 0, 0, 0, VER_GREATER_EQUAL);
}
inline bool _isWindows7(void)
{
return _isVersion(6, 1, 0, VER_NT_WORKSTATION, VER_EQUAL);
}
inline bool _isServer2008R2(void)
{
return (_isVersion(6, 1, 0, VER_NT_DOMAIN_CONTROLLER, VER_EQUAL) ||
_isVersion(6, 1, 0, VER_NT_SERVER, VER_EQUAL));
}
inline bool _isAtLeastWindows7(void)
{
return _isVersion(6, 1, 0, 0, VER_GREATER_EQUAL);
}
#endif