1 | /* $Id: dialog.cpp,v 1.9 1999-09-15 23:18:49 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 dialog API functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1999 Sander van Leeuwen (Wine port & OS/2 adaption)
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Based on Wine code (990815; windows\dialog.c)
|
---|
10 | *
|
---|
11 | * Copyright 1993, 1994, 1996 Alexandre Julliard
|
---|
12 | *
|
---|
13 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
14 | *
|
---|
15 | */
|
---|
16 | #include <os2win.h>
|
---|
17 | #include "win32wbase.h"
|
---|
18 | #include "win32dlg.h"
|
---|
19 |
|
---|
20 | //******************************************************************************
|
---|
21 | //******************************************************************************
|
---|
22 | HWND WIN32API CreateDialogParamA(HINSTANCE hInst, LPCSTR lpszTemplate,
|
---|
23 | HWND hwndOwner, DLGPROC dlgproc,
|
---|
24 | LPARAM lParamInit)
|
---|
25 | {
|
---|
26 | HANDLE hrsrc = FindResourceA( hInst, lpszTemplate, RT_DIALOGA );
|
---|
27 |
|
---|
28 | if (!hrsrc)
|
---|
29 | return 0;
|
---|
30 |
|
---|
31 | return CreateDialogIndirectParamA(hInst, (DLGTEMPLATE*)LoadResource(hInst, hrsrc),
|
---|
32 | hwndOwner, dlgproc, lParamInit);
|
---|
33 | }
|
---|
34 | //******************************************************************************
|
---|
35 | //******************************************************************************
|
---|
36 | HWND WIN32API CreateDialogParamW(HINSTANCE hInst, LPCWSTR lpszTemplate,
|
---|
37 | HWND hwndOwner, DLGPROC dlgproc,
|
---|
38 | LPARAM lParamInit)
|
---|
39 | {
|
---|
40 | HANDLE hrsrc = FindResourceW( hInst, lpszTemplate, RT_DIALOGW );
|
---|
41 |
|
---|
42 | if (!hrsrc)
|
---|
43 | return 0;
|
---|
44 |
|
---|
45 | return CreateDialogIndirectParamW(hInst, (DLGTEMPLATE*)LoadResource(hInst, hrsrc),
|
---|
46 | hwndOwner, dlgproc, lParamInit);
|
---|
47 | }
|
---|
48 | //******************************************************************************
|
---|
49 | //******************************************************************************
|
---|
50 | HWND WIN32API CreateDialogIndirectParamA(HINSTANCE hInst,
|
---|
51 | DLGTEMPLATE *dlgtemplate,
|
---|
52 | HWND hwndParent, DLGPROC dlgproc,
|
---|
53 | LPARAM lParamInit)
|
---|
54 | {
|
---|
55 | Win32Dialog *dialog;
|
---|
56 |
|
---|
57 | dprintf(("CreateDialogIndirectParamA: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit));
|
---|
58 |
|
---|
59 | if (!dlgtemplate) return 0;
|
---|
60 |
|
---|
61 | dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, FALSE);
|
---|
62 |
|
---|
63 | if(dialog == NULL)
|
---|
64 | {
|
---|
65 | dprintf(("Win32Dialog creation failed!!"));
|
---|
66 | return 0;
|
---|
67 | }
|
---|
68 | if(GetLastError() != 0)
|
---|
69 | {
|
---|
70 | dprintf(("Win32Dialog error found!!"));
|
---|
71 | delete dialog;
|
---|
72 | return 0;
|
---|
73 | }
|
---|
74 | return dialog->getWindowHandle();
|
---|
75 | }
|
---|
76 | //******************************************************************************
|
---|
77 | //******************************************************************************
|
---|
78 | HWND WIN32API CreateDialogIndirectParamW(HINSTANCE hInst,
|
---|
79 | DLGTEMPLATE *dlgtemplate,
|
---|
80 | HWND hwndParent, DLGPROC dlgproc,
|
---|
81 | LPARAM lParamInit)
|
---|
82 | {
|
---|
83 | Win32Dialog *dialog;
|
---|
84 |
|
---|
85 | dprintf(("CreateDialogIndirectParamW: %x %x %x %x %x", hInst, dlgtemplate, hwndParent, dlgproc, lParamInit));
|
---|
86 |
|
---|
87 | if (!dlgtemplate) return 0;
|
---|
88 |
|
---|
89 | dialog = new Win32Dialog(hInst, (LPCSTR)dlgtemplate, hwndParent, dlgproc, lParamInit, TRUE);
|
---|
90 |
|
---|
91 | if(dialog == NULL)
|
---|
92 | {
|
---|
93 | dprintf(("Win32Dialog creation failed!!"));
|
---|
94 | return 0;
|
---|
95 | }
|
---|
96 | if(GetLastError() != 0)
|
---|
97 | {
|
---|
98 | dprintf(("Win32Dialog error found!!"));
|
---|
99 | delete dialog;
|
---|
100 | return 0;
|
---|
101 | }
|
---|
102 | return dialog->getWindowHandle();
|
---|
103 | }
|
---|
104 | //******************************************************************************
|
---|
105 | //******************************************************************************
|
---|
106 | INT WIN32API DialogBoxIndirectParamA(HINSTANCE hInst,
|
---|
107 | DLGTEMPLATE *dlgtemplate,
|
---|
108 | HWND hwndParent, DLGPROC dlgproc,
|
---|
109 | LPARAM lParamInit)
|
---|
110 | {
|
---|
111 | HWND hwnd = CreateDialogIndirectParamA(hInst, dlgtemplate, hwndParent, dlgproc,
|
---|
112 | lParamInit);
|
---|
113 | //TODO:
|
---|
114 | if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
|
---|
115 | return -1;
|
---|
116 | }
|
---|
117 | //******************************************************************************
|
---|
118 | //******************************************************************************
|
---|
119 | INT WIN32API DialogBoxIndirectParamW(HINSTANCE hInst, DLGTEMPLATE *dlgtemplate,
|
---|
120 | HWND hwndParent, DLGPROC dlgproc,
|
---|
121 | LPARAM lParamInit)
|
---|
122 | {
|
---|
123 | HWND hwnd = CreateDialogIndirectParamW(hInst, dlgtemplate, hwndParent, dlgproc,
|
---|
124 | lParamInit);
|
---|
125 | //TODO:
|
---|
126 | if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
|
---|
127 | return -1;
|
---|
128 | }
|
---|
129 | //******************************************************************************
|
---|
130 | //******************************************************************************
|
---|
131 | int WIN32API DialogBoxParamA(HINSTANCE hInst, LPCSTR lpszTemplate, HWND hwndOwner,
|
---|
132 | DLGPROC dlgproc, LPARAM lParamInit)
|
---|
133 | {
|
---|
134 | HWND hwnd = CreateDialogParamA( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit);
|
---|
135 | //TODO:
|
---|
136 | if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
|
---|
137 | return -1;
|
---|
138 | }
|
---|
139 | //******************************************************************************
|
---|
140 | //******************************************************************************
|
---|
141 | int WIN32API DialogBoxParamW(HINSTANCE hInst, LPCWSTR lpszTemplate, HWND hwndOwner,
|
---|
142 | DLGPROC dlgproc, LPARAM lParamInit)
|
---|
143 | {
|
---|
144 | HWND hwnd = CreateDialogParamW( hInst, lpszTemplate, hwndOwner, dlgproc, lParamInit);
|
---|
145 | //TODO:
|
---|
146 | if (hwnd) return 1; //return DIALOG_DoDialogBox( hwnd, owner );
|
---|
147 | return -1;
|
---|
148 | }
|
---|
149 | //******************************************************************************
|
---|
150 | //******************************************************************************
|
---|
151 |
|
---|