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