1 | /* $Id: win32dlg.h,v 1.7 1999-10-31 01:14:42 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 Dialog Code for OS/2
|
---|
4 | *
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #ifndef __WIN32DLG_H__
|
---|
13 | #define __WIN32DLG_H__
|
---|
14 |
|
---|
15 | #include <win32wbase.h>
|
---|
16 |
|
---|
17 | #ifdef __cplusplus
|
---|
18 |
|
---|
19 | #define DF_END 0x0001
|
---|
20 |
|
---|
21 | /* Dialog control information */
|
---|
22 | typedef struct
|
---|
23 | {
|
---|
24 | DWORD style;
|
---|
25 | DWORD exStyle;
|
---|
26 | DWORD helpId;
|
---|
27 | INT x;
|
---|
28 | INT y;
|
---|
29 | INT cx;
|
---|
30 | INT cy;
|
---|
31 | UINT id;
|
---|
32 | LPCSTR className;
|
---|
33 | LPCSTR windowName;
|
---|
34 | LPVOID data;
|
---|
35 | } DLG_CONTROL_INFO;
|
---|
36 |
|
---|
37 | /* Dialog template */
|
---|
38 | typedef struct
|
---|
39 | {
|
---|
40 | DWORD style;
|
---|
41 | DWORD exStyle;
|
---|
42 | DWORD helpId;
|
---|
43 | UINT nbItems;
|
---|
44 | INT x;
|
---|
45 | INT y;
|
---|
46 | INT cx;
|
---|
47 | INT cy;
|
---|
48 | LPCSTR menuName;
|
---|
49 | LPCSTR className;
|
---|
50 | LPCSTR caption;
|
---|
51 | WORD pointSize;
|
---|
52 | WORD weight;
|
---|
53 | BOOL italic;
|
---|
54 | LPCSTR faceName;
|
---|
55 | BOOL dialogEx;
|
---|
56 | } DLG_TEMPLATE;
|
---|
57 |
|
---|
58 | class Win32Dialog : public Win32BaseWindow
|
---|
59 | {
|
---|
60 | public:
|
---|
61 | Win32Dialog(HINSTANCE hInst, LPCSTR dlgTemplate, HWND owner,
|
---|
62 | DLGPROC dlgProc, LPARAM param, BOOL isUnicode);
|
---|
63 |
|
---|
64 | virtual ~Win32Dialog();
|
---|
65 |
|
---|
66 | LRESULT DefDlgProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
67 | LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam);
|
---|
68 |
|
---|
69 | Win32BaseWindow *getDlgItem(int id) { return FindWindowById(id); };
|
---|
70 |
|
---|
71 | BOOL endDialog(int retval);
|
---|
72 |
|
---|
73 | BOOL MapDialogRect(LPRECT rect);
|
---|
74 |
|
---|
75 | virtual ULONG MsgCreate(HWND hwndFrame, HWND hwndClient);
|
---|
76 |
|
---|
77 | virtual LONG SetWindowLongA(int index, ULONG value);
|
---|
78 | virtual ULONG GetWindowLongA(int index);
|
---|
79 |
|
---|
80 | static ULONG GetDialogBaseUnits() { return MAKELONG(xBaseUnit, yBaseUnit); };
|
---|
81 |
|
---|
82 | INT doDialogBox();
|
---|
83 |
|
---|
84 | protected:
|
---|
85 | BOOL DIALOG_Init(void);
|
---|
86 | BOOL getCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize );
|
---|
87 | BOOL getCharSize( HFONT hFont, SIZE * pSize);
|
---|
88 | LPCSTR parseTemplate( LPCSTR dlgtemplate, DLG_TEMPLATE *result);
|
---|
89 | WORD *getControl(const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx);
|
---|
90 | BOOL createControls(LPCSTR dlgtemplate, HINSTANCE hInst);
|
---|
91 |
|
---|
92 | LRESULT DefDlg_Proc(UINT msg, WPARAM wParam, LPARAM lParam);
|
---|
93 | LRESULT DefDlg_Epilog(UINT msg, BOOL fResult);
|
---|
94 |
|
---|
95 | BOOL setDefButton(HWND hwndNew );
|
---|
96 | HWND findDefButton();
|
---|
97 | BOOL saveFocus();
|
---|
98 | BOOL restoreFocus();
|
---|
99 | void setFocus(HWND hwndCtrl );
|
---|
100 |
|
---|
101 | // values normally contained in the standard dialog words
|
---|
102 | DLGPROC Win32DlgProc; //DWL_WNDPROC
|
---|
103 | ULONG msgResult; //DWL_MSGRESULT
|
---|
104 | ULONG userDlgData; //DWL_USER
|
---|
105 |
|
---|
106 | DLG_TEMPLATE dlgInfo;
|
---|
107 | WORD xUnit;
|
---|
108 | WORD yUnit;
|
---|
109 | HWND hwndFocus;
|
---|
110 | HFONT hUserFont;
|
---|
111 | HMENU hMenu;
|
---|
112 | DWORD idResult;
|
---|
113 | DWORD dialogFlags;
|
---|
114 |
|
---|
115 | DWORD tmpParam; //set in ctor, used in MsgCreate method
|
---|
116 | LPSTR tmpDlgTemplate; //set in ctor, used in MsgCreate method
|
---|
117 | private:
|
---|
118 | static BOOL fInitialized;
|
---|
119 | static int xBaseUnit;
|
---|
120 | static int yBaseUnit;
|
---|
121 | };
|
---|
122 |
|
---|
123 | /* Built-in class names (see _Undocumented_Windows_ p.418) */
|
---|
124 | #define DIALOG_CLASS_NAMEA "#32770" /* Dialog */
|
---|
125 | #define DIALOG_CLASS_NAMEW L"#32770" /* Dialog */
|
---|
126 | #define DIALOG_CLASS_ATOM 32770 /* Dialog */
|
---|
127 |
|
---|
128 | BOOL DIALOG_Register();
|
---|
129 | BOOL DIALOG_Unregister();
|
---|
130 |
|
---|
131 | #endif //__cplusplus
|
---|
132 |
|
---|
133 | #endif //__WIN32WND_H__
|
---|