1 | /* $Id: windlg.cpp,v 1.1 1999-07-18 10:39:52 sandervl Exp $ */
|
---|
2 | /*
|
---|
3 | * Win32 dialog apis for OS/2
|
---|
4 | *
|
---|
5 | * Copyright 1999 Sander van Leeuwen
|
---|
6 | *
|
---|
7 | *
|
---|
8 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
9 | *
|
---|
10 | */
|
---|
11 | #include <os2win.h>
|
---|
12 | #include <misc.h>
|
---|
13 | #include <string.h>
|
---|
14 | #include <stdlib.h>
|
---|
15 |
|
---|
16 | //******************************************************************************
|
---|
17 | //******************************************************************************
|
---|
18 | BOOL WIN32API IsDlgButtonChecked( HWND arg1, UINT arg2)
|
---|
19 | {
|
---|
20 | #ifdef DEBUG
|
---|
21 | WriteLog("USER32: IsDlgButtonChecked\n");
|
---|
22 | #endif
|
---|
23 | //CB: get button state
|
---|
24 | return (BOOL)SendDlgItemMessageA(arg1,arg2,BM_GETCHECK,0,0);
|
---|
25 | }
|
---|
26 | //******************************************************************************
|
---|
27 | //******************************************************************************
|
---|
28 | HWND WIN32API GetNextDlgTabItem( HWND arg1, HWND arg2, BOOL arg3)
|
---|
29 | {
|
---|
30 | dprintf(("USER32: GetNextDlgTabItem\n"));
|
---|
31 | //get next WS_TABSTOP
|
---|
32 | return O32_GetNextDlgTabItem(arg1, arg2, arg3);
|
---|
33 | }
|
---|
34 | //******************************************************************************
|
---|
35 | //******************************************************************************
|
---|
36 | HWND WIN32API GetDlgItem(HWND arg1, int arg2)
|
---|
37 | {
|
---|
38 | HWND rc;
|
---|
39 | //return OSLibWinWindowFromID(arg1,arg2);
|
---|
40 | rc = O32_GetDlgItem(arg1, arg2);
|
---|
41 | dprintf(("USER32: GetDlgItem %d returned %d\n", arg2, rc));
|
---|
42 | return(rc);
|
---|
43 | }
|
---|
44 | //******************************************************************************
|
---|
45 | //******************************************************************************
|
---|
46 | int WIN32API GetDlgCtrlID( HWND arg1)
|
---|
47 | {
|
---|
48 | dprintf(("USER32: GetDlgCtrlID\n"));
|
---|
49 | //return OSLibWinQueryWindowUShort(arg1,QWS_ID);
|
---|
50 | //use internal ID -> DWORD
|
---|
51 | return O32_GetDlgCtrlID(arg1);
|
---|
52 | }
|
---|
53 | //******************************************************************************
|
---|
54 | //******************************************************************************
|
---|
55 | BOOL WIN32API EndDialog( HWND arg1, int arg2)
|
---|
56 | {
|
---|
57 | BOOL rc;
|
---|
58 |
|
---|
59 | dprintf(("USER32: EndDialog\n"));
|
---|
60 | //return OSLibDismissDialog(arg1,arg2);
|
---|
61 | rc = O32_EndDialog(arg1, arg2);
|
---|
62 | return(rc);
|
---|
63 | }
|
---|
64 | //******************************************************************************
|
---|
65 | //******************************************************************************
|
---|
66 | BOOL WIN32API CheckDlgButton( HWND arg1, int arg2, UINT arg3)
|
---|
67 | {
|
---|
68 | #ifdef DEBUG
|
---|
69 | WriteLog("USER32: CheckDlgButton\n");
|
---|
70 | #endif
|
---|
71 | //CB: set button state
|
---|
72 | return (BOOL)SendDlgItemMessageA(arg1,arg2,BM_SETCHECK,arg3,0);
|
---|
73 | }
|
---|
74 | //******************************************************************************
|
---|
75 | //******************************************************************************
|
---|
76 | UINT WIN32API GetDlgItemTextA(HWND arg1, int arg2, LPSTR arg3, UINT arg4)
|
---|
77 | {
|
---|
78 | UINT rc;
|
---|
79 |
|
---|
80 | //WinQueryDlgItemText(arg1,arg2,arg4,arg3);
|
---|
81 | rc = O32_GetDlgItemText(arg1, arg2, arg3, arg4);
|
---|
82 | #ifdef DEBUG
|
---|
83 | if(rc)
|
---|
84 | WriteLog("USER32: GetDlgItemTextA returned %s\n", arg3);
|
---|
85 | else WriteLog("USER32: GetDlgItemTextA returned 0 (%d)\n", GetLastError());
|
---|
86 | #endif
|
---|
87 | return(rc);
|
---|
88 | }
|
---|
89 | //******************************************************************************
|
---|
90 | //******************************************************************************
|
---|
91 | BOOL WIN32API SetDlgItemInt( HWND arg1, int arg2, UINT arg3, BOOL arg4)
|
---|
92 | {
|
---|
93 | #ifdef DEBUG
|
---|
94 | WriteLog("USER32: SetDlgItemInt\n");
|
---|
95 | #endif
|
---|
96 | //get item text and translate to int
|
---|
97 | return O32_SetDlgItemInt(arg1, arg2, arg3, arg4);
|
---|
98 | }
|
---|
99 | //******************************************************************************
|
---|
100 | //******************************************************************************
|
---|
101 | BOOL WIN32API SetDlgItemTextA( HWND arg1, int arg2, LPCSTR arg3)
|
---|
102 | {
|
---|
103 | #ifdef DEBUG
|
---|
104 | WriteLog("USER32: SetDlgItemText to %s\n", arg3);
|
---|
105 | #endif
|
---|
106 | //WinSetDlgItemText(arg1,arg2,arg3);
|
---|
107 | return O32_SetDlgItemText(arg1, arg2, arg3);
|
---|
108 | }
|
---|
109 | //******************************************************************************
|
---|
110 | //******************************************************************************
|
---|
111 | int WIN32API DlgDirListA( HWND arg1, LPSTR arg2, int arg3, int arg4, UINT arg5)
|
---|
112 | {
|
---|
113 | #ifdef DEBUG
|
---|
114 | WriteLog("USER32: DlgDirListA\n");
|
---|
115 | #endif
|
---|
116 | return O32_DlgDirList(arg1, arg2, arg3, arg4, arg5);
|
---|
117 | }
|
---|
118 | //******************************************************************************
|
---|
119 | //******************************************************************************
|
---|
120 | int WIN32API DlgDirListComboBoxA( HWND arg1, LPSTR arg2, int arg3, int arg4, UINT arg5)
|
---|
121 | {
|
---|
122 | #ifdef DEBUG
|
---|
123 | WriteLog("USER32: DlgDirListComboBoxA\n");
|
---|
124 | #endif
|
---|
125 | return O32_DlgDirListComboBox(arg1, arg2, arg3, arg4, arg5);
|
---|
126 | }
|
---|
127 | //******************************************************************************
|
---|
128 | //******************************************************************************
|
---|
129 | int WIN32API DlgDirListComboBoxW( HWND arg1, LPWSTR arg2, int arg3, int arg4, UINT arg5)
|
---|
130 | {
|
---|
131 | #ifdef DEBUG
|
---|
132 | WriteLog("USER32: DlgDirListComboBoxW NOT WORKING\n");
|
---|
133 | #endif
|
---|
134 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
135 | return 0;
|
---|
136 | // return O32_DlgDirListComboBox(arg1, arg2, arg3, arg4, arg5);
|
---|
137 | }
|
---|
138 | //******************************************************************************
|
---|
139 | //******************************************************************************
|
---|
140 | int WIN32API DlgDirListW( HWND arg1, LPWSTR arg2, int arg3, int arg4, UINT arg5)
|
---|
141 | {
|
---|
142 | #ifdef DEBUG
|
---|
143 | WriteLog("USER32: DlgDirListW NOT WORKING\n");
|
---|
144 | #endif
|
---|
145 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
146 | return 0;
|
---|
147 | // return O32_DlgDirList(arg1, arg2, arg3, arg4, arg5);
|
---|
148 | }
|
---|
149 | //******************************************************************************
|
---|
150 | //******************************************************************************
|
---|
151 | BOOL WIN32API DlgDirSelectComboBoxExA( HWND arg1, LPSTR arg2, int arg3, int arg4)
|
---|
152 | {
|
---|
153 | #ifdef DEBUG
|
---|
154 | WriteLog("USER32: DlgDirSelectComboBoxExA\n");
|
---|
155 | #endif
|
---|
156 | return O32_DlgDirSelectComboBoxEx(arg1, arg2, arg3, arg4);
|
---|
157 | }
|
---|
158 | //******************************************************************************
|
---|
159 | //******************************************************************************
|
---|
160 | BOOL WIN32API DlgDirSelectComboBoxExW( HWND arg1, LPWSTR arg2, int arg3, int arg4)
|
---|
161 | {
|
---|
162 | #ifdef DEBUG
|
---|
163 | WriteLog("USER32: DlgDirSelectComboBoxExW NOT WORKING\n");
|
---|
164 | #endif
|
---|
165 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
166 | return 0;
|
---|
167 | // return O32_DlgDirSelectComboBoxEx(arg1, arg2, arg3, arg4);
|
---|
168 | }
|
---|
169 | //******************************************************************************
|
---|
170 | //******************************************************************************
|
---|
171 | BOOL WIN32API DlgDirSelectExA( HWND arg1, LPSTR arg2, int arg3, int arg4)
|
---|
172 | {
|
---|
173 | #ifdef DEBUG
|
---|
174 | WriteLog("USER32: DlgDirSelectExA\n");
|
---|
175 | #endif
|
---|
176 | return O32_DlgDirSelectEx(arg1, arg2, arg3, arg4);
|
---|
177 | }
|
---|
178 | //******************************************************************************
|
---|
179 | //******************************************************************************
|
---|
180 | BOOL WIN32API DlgDirSelectExW( HWND arg1, LPWSTR arg2, int arg3, int arg4)
|
---|
181 | {
|
---|
182 | #ifdef DEBUG
|
---|
183 | WriteLog("USER32: DlgDirSelectExW NOT WORKING\n");
|
---|
184 | #endif
|
---|
185 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
186 | return 0;
|
---|
187 | // return O32_DlgDirSelectEx(arg1, arg2, arg3, arg4);
|
---|
188 | }
|
---|
189 | //******************************************************************************
|
---|
190 | //******************************************************************************
|
---|
191 | DWORD WIN32API GetDialogBaseUnits(void)
|
---|
192 | {
|
---|
193 | #ifdef DEBUG
|
---|
194 | WriteLog("USER32: GetDialogBaseUnits\n");
|
---|
195 | #endif
|
---|
196 | return O32_GetDialogBaseUnits();
|
---|
197 | }
|
---|
198 | //******************************************************************************
|
---|
199 | //******************************************************************************
|
---|
200 | UINT WIN32API GetDlgItemInt( HWND arg1, int arg2, PBOOL arg3, BOOL arg4)
|
---|
201 | {
|
---|
202 | #ifdef DEBUG
|
---|
203 | WriteLog("USER32: GetDlgItemInt\n");
|
---|
204 | #endif
|
---|
205 | return O32_GetDlgItemInt(arg1, arg2, arg3, arg4);
|
---|
206 | }
|
---|
207 |
|
---|
208 |
|
---|
209 | /*****************************************************************************
|
---|
210 | * Name : UINT WIN32API GetDlgItemTextW
|
---|
211 | * Purpose : Determine the text of a window control
|
---|
212 | * Parameters: HWND arg1
|
---|
213 | * int arg2
|
---|
214 | * LPWSTR arg3
|
---|
215 | * UINT arg4
|
---|
216 | * Variables :
|
---|
217 | * Result :
|
---|
218 | * Remark :
|
---|
219 | * Status : UNTESTED UNKNOWN STUB
|
---|
220 | *
|
---|
221 | * Author : Patrick Haller [Wed, 1998/06/16 11:55]
|
---|
222 | *****************************************************************************/
|
---|
223 |
|
---|
224 | UINT WIN32API GetDlgItemTextW(HWND arg1,
|
---|
225 | int arg2,
|
---|
226 | LPWSTR arg3,
|
---|
227 | UINT arg4)
|
---|
228 | {
|
---|
229 | LPSTR lpBuffer; /* temporary buffer for the ascii result */
|
---|
230 | UINT uiResult; /* return value of the ascii variant */
|
---|
231 |
|
---|
232 | dprintf(("USER32: GetDlgItemTextW(%08xh,%08xh,%08xh,%08xh)\n",
|
---|
233 | arg1,
|
---|
234 | arg2,
|
---|
235 | arg3,
|
---|
236 | arg4));
|
---|
237 |
|
---|
238 |
|
---|
239 | lpBuffer = (LPSTR)malloc(arg4); /* allocate temporary buffer */
|
---|
240 | uiResult = GetDlgItemTextA(arg1, /* call ascii variant */
|
---|
241 | arg2,
|
---|
242 | lpBuffer,
|
---|
243 | arg4);
|
---|
244 |
|
---|
245 | AsciiToUnicodeN(lpBuffer, /* now convert result to unicode */
|
---|
246 | arg3,
|
---|
247 | arg4);
|
---|
248 |
|
---|
249 | free(lpBuffer); /* free the temporary buffer */
|
---|
250 |
|
---|
251 | return (uiResult); /* OK, that's it */
|
---|
252 | }
|
---|
253 | //******************************************************************************
|
---|
254 | //******************************************************************************
|
---|
255 | HWND WIN32API GetNextDlgGroupItem( HWND arg1, HWND arg2, BOOL arg3)
|
---|
256 | {
|
---|
257 | #ifdef DEBUG
|
---|
258 | WriteLog("USER32: GetNextDlgGroupItem\n");
|
---|
259 | #endif
|
---|
260 | return O32_GetNextDlgGroupItem(arg1, arg2, arg3);
|
---|
261 | }
|
---|
262 | //******************************************************************************
|
---|
263 | //******************************************************************************
|
---|
264 | BOOL WIN32API SetDlgItemTextW( HWND arg1, int arg2, LPCWSTR arg3)
|
---|
265 | {
|
---|
266 | char *astring = UnicodeToAsciiString((LPWSTR)arg3);
|
---|
267 | BOOL rc;
|
---|
268 |
|
---|
269 | #ifdef DEBUG
|
---|
270 | WriteLog("USER32: SetDlgItemTextW\n");
|
---|
271 | #endif
|
---|
272 | // NOTE: This will not work as is (needs UNICODE support)
|
---|
273 | rc = O32_SetDlgItemText(arg1, arg2, astring);
|
---|
274 | FreeAsciiString(astring);
|
---|
275 | return rc;
|
---|
276 | }
|
---|
277 | //******************************************************************************
|
---|
278 | //******************************************************************************
|
---|