source: trunk/src/user32/win32dlg.h@ 10366

Last change on this file since 10366 was 9366, checked in by sandervl, 23 years ago

PF: Fixed creation of dialog with CreateWindowExA/W

File size: 3.5 KB
Line 
1/* $Id: win32dlg.h,v 1.15 2002-10-28 19:59:52 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 */
22typedef 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/* Some home-brewen dialog template
38 TODO: redo this and make it standart one */
39typedef struct
40{
41 DWORD style;
42 DWORD exStyle;
43 WORD nbItems;
44 short x;
45 short y;
46 short cx;
47 short cy;
48 DWORD helpId;
49 LPCSTR menuName;
50 LPCSTR className;
51 LPCSTR caption;
52 WORD pointSize;
53 WORD weight;
54 BOOL italic;
55 LPCSTR faceName;
56 BOOL dialogEx;
57} DLG_TEMPLATE;
58
59class Win32Dialog : public Win32BaseWindow
60{
61public:
62 Win32Dialog(HINSTANCE hInst, LPCSTR dlgTemplate, HWND owner,
63 DLGPROC dlgProc, LPARAM param, BOOL isUnicode);
64
65virtual ~Win32Dialog();
66
67 LRESULT DefDlgProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
68 LRESULT DefDlgProcW(UINT Msg, WPARAM wParam, LPARAM lParam);
69
70 HWND getDlgItem(int id) { return FindWindowById(id); };
71
72 BOOL endDialog(int retval);
73
74 BOOL MapDialogRect(LPRECT rect);
75
76virtual ULONG MsgCreate(HWND hwndOS2);
77
78virtual LONG SetWindowLong(int index, ULONG value, BOOL fUnicode);
79virtual ULONG GetWindowLong(int index, BOOL fUnicode);
80
81static ULONG GetDialogBaseUnits() { return MAKELONG(xBaseUnit, yBaseUnit); };
82
83 INT doDialogBox();
84
85protected:
86 BOOL DIALOG_Init(void);
87 BOOL getCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize );
88 BOOL getCharSize( HFONT hFont, SIZE * pSize);
89 LPCSTR parseTemplate( LPCSTR dlgtemplate, DLG_TEMPLATE *result);
90 WORD *getControl(const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx);
91 BOOL createControls(LPCSTR dlgtemplate, HINSTANCE hInst);
92
93 LRESULT DefDlg_Proc(UINT msg, WPARAM wParam, LPARAM lParam);
94 LRESULT DefDlg_Epilog(UINT msg, BOOL fResult);
95
96 BOOL setDefButton(HWND hwndNew );
97 HWND findDefButton();
98 BOOL saveFocus();
99 BOOL restoreFocus();
100 void setFocus(HWND hwndCtrl );
101
102 // values normally contained in the standard dialog words
103 DLGPROC Win32DlgProc; //DWL_WNDPROC
104 ULONG msgResult; //DWL_MSGRESULT
105 ULONG userDlgData; //DWL_USER
106
107 DLG_TEMPLATE dlgInfo;
108 WORD xUnit;
109 WORD yUnit;
110 HWND hwndFocus;
111 HFONT hUserFont;
112 HMENU hMenu;
113 DWORD idResult;
114 DWORD dialogFlags;
115 BOOL fDialogInit;
116
117 DWORD tmpParam; //set in ctor, used in MsgCreate method
118 LPSTR tmpDlgTemplate; //set in ctor, used in MsgCreate method
119
120private:
121 static BOOL fInitialized;
122 static int xBaseUnit;
123 static int yBaseUnit;
124};
125
126/* Built-in class names (see _Undocumented_Windows_ p.418) */
127#define DIALOG_CLASS_NAMEA "#32770" /* Dialog */
128#define DIALOG_CLASS_NAMEW L"#32770" /* Dialog */
129#define DIALOG_CLASS_ATOM 32770 /* Dialog */
130
131BOOL DIALOG_Register();
132BOOL DIALOG_Unregister();
133
134#endif //__cplusplus
135
136#endif //__WIN32WND_H__
Note: See TracBrowser for help on using the repository browser.