-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwolf.h
592 lines (512 loc) · 12.7 KB
/
wolf.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
584
585
586
587
588
589
590
591
592
/*
WOLF.H
Copyright (c) 1994 Shawn Halpenny
All rights reserved.
Header file for WOLF.
*/
#ifndef __WOLF_H
#define __WOLF_H
//want strict Windows compilation under version 3.1
#define STRICT
#define WINVER 0x30a
//Include files
#ifndef __WINDOWS_H
#include <windows.h>
#endif
#ifndef ___DEFS_H
#include <_defs.h>
#endif
#ifndef __DLISTIMP_H
#include <dlistimp.h>
#endif
#ifndef __COMMDLG_H
#include <commdlg.h>
#endif
//Facilitate dispatching messages
#define WM_COUNT 0x8000
#define WM_FIRST 0x0000
#define WM_INTERNAL 0x7F00
#define ID_COUNT 0x1000
#define ID_FIRST 0x8000
#define ID_INTERNAL 0x8F00
#define ID_FIRSTMDICHILD (ID_INTERNAL+1)
#define CM_COUNT 0x6000
#define CM_FIRST 0xA000
#define CM_INTERNAL 0xFF00
//Dialog templates specific to WOLF
#define ID_INPUTDLG 32000
#define ID_FILEDLG 32001
//File dialog types
#define FD_OPEN 1
#define FD_SAVE 2
//Transfer buffer mechanism
enum TransDir { TF_SET, TF_GET, TF_SIZE };
//WOLF class identifiers
enum WOLFid { dontCare, mdiclientClass, mdiframeClass, dialogClass, modelessdialogClass, controlClass };
//Bit flag masks
#define WB_AUTOCREATE 0x00000001
#define WB_TRANSFER 0x00000002
#define WB_SYSTEMCLASS 0x00000004
#define WB_KBHANDLER 0x00000008
_CLASSDEF(TMessage)
struct TMessage
{
HWND hWindow;
UINT wMsg;
union
{
WORD wParam;
struct
{
BYTE Lo;
BYTE Hi;
} WP;
};
union
{
DWORD lParam;
struct tagLP
{
WORD Lo;
WORD Hi;
} LP;
};
LONG lResult;
};
_CLASSDEF(TWindowObject)
_CLASSDEF(TWindow)
_CLASSDEF(TMDIFrame)
_CLASSDEF(TMDIClient)
_CLASSDEF(TMDIChild)
_CLASSDEF(TDialog)
_CLASSDEF(TModelessDialog)
_CLASSDEF(TControl)
_CLASSDEF(TPushButton)
_CLASSDEF(TGroupBox)
_CLASSDEF(TCheckBox)
_CLASSDEF(TRadioButton)
_CLASSDEF(TStatic)
_CLASSDEF(TEdit)
_CLASSDEF(TListBox)
_CLASSDEF(TComboBox)
_CLASSDEF(TScrollBar)
_CLASSDEF(TInputDialog)
_CLASSDEF(TFileDialog)
_CLASSDEF(TApplication)
_CLASSDEF(TToolBar)
class _CLASSTYPE TWindowObject
{
protected:
LPSTR lpTransferBuffer;
DWORD dwFlags;
public:
BI_DoubleListImp<PTWindowObject> ChildList;
PTApplication pApplication;
PTWindowObject pParent;
HWND hWindow;
int x, y, cx, cy;
DWORD dwStyle;
DWORD dwExStyle;
LPCSTR lpszWindowText;
int nID;
WNDCLASS WndClass;
TWindowObject(PTWindowObject, LPCSTR, int=0);
virtual ~TWindowObject();
void SetProperties();
void RemoveProperties();
virtual WOLFid Identify() = 0;
BOOL IsFlagSet(DWORD);
void SetFlags(DWORD, BOOL);
void SetTransferBuffer(LPSTR);
BOOL CreateChildren();
virtual void WMCommand(RTMessage) = [WM_FIRST + WM_COMMAND];
virtual void WMClose(RTMessage) = [WM_FIRST + WM_CLOSE];
virtual void WMDestroy(RTMessage) = [WM_FIRST + WM_DESTROY];
virtual void WMNCDestroy(RTMessage) = [WM_FIRST + WM_NCDESTROY];
virtual void WMHScroll(RTMessage) = [WM_FIRST + WM_HSCROLL];
virtual void WMVScroll(RTMessage) = [WM_FIRST + WM_VSCROLL];
virtual void WMQueryEndSession(RTMessage) = [WM_FIRST + WM_QUERYENDSESSION];
virtual BOOL Create();
virtual BOOL Register();
PTWindowObject GetChild(int);
void DoTransfer(TransDir);
virtual BOOL CanClose();
virtual LONG DispatchAMessage(UINT, RTMessage);
virtual LONG DefMsgHandler(RTMessage);
void Show(int=SW_SHOWNORMAL);
virtual WORD Transfer(LPSTR, TransDir) = 0;
void SetText(LPCSTR);
void GetText(LPSTR, int);
int GetTextLen();
void Enable(BOOL);
void SetDimensions(int, int, int, int);
void GetDimensions();
void SetStyle(DWORD, DWORD);
void GetStyle();
void SetFocus();
};
class _CLASSTYPE TWindow : public TWindowObject
{
protected:
static LRESULT CALLBACK _export StandardWndProc(HWND, UINT, WPARAM, LPARAM);
public:
TWindow(PTWindowObject, LPCSTR, int=0);
~TWindow();
WORD Transfer(LPSTR, TransDir)
{
return 0;
}
virtual void WMPaint(RTMessage) = [WM_FIRST + WM_PAINT];
virtual void Paint(HDC, PAINTSTRUCT _FAR &);
WOLFid Identify() { return dontCare; }
void AssignMenu(int);
void AssignMenu(LPCSTR);
void AssignIcon(int);
void AssignIcon(LPCSTR);
void AssignCursor(int);
void AssignCursor(LPCSTR);
virtual void WMCreate(RTMessage) = [WM_FIRST + WM_CREATE];
};
class _CLASSTYPE TMDIFrame : public TWindow
{
void Init();
public:
PTMDIClient pClient;
int nWindowMenuPos;
TMDIFrame(LPCSTR, int);
WOLFid Identify() { return mdiframeClass; }
LONG DefMsgHandler(RTMessage);
void CloseChildren();
virtual void WMCreate(RTMessage) = [WM_FIRST + WM_CREATE];
virtual void WMCommand(RTMessage) = [WM_FIRST + WM_COMMAND];
BOOL CanClose();
};
class _CLASSTYPE TMDIClient : public TWindow
{
CLIENTCREATESTRUCT ClientData;
public:
PTMDIFrame pFrame;
TMDIClient(PTMDIFrame);
WOLFid Identify() { return mdiclientClass; }
BOOL Create();
};
class _CLASSTYPE TMDIChild : public TWindow
{
BOOL bCreated;
MDICREATESTRUCT ChildData;
public:
int nChildMenuPos;
TMDIChild(PTMDIFrame, LPCSTR);
LONG DefMsgHandler(RTMessage);
BOOL Create();
virtual void WMMDIActivate(RTMessage) = [WM_FIRST + WM_MDIACTIVATE];
virtual void WMNCDestroy(RTMessage) = [WM_FIRST + WM_NCDESTROY];
};
class _CLASSTYPE TDialog : public TWindow
{
protected:
static BOOL CALLBACK _export DlgProc(HWND, UINT, WPARAM, LPARAM);
public:
int nStatus;
TDialog(PTWindowObject, int);
WOLFid Identify() { return dialogClass; }
BOOL Create();
LONG DefMsgHandler(RTMessage);
virtual void WMInitDialog(RTMessage) = [WM_FIRST + WM_INITDIALOG];
virtual LRESULT InitDialog() { return -1; }
virtual void Okay(RTMessage) = [ID_FIRST + IDOK];
virtual void Cancel(RTMessage) = [ID_FIRST + IDCANCEL];
virtual void Destroy(int);
virtual void WMClose(RTMessage) = [WM_FIRST + WM_CLOSE];
WORD GetDefault();
void SetDefault(int);
};
class _CLASSTYPE TModelessDialog : public TDialog
{
protected:
DLGPROC lpfnDlgProc;
public:
TModelessDialog(PTWindowObject, int);
WOLFid Identify() { return modelessdialogClass; }
BOOL Create();
void Destroy(int);
};
class _CLASSTYPE TControl : public TWindow
{
protected:
WNDPROC lpfnOldWndProc;
public:
TControl(PTWindowObject, int);
WOLFid Identify() { return controlClass; }
virtual void WMPaint(RTMessage) = [WM_FIRST + WM_PAINT];
WORD Transfer(LPSTR, TransDir) = 0;
BOOL Create();
void SetRedraw(BOOL);
void SubClass();
void UnSubClass();
LONG DefMsgHandler(RTMessage);
};
class _CLASSTYPE TPushButton : public TControl
{
public:
TPushButton(PTWindowObject, int);
WORD Transfer(LPSTR, TransDir)
{
return 0;
}
};
class _CLASSTYPE TGroupBox : public TPushButton
{
public:
TGroupBox(PTWindowObject, int);
};
#define checkboxTFSize sizeof(UINT)
#define BF_UNCHECKED 0
#define BF_CHECKED 1
#define BF_GRAYED 2
class _CLASSTYPE TCheckBox : public TPushButton
{
public:
TCheckBox(PTWindowObject, int);
WORD Transfer(LPSTR, TransDir);
virtual int GetCheck();
virtual void SetCheck(int);
};
#define radiobuttonTFSize sizeof(UINT)
class _CLASSTYPE TRadioButton : public TCheckBox
{
protected:
int nStartID, nEndID;
public:
TRadioButton(PTWindowObject, int, int, int);
int GetCheck();
void SetCheck(int);
};
class _CLASSTYPE TStatic : public TControl
{
protected:
WORD static_editTFSize;
public:
TStatic(PTWindowObject, int, WORD);
WORD Transfer(LPSTR, TransDir);
};
class _CLASSTYPE TEdit : public TStatic
{
public:
TEdit(PTWindowObject, int, WORD);
BOOL CanUndo();
void ClearUndoBuffer();
void EnableSoftLineBreak(BOOL);
void GetLine(int, LPSTR, int);
int GetNumLines();
BOOL IsModified();
void SetModified(BOOL);
char GetPasswordChar();
void SetPasswordChar(char);
DWORD GetSel(LPSTR=NULL, int=0);
void LimitText(int);
int GetLineFromChar(int);
int GetLineIndex(int);
int GetLineLength(int);
void Scroll(int, int);
void ReplaceSel(LPCSTR);
void SetReadOnly(BOOL);
void SetSel(int, int);
void SetTabs(const int _FAR *, int);
void Undo();
void Cut();
void Copy();
void Paste();
void ClearSel();
void GetBoundRect(LPRECT);
void SetBoundRect(const RECT _FAR *, BOOL);
};
class _CLASSTYPE TListBox : public TControl
{
protected:
BOOL bIsListBox;
public:
TListBox(PTWindowObject, int);
WORD Transfer(LPSTR, TransDir);
int AddString(LPCSTR);
void ClearList();
int DeleteString(int);
int FindExactString(LPCSTR, int);
int FindString(LPCSTR, int);
int GetCount();
int GetSelCount();
int GetSelIndex();
int GetSelIndices(int _FAR *, int);
int GetSelString(LPSTR, int);
int GetSelStrings(LPSTR*, int, int);
int GetString(LPSTR, int, int);
int GetStringLen(int);
int InsertString(LPCSTR, int);
int SetSelIndex(int);
void SetSelIndices(const int _FAR *, int, BOOL);
int SetSelString(LPCSTR, int);
void SetSelStrings(LPCSTR*, int);
int GetXExtent();
void SetXExtent(int);
int GetItemHeight(int=0);
int SetItemHeight(int,int=0);
};
class _CLASSTYPE TComboBox : public TListBox
{
public:
TComboBox(PTWindowObject, int);
int GetEditSel(int _FAR &, int _FAR &);
int SetEditSel(int, int);
int ShowList(BOOL);
};
#define scrollbarTFSize sizeof(TScrollBarData)
_CLASSDEF(TScrollBarData)
struct TScrollBarData
{
int nMin;
int nMax;
int nPos;
};
class _CLASSTYPE TScrollBar : public TControl
{
protected:
int nPage;
int nLine;
BOOL bThumbTrackEnabled;
public:
TScrollBar(PTWindowObject, int);
WORD Transfer(LPSTR, TransDir);
void SetRange(int, int, BOOL=FALSE);
void GetRange(int _FAR &, int _FAR &);
void SetPos(int, BOOL=TRUE);
int GetPos();
void SetPage(int);
void SetLine(int);
void DeltaScroll(int);
void DoScroll(RTMessage);
void EnableThumbTrack(BOOL);
virtual void PageUp();
virtual void PageDown();
virtual void LineUp();
virtual void LineDown();
virtual void ThumbPosition(RTMessage);
virtual void ThumbTrack(RTMessage);
virtual void EndScroll();
};
class _CLASSTYPE TInputDialog : public TDialog
{
protected:
LPCSTR lpszQuery;
LPSTR lpszBuffer;
int nBufLen;
public:
TInputDialog(PTWindowObject, LPCSTR, LPSTR, int);
BOOL Create();
LRESULT InitDialog();
};
_CLASSDEF(FileDlgData)
struct FileDlgData
{
LPSTR lpszFilters;
DWORD dwFilterIndex;
LPSTR lpszFile;
DWORD dwMaxFile;
LPSTR lpszFileTitle;
DWORD dwMaxFileTitle;
LPCSTR lpszInitialDir;
UINT uFileOffset;
UINT uExtOffset;
LPCSTR lpszDefExt;
};
class _CLASSTYPE TFileDialog : public TDialog
{
protected:
OPENFILENAME ofn;
PFileDlgData pfdd;
int nType;
void RereadFiles();
public:
TFileDialog(PTWindowObject, int, RFileDlgData);
BOOL Create();
virtual void IDDelete(RTMessage) = [ID_FIRST + 2000];
virtual void IDRename(RTMessage) = [ID_FIRST + 2001];
virtual void IDCopy(RTMessage) = [ID_FIRST + 2002];
virtual void Okay(RTMessage) = [ID_FIRST + IDOK];
virtual void Cancel(RTMessage) = [ID_FIRST + IDCANCEL];
virtual void WMCommand(RTMessage) = [WM_FIRST + WM_COMMAND];
void Destroy(int);
};
class _CLASSTYPE TApplication
{
protected:
int nCmdShow;
HACCEL hAccel;
public:
PTWindowObject pMainWindow;
LPCSTR lpszClassName;
HINSTANCE hInstance, hPrevInstance;
LPSTR lpszCmdLine;
int nStatus;
TApplication(LPCSTR, HINSTANCE, HINSTANCE, LPSTR, int);
virtual ~TApplication();
virtual void InitMainWindow() = 0;
void Run();
void AssignAccel(int);
void AssignAccel(LPCSTR);
int ExecDialog(PTDialog);
int Input(PTWindowObject, LPSTR, int, LPCSTR, ...);
int FileOpen(PTWindowObject, RFileDlgData);
int FileSave(PTWindowObject, RFileDlgData);
virtual void Idle();
int MsgBox(PTWindowObject, UINT, LPCSTR, LPCSTR, ...);
virtual BOOL ProcessMsgs(MSG _FAR &);
virtual BOOL ProcessDlgMsgs(MSG _FAR &);
virtual BOOL ProcessAccels(MSG _FAR &);
virtual BOOL ProcessMDIAccels(MSG _FAR &);
};
enum ToolBarBtnType { NORMAL, THREESTATE };
_CLASSDEF(TToolBarInfo)
struct TToolBarInfo
{
int nID;
ToolBarBtnType nType;
BOOL bDown;
HBITMAP hBmp[4];
BOOL bReserved;
};
class _CLASSTYPE TToolBar : public TWindow
{
BOOL bDone;
HBITMAP hPatBmp;
protected:
int nNumButtons;
int nHeight, nWidth;
HBITMAP DuplicateBitmap(HBITMAP);
void DrawBitmap(HDC, HBITMAP, DWORD);
public:
int nMaxWidth;
PTToolBarInfo pInfo;
TToolBar(PTWindowObject, LPCSTR, PTToolBarInfo, int);
~TToolBar();
void AddButton(PTToolBarInfo,int=0);
void RemoveButton(int);
void SetState(int, BOOL);
int GetPos(int);
void SetType(int, ToolBarBtnType);
void SetBitmap(int, int, HBITMAP);
virtual PTPushButton ConstructButton(int);
virtual void CalcWindowSize(int, int, int&, int&);
virtual void WMSize(RTMessage) = [WM_FIRST + WM_SIZE];
virtual void WMDrawItem(RTMessage) = [WM_FIRST + WM_DRAWITEM];
virtual void WMGetMinMaxInfo(RTMessage) = [WM_FIRST + WM_GETMINMAXINFO];
virtual void WMCommand(RTMessage) = [WM_FIRST + WM_COMMAND];
};
//Global functions
typedef void (_FAR *MRFUNCTION)(PTWindowObject, RTMessage);
//the following function is built into the BORLANDC libraries, but is not
//prototyped anywhere. Its parameters were determined from TLIB and looking
//at compiled code for return value.
MRFUNCTION _DDVTdispatchNULL(LPVOID, int);
LONG _FAR UMP(RTMessage);
void _export _FAR SetGlobalWindowObject(PTWindowObject);
#endif //__WOLF_H