[8543] | 1 | /*
|
---|
| 2 | * Dialog functions
|
---|
| 3 | *
|
---|
| 4 | * Copyright 1993, 1994, 1996 Alexandre Julliard
|
---|
| 5 | *
|
---|
| 6 | * This library is free software; you can redistribute it and/or
|
---|
| 7 | * modify it under the terms of the GNU Lesser General Public
|
---|
| 8 | * License as published by the Free Software Foundation; either
|
---|
| 9 | * version 2.1 of the License, or (at your option) any later version.
|
---|
| 10 | *
|
---|
| 11 | * This library is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 14 | * Lesser General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU Lesser General Public
|
---|
| 17 | * License along with this library; if not, write to the Free Software
|
---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 19 | */
|
---|
| 20 |
|
---|
| 21 | #include "config.h"
|
---|
| 22 | #include "wine/port.h"
|
---|
| 23 |
|
---|
| 24 | #include <ctype.h>
|
---|
| 25 | #include <errno.h>
|
---|
| 26 | #include <limits.h>
|
---|
| 27 | #include <stdlib.h>
|
---|
| 28 | #include <stdio.h>
|
---|
| 29 | #include <string.h>
|
---|
| 30 |
|
---|
| 31 | #include "windef.h"
|
---|
| 32 | #include "winnls.h"
|
---|
| 33 | #include "winbase.h"
|
---|
| 34 | #include "wingdi.h"
|
---|
| 35 | #include "winuser.h"
|
---|
| 36 | #include "windowsx.h"
|
---|
| 37 | #include "wine/winuser16.h"
|
---|
| 38 | #include "wine/winbase16.h"
|
---|
| 39 | #include "wine/unicode.h"
|
---|
| 40 | #include "controls.h"
|
---|
| 41 | #include "heap.h"
|
---|
| 42 | #include "win.h"
|
---|
| 43 | #include "user.h"
|
---|
| 44 | #include "wine/debug.h"
|
---|
| 45 |
|
---|
| 46 | WINE_DEFAULT_DEBUG_CHANNEL(dialog);
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 | /* Dialog control information */
|
---|
| 50 | typedef struct
|
---|
| 51 | {
|
---|
| 52 | DWORD style;
|
---|
| 53 | DWORD exStyle;
|
---|
| 54 | DWORD helpId;
|
---|
| 55 | INT16 x;
|
---|
| 56 | INT16 y;
|
---|
| 57 | INT16 cx;
|
---|
| 58 | INT16 cy;
|
---|
| 59 | UINT id;
|
---|
| 60 | LPCSTR className;
|
---|
| 61 | LPCSTR windowName;
|
---|
| 62 | LPCVOID data;
|
---|
| 63 | } DLG_CONTROL_INFO;
|
---|
| 64 |
|
---|
| 65 | /* Dialog template */
|
---|
| 66 | typedef struct
|
---|
| 67 | {
|
---|
| 68 | DWORD style;
|
---|
| 69 | DWORD exStyle;
|
---|
| 70 | DWORD helpId;
|
---|
| 71 | UINT16 nbItems;
|
---|
| 72 | INT16 x;
|
---|
| 73 | INT16 y;
|
---|
| 74 | INT16 cx;
|
---|
| 75 | INT16 cy;
|
---|
| 76 | LPCSTR menuName;
|
---|
| 77 | LPCSTR className;
|
---|
| 78 | LPCSTR caption;
|
---|
| 79 | WORD pointSize;
|
---|
| 80 | WORD weight;
|
---|
| 81 | BOOL italic;
|
---|
| 82 | LPCSTR faceName;
|
---|
| 83 | BOOL dialogEx;
|
---|
| 84 | } DLG_TEMPLATE;
|
---|
| 85 |
|
---|
| 86 | /* Radio button group */
|
---|
| 87 | typedef struct
|
---|
| 88 | {
|
---|
| 89 | UINT firstID;
|
---|
| 90 | UINT lastID;
|
---|
| 91 | UINT checkID;
|
---|
| 92 | } RADIOGROUP;
|
---|
| 93 |
|
---|
| 94 | /* Dialog base units */
|
---|
| 95 | static WORD xBaseUnit = 0, yBaseUnit = 0;
|
---|
| 96 |
|
---|
| 97 |
|
---|
| 98 | /*********************************************************************
|
---|
| 99 | * dialog class descriptor
|
---|
| 100 | */
|
---|
| 101 | const struct builtin_class_descr DIALOG_builtin_class =
|
---|
| 102 | {
|
---|
| 103 | DIALOG_CLASS_ATOM, /* name */
|
---|
| 104 | CS_GLOBALCLASS | CS_SAVEBITS, /* style */
|
---|
| 105 | DefDlgProcA, /* procA */
|
---|
| 106 | DefDlgProcW, /* procW */
|
---|
| 107 | DLGWINDOWEXTRA, /* extra */
|
---|
| 108 | IDC_ARROWA, /* cursor */
|
---|
| 109 | 0 /* brush */
|
---|
| 110 | };
|
---|
| 111 |
|
---|
| 112 |
|
---|
| 113 | /***********************************************************************
|
---|
| 114 | * DIALOG_EnableOwner
|
---|
| 115 | *
|
---|
| 116 | * Helper function for modal dialogs to enable again the
|
---|
| 117 | * owner of the dialog box.
|
---|
| 118 | */
|
---|
| 119 | void DIALOG_EnableOwner( HWND hOwner )
|
---|
| 120 | {
|
---|
| 121 | /* Owner must be a top-level window */
|
---|
| 122 | if (hOwner)
|
---|
| 123 | hOwner = GetAncestor( hOwner, GA_ROOT );
|
---|
| 124 | if (!hOwner) return;
|
---|
| 125 | EnableWindow( hOwner, TRUE );
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 | /***********************************************************************
|
---|
| 130 | * DIALOG_DisableOwner
|
---|
| 131 | *
|
---|
| 132 | * Helper function for modal dialogs to disable the
|
---|
| 133 | * owner of the dialog box. Returns TRUE if owner was enabled.
|
---|
| 134 | */
|
---|
| 135 | BOOL DIALOG_DisableOwner( HWND hOwner )
|
---|
| 136 | {
|
---|
| 137 | /* Owner must be a top-level window */
|
---|
| 138 | if (hOwner)
|
---|
| 139 | hOwner = GetAncestor( hOwner, GA_ROOT );
|
---|
| 140 | if (!hOwner) return FALSE;
|
---|
| 141 | if (IsWindowEnabled( hOwner ))
|
---|
| 142 | {
|
---|
| 143 | EnableWindow( hOwner, FALSE );
|
---|
| 144 | return TRUE;
|
---|
| 145 | }
|
---|
| 146 | else
|
---|
| 147 | return FALSE;
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | /***********************************************************************
|
---|
| 151 | * DIALOG_GetCharSizeFromDC
|
---|
| 152 | *
|
---|
| 153 | * Despite most of MSDN insisting that the horizontal base unit is
|
---|
| 154 | * tmAveCharWidth it isn't. Knowledge base article Q145994
|
---|
| 155 | * "HOWTO: Calculate Dialog Units When Not Using the System Font",
|
---|
| 156 | * says that we should take the average of the 52 English upper and lower
|
---|
| 157 | * case characters.
|
---|
| 158 | */
|
---|
| 159 | static BOOL DIALOG_GetCharSizeFromDC( HDC hDC, HFONT hFont, SIZE * pSize )
|
---|
| 160 | {
|
---|
| 161 | HFONT hFontPrev = 0;
|
---|
| 162 | char *alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
---|
| 163 | SIZE sz;
|
---|
| 164 | TEXTMETRICA tm;
|
---|
| 165 |
|
---|
| 166 | pSize->cx = xBaseUnit;
|
---|
| 167 | pSize->cy = yBaseUnit;
|
---|
| 168 |
|
---|
| 169 | if(!hDC) return FALSE;
|
---|
| 170 |
|
---|
| 171 | if(hFont) hFontPrev = SelectFont(hDC, hFont);
|
---|
| 172 | if(!GetTextMetricsA(hDC, &tm)) return FALSE;
|
---|
| 173 | if(!GetTextExtentPointA(hDC, alphabet, 52, &sz)) return FALSE;
|
---|
| 174 |
|
---|
| 175 | pSize->cy = tm.tmHeight;
|
---|
| 176 | pSize->cx = (sz.cx / 26 + 1) / 2;
|
---|
| 177 |
|
---|
| 178 | if (hFontPrev) SelectFont(hDC, hFontPrev);
|
---|
| 179 |
|
---|
| 180 | TRACE("dlg base units: %ld x %ld\n", pSize->cx, pSize->cy);
|
---|
| 181 | return TRUE;
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | /***********************************************************************
|
---|
| 185 | * DIALOG_GetCharSize
|
---|
| 186 | *
|
---|
| 187 | * A convenient variant of DIALOG_GetCharSizeFromDC.
|
---|
| 188 | */
|
---|
| 189 | static BOOL DIALOG_GetCharSize( HFONT hFont, SIZE * pSize )
|
---|
| 190 | {
|
---|
| 191 | HDC hDC = GetDC(0);
|
---|
| 192 | BOOL Success = DIALOG_GetCharSizeFromDC( hDC, hFont, pSize );
|
---|
| 193 | ReleaseDC(0, hDC);
|
---|
| 194 | return Success;
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | /***********************************************************************
|
---|
| 198 | * DIALOG_Init
|
---|
| 199 | *
|
---|
| 200 | * Initialisation of the dialog manager.
|
---|
| 201 | */
|
---|
| 202 | BOOL DIALOG_Init(void)
|
---|
| 203 | {
|
---|
| 204 | HDC hdc;
|
---|
| 205 | SIZE size;
|
---|
| 206 |
|
---|
| 207 | /* Calculate the dialog base units */
|
---|
| 208 |
|
---|
| 209 | if (!(hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL )))
|
---|
| 210 | {
|
---|
| 211 | ERR("Could not create Display DC\n");
|
---|
| 212 | return FALSE;
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | if (!DIALOG_GetCharSizeFromDC( hdc, 0, &size ))
|
---|
| 216 | {
|
---|
| 217 | DeleteDC( hdc );
|
---|
| 218 | ERR("Could not initialize base dialog units\n");
|
---|
| 219 | return FALSE;
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | DeleteDC( hdc );
|
---|
| 223 | xBaseUnit = size.cx;
|
---|
| 224 | yBaseUnit = size.cy;
|
---|
| 225 |
|
---|
| 226 | TRACE("base units = %d,%d\n", xBaseUnit, yBaseUnit );
|
---|
| 227 | return TRUE;
|
---|
| 228 | }
|
---|
| 229 |
|
---|
| 230 |
|
---|
| 231 | /***********************************************************************
|
---|
| 232 | * DIALOG_GetControl16
|
---|
| 233 | *
|
---|
| 234 | * Return the class and text of the control pointed to by ptr,
|
---|
| 235 | * fill the header structure and return a pointer to the next control.
|
---|
| 236 | */
|
---|
| 237 | static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
|
---|
| 238 | {
|
---|
| 239 | static char buffer[10];
|
---|
| 240 | int int_id;
|
---|
| 241 |
|
---|
| 242 | info->x = GET_WORD(p); p += sizeof(WORD);
|
---|
| 243 | info->y = GET_WORD(p); p += sizeof(WORD);
|
---|
| 244 | info->cx = GET_WORD(p); p += sizeof(WORD);
|
---|
| 245 | info->cy = GET_WORD(p); p += sizeof(WORD);
|
---|
| 246 | info->id = GET_WORD(p); p += sizeof(WORD);
|
---|
| 247 | info->style = GET_DWORD(p); p += sizeof(DWORD);
|
---|
| 248 | info->exStyle = 0;
|
---|
| 249 |
|
---|
| 250 | if (*p & 0x80)
|
---|
| 251 | {
|
---|
| 252 | switch((BYTE)*p)
|
---|
| 253 | {
|
---|
| 254 | case 0x80: strcpy( buffer, "BUTTON" ); break;
|
---|
| 255 | case 0x81: strcpy( buffer, "EDIT" ); break;
|
---|
| 256 | case 0x82: strcpy( buffer, "STATIC" ); break;
|
---|
| 257 | case 0x83: strcpy( buffer, "LISTBOX" ); break;
|
---|
| 258 | case 0x84: strcpy( buffer, "SCROLLBAR" ); break;
|
---|
| 259 | case 0x85: strcpy( buffer, "COMBOBOX" ); break;
|
---|
| 260 | default: buffer[0] = '\0'; break;
|
---|
| 261 | }
|
---|
| 262 | info->className = buffer;
|
---|
| 263 | p++;
|
---|
| 264 | }
|
---|
| 265 | else
|
---|
| 266 | {
|
---|
| 267 | info->className = p;
|
---|
| 268 | p += strlen(p) + 1;
|
---|
| 269 | }
|
---|
| 270 |
|
---|
| 271 | int_id = ((BYTE)*p == 0xff);
|
---|
| 272 | if (int_id)
|
---|
| 273 | {
|
---|
| 274 | /* Integer id, not documented (?). Only works for SS_ICON controls */
|
---|
| 275 | info->windowName = (LPCSTR)(UINT)GET_WORD(p+1);
|
---|
| 276 | p += 3;
|
---|
| 277 | }
|
---|
| 278 | else
|
---|
| 279 | {
|
---|
| 280 | info->windowName = p;
|
---|
| 281 | p += strlen(p) + 1;
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | if (*p) info->data = p + 1;
|
---|
| 285 | else info->data = NULL;
|
---|
| 286 |
|
---|
| 287 | p += *p + 1;
|
---|
| 288 |
|
---|
| 289 | if(int_id)
|
---|
| 290 | TRACE(" %s %04x %d, %d, %d, %d, %d, %08lx, %p\n",
|
---|
| 291 | info->className, LOWORD(info->windowName),
|
---|
| 292 | info->id, info->x, info->y, info->cx, info->cy,
|
---|
| 293 | info->style, info->data );
|
---|
| 294 | else
|
---|
| 295 | TRACE(" %s '%s' %d, %d, %d, %d, %d, %08lx, %p\n",
|
---|
| 296 | info->className, info->windowName,
|
---|
| 297 | info->id, info->x, info->y, info->cx, info->cy,
|
---|
| 298 | info->style, info->data );
|
---|
| 299 |
|
---|
| 300 | return p;
|
---|
| 301 | }
|
---|
| 302 |
|
---|
| 303 |
|
---|
| 304 | /***********************************************************************
|
---|
| 305 | * DIALOG_GetControl32
|
---|
| 306 | *
|
---|
| 307 | * Return the class and text of the control pointed to by ptr,
|
---|
| 308 | * fill the header structure and return a pointer to the next control.
|
---|
| 309 | */
|
---|
| 310 | static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info,
|
---|
| 311 | BOOL dialogEx )
|
---|
| 312 | {
|
---|
| 313 | if (dialogEx)
|
---|
| 314 | {
|
---|
| 315 | info->helpId = GET_DWORD(p); p += 2;
|
---|
| 316 | info->exStyle = GET_DWORD(p); p += 2;
|
---|
| 317 | info->style = GET_DWORD(p); p += 2;
|
---|
| 318 | }
|
---|
| 319 | else
|
---|
| 320 | {
|
---|
| 321 | info->helpId = 0;
|
---|
| 322 | info->style = GET_DWORD(p); p += 2;
|
---|
| 323 | info->exStyle = GET_DWORD(p); p += 2;
|
---|
| 324 | }
|
---|
| 325 | info->x = GET_WORD(p); p++;
|
---|
| 326 | info->y = GET_WORD(p); p++;
|
---|
| 327 | info->cx = GET_WORD(p); p++;
|
---|
| 328 | info->cy = GET_WORD(p); p++;
|
---|
| 329 |
|
---|
| 330 | if (dialogEx)
|
---|
| 331 | {
|
---|
| 332 | /* id is a DWORD for DIALOGEX */
|
---|
| 333 | info->id = GET_DWORD(p);
|
---|
| 334 | p += 2;
|
---|
| 335 | }
|
---|
| 336 | else
|
---|
| 337 | {
|
---|
| 338 | info->id = GET_WORD(p);
|
---|
| 339 | p++;
|
---|
| 340 | }
|
---|
| 341 |
|
---|
| 342 | if (GET_WORD(p) == 0xffff)
|
---|
| 343 | {
|
---|
| 344 | static const WCHAR class_names[6][10] =
|
---|
| 345 | {
|
---|
| 346 | { 'B','u','t','t','o','n', }, /* 0x80 */
|
---|
| 347 | { 'E','d','i','t', }, /* 0x81 */
|
---|
| 348 | { 'S','t','a','t','i','c', }, /* 0x82 */
|
---|
| 349 | { 'L','i','s','t','B','o','x', }, /* 0x83 */
|
---|
| 350 | { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
|
---|
| 351 | { 'C','o','m','b','o','B','o','x', } /* 0x85 */
|
---|
| 352 | };
|
---|
| 353 | WORD id = GET_WORD(p+1);
|
---|
| 354 | if ((id >= 0x80) && (id <= 0x85))
|
---|
| 355 | info->className = (LPCSTR)class_names[id - 0x80];
|
---|
| 356 | else
|
---|
| 357 | {
|
---|
| 358 | info->className = NULL;
|
---|
| 359 | ERR("Unknown built-in class id %04x\n", id );
|
---|
| 360 | }
|
---|
| 361 | p += 2;
|
---|
| 362 | }
|
---|
| 363 | else
|
---|
| 364 | {
|
---|
| 365 | info->className = (LPCSTR)p;
|
---|
| 366 | p += strlenW( (LPCWSTR)p ) + 1;
|
---|
| 367 | }
|
---|
| 368 |
|
---|
| 369 | if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
|
---|
| 370 | {
|
---|
| 371 | info->windowName = (LPCSTR)(UINT)GET_WORD(p + 1);
|
---|
| 372 | p += 2;
|
---|
| 373 | }
|
---|
| 374 | else
|
---|
| 375 | {
|
---|
| 376 | info->windowName = (LPCSTR)p;
|
---|
| 377 | p += strlenW( (LPCWSTR)p ) + 1;
|
---|
| 378 | }
|
---|
| 379 |
|
---|
| 380 | TRACE(" %s %s %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
|
---|
| 381 | debugstr_w( (LPCWSTR)info->className ),
|
---|
| 382 | debugstr_w( (LPCWSTR)info->windowName ),
|
---|
| 383 | info->id, info->x, info->y, info->cx, info->cy,
|
---|
| 384 | info->style, info->exStyle, info->helpId );
|
---|
| 385 |
|
---|
| 386 | if (GET_WORD(p))
|
---|
| 387 | {
|
---|
| 388 | if (TRACE_ON(dialog))
|
---|
| 389 | {
|
---|
| 390 | WORD i, count = GET_WORD(p) / sizeof(WORD);
|
---|
| 391 | TRACE(" BEGIN\n");
|
---|
| 392 | TRACE(" ");
|
---|
| 393 | for (i = 0; i < count; i++) DPRINTF( "%04x,", GET_WORD(p+i+1) );
|
---|
| 394 | DPRINTF("\n");
|
---|
| 395 | TRACE(" END\n" );
|
---|
| 396 | }
|
---|
| 397 | info->data = p + 1;
|
---|
| 398 | p += GET_WORD(p) / sizeof(WORD);
|
---|
| 399 | }
|
---|
| 400 | else info->data = NULL;
|
---|
| 401 | p++;
|
---|
| 402 |
|
---|
| 403 | /* Next control is on dword boundary */
|
---|
| 404 | return (const WORD *)((((int)p) + 3) & ~3);
|
---|
| 405 | }
|
---|
| 406 |
|
---|
| 407 |
|
---|
| 408 | /***********************************************************************
|
---|
| 409 | * DIALOG_CreateControls
|
---|
| 410 | *
|
---|
| 411 | * Create the control windows for a dialog.
|
---|
| 412 | */
|
---|
| 413 | static BOOL DIALOG_CreateControls( HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate,
|
---|
| 414 | HINSTANCE hInst, BOOL win32 )
|
---|
| 415 | {
|
---|
| 416 | DIALOGINFO *dlgInfo = DIALOG_get_info( hwnd );
|
---|
| 417 | DLG_CONTROL_INFO info;
|
---|
| 418 | HWND hwndCtrl, hwndDefButton = 0;
|
---|
| 419 | INT items = dlgTemplate->nbItems;
|
---|
| 420 |
|
---|
| 421 | TRACE(" BEGIN\n" );
|
---|
| 422 | while (items--)
|
---|
| 423 | {
|
---|
| 424 | #ifndef __WIN32OS2__
|
---|
| 425 | if (!win32)
|
---|
| 426 | {
|
---|
| 427 | HINSTANCE16 instance;
|
---|
| 428 | SEGPTR segptr;
|
---|
| 429 |
|
---|
| 430 | template = DIALOG_GetControl16( template, &info );
|
---|
| 431 | if (HIWORD(info.className) && !strcmp( info.className, "EDIT") &&
|
---|
| 432 | !(GetWindowLongW( hwnd, GWL_STYLE ) & DS_LOCALEDIT))
|
---|
| 433 | {
|
---|
| 434 | if (!dlgInfo->hDialogHeap)
|
---|
| 435 | {
|
---|
| 436 | dlgInfo->hDialogHeap = GlobalAlloc16(GMEM_FIXED, 0x10000);
|
---|
| 437 | if (!dlgInfo->hDialogHeap)
|
---|
| 438 | {
|
---|
| 439 | ERR("Insufficient memory to create heap for edit control\n" );
|
---|
| 440 | continue;
|
---|
| 441 | }
|
---|
| 442 | LocalInit16(dlgInfo->hDialogHeap, 0, 0xffff);
|
---|
| 443 | }
|
---|
| 444 | instance = dlgInfo->hDialogHeap;
|
---|
| 445 | }
|
---|
| 446 | else instance = (HINSTANCE16)hInst;
|
---|
| 447 |
|
---|
| 448 | segptr = MapLS( info.data );
|
---|
| 449 | hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
|
---|
| 450 | info.className, info.windowName,
|
---|
| 451 | info.style | WS_CHILD,
|
---|
| 452 | MulDiv(info.x, dlgInfo->xBaseUnit, 4),
|
---|
| 453 | MulDiv(info.y, dlgInfo->yBaseUnit, 8),
|
---|
| 454 | MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
|
---|
| 455 | MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
|
---|
| 456 | WIN_Handle16(hwnd), (HMENU16)info.id,
|
---|
| 457 | instance, (LPVOID)segptr ));
|
---|
| 458 | UnMapLS( segptr );
|
---|
| 459 | }
|
---|
| 460 | else
|
---|
| 461 | {
|
---|
| 462 | #endif
|
---|
| 463 | template = (LPCSTR)DIALOG_GetControl32( (WORD *)template, &info,
|
---|
| 464 | dlgTemplate->dialogEx );
|
---|
| 465 | /* Is this it? */
|
---|
| 466 | if (info.style & WS_BORDER)
|
---|
| 467 | {
|
---|
| 468 | info.style &= ~WS_BORDER;
|
---|
| 469 | info.exStyle |= WS_EX_CLIENTEDGE;
|
---|
| 470 | }
|
---|
| 471 | hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
|
---|
| 472 | (LPCWSTR)info.className,
|
---|
| 473 | (LPCWSTR)info.windowName,
|
---|
| 474 | info.style | WS_CHILD,
|
---|
| 475 | MulDiv(info.x, dlgInfo->xBaseUnit, 4),
|
---|
| 476 | MulDiv(info.y, dlgInfo->yBaseUnit, 8),
|
---|
| 477 | MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
|
---|
| 478 | MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
|
---|
| 479 | hwnd, (HMENU)info.id,
|
---|
| 480 | hInst, (LPVOID)info.data );
|
---|
| 481 | #ifndef __WIN32OS2__
|
---|
| 482 | }
|
---|
| 483 | #endif
|
---|
| 484 | if (!hwndCtrl) return FALSE;
|
---|
| 485 |
|
---|
| 486 | /* Send initialisation messages to the control */
|
---|
| 487 | if (dlgInfo->hUserFont) SendMessageA( hwndCtrl, WM_SETFONT,
|
---|
| 488 | (WPARAM)dlgInfo->hUserFont, 0 );
|
---|
| 489 | if (SendMessageA(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
|
---|
| 490 | {
|
---|
| 491 | /* If there's already a default push-button, set it back */
|
---|
| 492 | /* to normal and use this one instead. */
|
---|
| 493 | if (hwndDefButton)
|
---|
| 494 | SendMessageA( hwndDefButton, BM_SETSTYLE,
|
---|
| 495 | BS_PUSHBUTTON,FALSE );
|
---|
| 496 | hwndDefButton = hwndCtrl;
|
---|
| 497 | dlgInfo->idResult = GetWindowLongA( hwndCtrl, GWL_ID );
|
---|
| 498 | }
|
---|
| 499 | }
|
---|
| 500 | TRACE(" END\n" );
|
---|
| 501 | return TRUE;
|
---|
| 502 | }
|
---|
| 503 |
|
---|
| 504 | #ifndef __WIN32OS2__
|
---|
| 505 | /***********************************************************************
|
---|
| 506 | * DIALOG_ParseTemplate16
|
---|
| 507 | *
|
---|
| 508 | * Fill a DLG_TEMPLATE structure from the dialog template, and return
|
---|
| 509 | * a pointer to the first control.
|
---|
| 510 | */
|
---|
| 511 | static LPCSTR DIALOG_ParseTemplate16( LPCSTR p, DLG_TEMPLATE * result )
|
---|
| 512 | {
|
---|
| 513 | result->style = GET_DWORD(p); p += sizeof(DWORD);
|
---|
| 514 | result->exStyle = 0;
|
---|
| 515 | result->nbItems = (unsigned char) *p++;
|
---|
| 516 | result->x = GET_WORD(p); p += sizeof(WORD);
|
---|
| 517 | result->y = GET_WORD(p); p += sizeof(WORD);
|
---|
| 518 | result->cx = GET_WORD(p); p += sizeof(WORD);
|
---|
| 519 | result->cy = GET_WORD(p); p += sizeof(WORD);
|
---|
| 520 | TRACE("DIALOG %d, %d, %d, %d\n",
|
---|
| 521 | result->x, result->y, result->cx, result->cy );
|
---|
| 522 | TRACE(" STYLE %08lx\n", result->style );
|
---|
| 523 |
|
---|
| 524 | /* Get the menu name */
|
---|
| 525 |
|
---|
| 526 | switch( (BYTE)*p )
|
---|
| 527 | {
|
---|
| 528 | case 0:
|
---|
| 529 | result->menuName = 0;
|
---|
| 530 | p++;
|
---|
| 531 | break;
|
---|
| 532 | case 0xff:
|
---|
| 533 | result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
|
---|
| 534 | p += 3;
|
---|
| 535 | TRACE(" MENU %04x\n", LOWORD(result->menuName) );
|
---|
| 536 | break;
|
---|
| 537 | default:
|
---|
| 538 | result->menuName = p;
|
---|
| 539 | TRACE(" MENU '%s'\n", p );
|
---|
| 540 | p += strlen(p) + 1;
|
---|
| 541 | break;
|
---|
| 542 | }
|
---|
| 543 |
|
---|
| 544 | /* Get the class name */
|
---|
| 545 |
|
---|
| 546 | if (*p)
|
---|
| 547 | {
|
---|
| 548 | result->className = p;
|
---|
| 549 | TRACE(" CLASS '%s'\n", result->className );
|
---|
| 550 | }
|
---|
| 551 | else result->className = DIALOG_CLASS_ATOM;
|
---|
| 552 | p += strlen(p) + 1;
|
---|
| 553 |
|
---|
| 554 | /* Get the window caption */
|
---|
| 555 |
|
---|
| 556 | result->caption = p;
|
---|
| 557 | p += strlen(p) + 1;
|
---|
| 558 | TRACE(" CAPTION '%s'\n", result->caption );
|
---|
| 559 |
|
---|
| 560 | /* Get the font name */
|
---|
| 561 |
|
---|
| 562 | if (result->style & DS_SETFONT)
|
---|
| 563 | {
|
---|
| 564 | result->pointSize = GET_WORD(p);
|
---|
| 565 | p += sizeof(WORD);
|
---|
| 566 | result->faceName = p;
|
---|
| 567 | p += strlen(p) + 1;
|
---|
| 568 | TRACE(" FONT %d,'%s'\n",
|
---|
| 569 | result->pointSize, result->faceName );
|
---|
| 570 | }
|
---|
| 571 | return p;
|
---|
| 572 | }
|
---|
| 573 | #endif
|
---|
| 574 |
|
---|
| 575 | /***********************************************************************
|
---|
| 576 | * DIALOG_ParseTemplate32
|
---|
| 577 | *
|
---|
| 578 | * Fill a DLG_TEMPLATE structure from the dialog template, and return
|
---|
| 579 | * a pointer to the first control.
|
---|
| 580 | */
|
---|
| 581 | static LPCSTR DIALOG_ParseTemplate32( LPCSTR template, DLG_TEMPLATE * result )
|
---|
| 582 | {
|
---|
| 583 | const WORD *p = (const WORD *)template;
|
---|
| 584 |
|
---|
| 585 | result->style = GET_DWORD(p); p += 2;
|
---|
| 586 | if (result->style == 0xffff0001) /* DIALOGEX resource */
|
---|
| 587 | {
|
---|
| 588 | result->dialogEx = TRUE;
|
---|
| 589 | result->helpId = GET_DWORD(p); p += 2;
|
---|
| 590 | result->exStyle = GET_DWORD(p); p += 2;
|
---|
| 591 | result->style = GET_DWORD(p); p += 2;
|
---|
| 592 | }
|
---|
| 593 | else
|
---|
| 594 | {
|
---|
| 595 | result->dialogEx = FALSE;
|
---|
| 596 | result->helpId = 0;
|
---|
| 597 | result->exStyle = GET_DWORD(p); p += 2;
|
---|
| 598 | }
|
---|
| 599 | result->nbItems = GET_WORD(p); p++;
|
---|
| 600 | result->x = GET_WORD(p); p++;
|
---|
| 601 | result->y = GET_WORD(p); p++;
|
---|
| 602 | result->cx = GET_WORD(p); p++;
|
---|
| 603 | result->cy = GET_WORD(p); p++;
|
---|
| 604 | TRACE("DIALOG%s %d, %d, %d, %d, %ld\n",
|
---|
| 605 | result->dialogEx ? "EX" : "", result->x, result->y,
|
---|
| 606 | result->cx, result->cy, result->helpId );
|
---|
| 607 | TRACE(" STYLE 0x%08lx\n", result->style );
|
---|
| 608 | TRACE(" EXSTYLE 0x%08lx\n", result->exStyle );
|
---|
| 609 |
|
---|
| 610 | /* Get the menu name */
|
---|
| 611 |
|
---|
| 612 | switch(GET_WORD(p))
|
---|
| 613 | {
|
---|
| 614 | case 0x0000:
|
---|
| 615 | result->menuName = NULL;
|
---|
| 616 | p++;
|
---|
| 617 | break;
|
---|
| 618 | case 0xffff:
|
---|
| 619 | result->menuName = (LPCSTR)(UINT)GET_WORD( p + 1 );
|
---|
| 620 | p += 2;
|
---|
| 621 | TRACE(" MENU %04x\n", LOWORD(result->menuName) );
|
---|
| 622 | break;
|
---|
| 623 | default:
|
---|
| 624 | result->menuName = (LPCSTR)p;
|
---|
| 625 | TRACE(" MENU %s\n", debugstr_w( (LPCWSTR)p ));
|
---|
| 626 | p += strlenW( (LPCWSTR)p ) + 1;
|
---|
| 627 | break;
|
---|
| 628 | }
|
---|
| 629 |
|
---|
| 630 | /* Get the class name */
|
---|
| 631 |
|
---|
| 632 | switch(GET_WORD(p))
|
---|
| 633 | {
|
---|
| 634 | case 0x0000:
|
---|
| 635 | result->className = DIALOG_CLASS_ATOM;
|
---|
| 636 | p++;
|
---|
| 637 | break;
|
---|
| 638 | case 0xffff:
|
---|
| 639 | result->className = (LPCSTR)(UINT)GET_WORD( p + 1 );
|
---|
| 640 | p += 2;
|
---|
| 641 | TRACE(" CLASS %04x\n", LOWORD(result->className) );
|
---|
| 642 | break;
|
---|
| 643 | default:
|
---|
| 644 | result->className = (LPCSTR)p;
|
---|
| 645 | TRACE(" CLASS %s\n", debugstr_w( (LPCWSTR)p ));
|
---|
| 646 | p += strlenW( (LPCWSTR)p ) + 1;
|
---|
| 647 | break;
|
---|
| 648 | }
|
---|
| 649 |
|
---|
| 650 | /* Get the window caption */
|
---|
| 651 |
|
---|
| 652 | result->caption = (LPCSTR)p;
|
---|
| 653 | p += strlenW( (LPCWSTR)p ) + 1;
|
---|
| 654 | TRACE(" CAPTION %s\n", debugstr_w( (LPCWSTR)result->caption ) );
|
---|
| 655 |
|
---|
| 656 | /* Get the font name */
|
---|
| 657 |
|
---|
| 658 | if (result->style & DS_SETFONT)
|
---|
| 659 | {
|
---|
| 660 | result->pointSize = GET_WORD(p);
|
---|
| 661 | p++;
|
---|
| 662 | if (result->dialogEx)
|
---|
| 663 | {
|
---|
| 664 | result->weight = GET_WORD(p); p++;
|
---|
| 665 | result->italic = LOBYTE(GET_WORD(p)); p++;
|
---|
| 666 | }
|
---|
| 667 | else
|
---|
| 668 | {
|
---|
| 669 | result->weight = FW_DONTCARE;
|
---|
| 670 | result->italic = FALSE;
|
---|
| 671 | }
|
---|
| 672 | result->faceName = (LPCSTR)p;
|
---|
| 673 | p += strlenW( (LPCWSTR)p ) + 1;
|
---|
| 674 | TRACE(" FONT %d, %s, %d, %s\n",
|
---|
| 675 | result->pointSize, debugstr_w( (LPCWSTR)result->faceName ),
|
---|
| 676 | result->weight, result->italic ? "TRUE" : "FALSE" );
|
---|
| 677 | }
|
---|
| 678 |
|
---|
| 679 | /* First control is on dword boundary */
|
---|
| 680 | return (LPCSTR)((((int)p) + 3) & ~3);
|
---|
| 681 | }
|
---|
| 682 |
|
---|
| 683 |
|
---|
| 684 | /***********************************************************************
|
---|
| 685 | * DIALOG_CreateIndirect
|
---|
| 686 | * Creates a dialog box window
|
---|
| 687 | *
|
---|
| 688 | * modal = TRUE if we are called from a modal dialog box.
|
---|
| 689 | * (it's more compatible to do it here, as under Windows the owner
|
---|
| 690 | * is never disabled if the dialog fails because of an invalid template)
|
---|
| 691 | */
|
---|
| 692 | static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
|
---|
| 693 | HWND owner, DLGPROC dlgProc, LPARAM param,
|
---|
| 694 | WINDOWPROCTYPE procType, BOOL modal )
|
---|
| 695 | {
|
---|
| 696 | HWND hwnd;
|
---|
| 697 | RECT rect;
|
---|
| 698 | WND * wndPtr;
|
---|
| 699 | DLG_TEMPLATE template;
|
---|
| 700 | DIALOGINFO * dlgInfo;
|
---|
| 701 | BOOL ownerEnabled = TRUE;
|
---|
| 702 | #ifdef __WIN32OS2__
|
---|
| 703 | #define win32Template 1
|
---|
| 704 | #else
|
---|
| 705 | BOOL win32Template = (procType != WIN_PROC_16);
|
---|
| 706 | #endif
|
---|
| 707 |
|
---|
| 708 | /* Parse dialog template */
|
---|
| 709 |
|
---|
| 710 | if (!dlgTemplate) return 0;
|
---|
| 711 | #ifdef __WIN32OS2__
|
---|
| 712 | dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
|
---|
| 713 | #else
|
---|
| 714 | if (win32Template)
|
---|
| 715 | dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
|
---|
| 716 | else
|
---|
| 717 | dlgTemplate = DIALOG_ParseTemplate16( dlgTemplate, &template );
|
---|
| 718 | #endif
|
---|
| 719 |
|
---|
| 720 | /* Initialise dialog extra data */
|
---|
| 721 |
|
---|
| 722 | if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return 0;
|
---|
| 723 | dlgInfo->hwndFocus = 0;
|
---|
| 724 | dlgInfo->hUserFont = 0;
|
---|
| 725 | dlgInfo->hMenu = 0;
|
---|
| 726 | dlgInfo->xBaseUnit = xBaseUnit;
|
---|
| 727 | dlgInfo->yBaseUnit = yBaseUnit;
|
---|
| 728 | dlgInfo->idResult = 0;
|
---|
| 729 | dlgInfo->flags = 0;
|
---|
| 730 | dlgInfo->hDialogHeap = 0;
|
---|
| 731 |
|
---|
| 732 | /* Load menu */
|
---|
| 733 |
|
---|
| 734 | if (template.menuName)
|
---|
| 735 | {
|
---|
| 736 | #ifdef __WIN32OS2__
|
---|
| 737 | dlgInfo->hMenu = LoadMenuW( hInst, (LPCWSTR)template.menuName );
|
---|
| 738 | #else
|
---|
| 739 | if (!win32Template) dlgInfo->hMenu = LoadMenu16( hInst, template.menuName );
|
---|
| 740 | else dlgInfo->hMenu = LoadMenuW( hInst, (LPCWSTR)template.menuName );
|
---|
| 741 | #endif
|
---|
| 742 | }
|
---|
| 743 |
|
---|
| 744 | /* Create custom font if needed */
|
---|
| 745 |
|
---|
| 746 | if (template.style & DS_SETFONT)
|
---|
| 747 | {
|
---|
| 748 | /* We convert the size to pixels and then make it -ve. This works
|
---|
| 749 | * for both +ve and -ve template.pointSize */
|
---|
| 750 | HDC dc;
|
---|
| 751 | int pixels;
|
---|
| 752 | dc = GetDC(0);
|
---|
| 753 | pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
|
---|
| 754 | ReleaseDC(0, dc);
|
---|
| 755 | if (win32Template)
|
---|
| 756 | dlgInfo->hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
|
---|
| 757 | template.italic, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
|
---|
| 758 | PROOF_QUALITY, FF_DONTCARE,
|
---|
| 759 | (LPCWSTR)template.faceName );
|
---|
| 760 | else
|
---|
| 761 | dlgInfo->hUserFont = CreateFontA( -pixels, 0, 0, 0, FW_DONTCARE,
|
---|
| 762 | FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
|
---|
| 763 | PROOF_QUALITY, FF_DONTCARE, template.faceName );
|
---|
| 764 | if (dlgInfo->hUserFont)
|
---|
| 765 | {
|
---|
| 766 | SIZE charSize;
|
---|
| 767 | if (DIALOG_GetCharSize( dlgInfo->hUserFont, &charSize ))
|
---|
| 768 | {
|
---|
| 769 | dlgInfo->xBaseUnit = charSize.cx;
|
---|
| 770 | dlgInfo->yBaseUnit = charSize.cy;
|
---|
| 771 | }
|
---|
| 772 | }
|
---|
| 773 | TRACE("units = %d,%d\n", dlgInfo->xBaseUnit, dlgInfo->yBaseUnit );
|
---|
| 774 | }
|
---|
| 775 |
|
---|
| 776 | /* Create dialog main window */
|
---|
| 777 |
|
---|
| 778 | rect.left = rect.top = 0;
|
---|
| 779 | rect.right = MulDiv(template.cx, dlgInfo->xBaseUnit, 4);
|
---|
| 780 | rect.bottom = MulDiv(template.cy, dlgInfo->yBaseUnit, 8);
|
---|
| 781 | if (template.style & DS_MODALFRAME)
|
---|
| 782 | template.exStyle |= WS_EX_DLGMODALFRAME;
|
---|
| 783 | AdjustWindowRectEx( &rect, template.style, (dlgInfo->hMenu != 0), template.exStyle );
|
---|
| 784 | rect.right -= rect.left;
|
---|
| 785 | rect.bottom -= rect.top;
|
---|
| 786 |
|
---|
| 787 | if ((INT16)template.x == CW_USEDEFAULT16)
|
---|
| 788 | {
|
---|
| 789 | rect.left = rect.top = win32Template? CW_USEDEFAULT : CW_USEDEFAULT16;
|
---|
| 790 | }
|
---|
| 791 | else
|
---|
| 792 | {
|
---|
| 793 | if (template.style & DS_CENTER)
|
---|
| 794 | {
|
---|
| 795 | rect.left = (GetSystemMetrics(SM_CXSCREEN) - rect.right) / 2;
|
---|
| 796 | rect.top = (GetSystemMetrics(SM_CYSCREEN) - rect.bottom) / 2;
|
---|
| 797 | }
|
---|
| 798 | else
|
---|
| 799 | {
|
---|
| 800 | rect.left += MulDiv(template.x, dlgInfo->xBaseUnit, 4);
|
---|
| 801 | rect.top += MulDiv(template.y, dlgInfo->yBaseUnit, 8);
|
---|
| 802 | }
|
---|
| 803 | if ( !(template.style & WS_CHILD) )
|
---|
| 804 | {
|
---|
| 805 | INT16 dX, dY;
|
---|
| 806 |
|
---|
| 807 | if( !(template.style & DS_ABSALIGN) )
|
---|
| 808 | ClientToScreen( owner, (POINT *)&rect );
|
---|
| 809 |
|
---|
| 810 | /* try to fit it into the desktop */
|
---|
| 811 |
|
---|
| 812 | if( (dX = rect.left + rect.right + GetSystemMetrics(SM_CXDLGFRAME)
|
---|
| 813 | - GetSystemMetrics(SM_CXSCREEN)) > 0 ) rect.left -= dX;
|
---|
| 814 | if( (dY = rect.top + rect.bottom + GetSystemMetrics(SM_CYDLGFRAME)
|
---|
| 815 | - GetSystemMetrics(SM_CYSCREEN)) > 0 ) rect.top -= dY;
|
---|
| 816 | if( rect.left < 0 ) rect.left = 0;
|
---|
| 817 | if( rect.top < 0 ) rect.top = 0;
|
---|
| 818 | }
|
---|
| 819 | }
|
---|
| 820 |
|
---|
| 821 | if (modal)
|
---|
| 822 | {
|
---|
| 823 | ownerEnabled = DIALOG_DisableOwner( owner );
|
---|
| 824 | if (ownerEnabled) dlgInfo->flags |= DF_OWNERENABLED;
|
---|
| 825 | }
|
---|
| 826 |
|
---|
| 827 | #ifndef __WIN32OS2__
|
---|
| 828 | if (!win32Template)
|
---|
| 829 | hwnd = WIN_Handle32( CreateWindowEx16(template.exStyle, template.className,
|
---|
| 830 | template.caption, template.style & ~WS_VISIBLE,
|
---|
| 831 | rect.left, rect.top, rect.right, rect.bottom,
|
---|
| 832 | WIN_Handle16(owner), dlgInfo->hMenu, hInst, NULL ));
|
---|
| 833 | else
|
---|
| 834 | #endif
|
---|
| 835 | hwnd = CreateWindowExW(template.exStyle, (LPCWSTR)template.className,
|
---|
| 836 | (LPCWSTR)template.caption,
|
---|
| 837 | template.style & ~WS_VISIBLE,
|
---|
| 838 | rect.left, rect.top, rect.right, rect.bottom,
|
---|
| 839 | owner, dlgInfo->hMenu, hInst, NULL );
|
---|
| 840 |
|
---|
| 841 | if (!hwnd)
|
---|
| 842 | {
|
---|
| 843 | if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
|
---|
| 844 | if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
|
---|
| 845 | if (modal && (dlgInfo->flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
|
---|
| 846 | HeapFree( GetProcessHeap(), 0, dlgInfo );
|
---|
| 847 | return 0;
|
---|
| 848 | }
|
---|
| 849 | wndPtr = WIN_GetPtr( hwnd );
|
---|
| 850 | wndPtr->flags |= WIN_ISDIALOG;
|
---|
| 851 | WIN_ReleasePtr( wndPtr );
|
---|
| 852 |
|
---|
| 853 | if (template.helpId) SetWindowContextHelpId( hwnd, template.helpId );
|
---|
| 854 | SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, (LONG)dlgInfo );
|
---|
| 855 | switch(procType)
|
---|
| 856 | {
|
---|
| 857 | #ifndef __WIN32OS2__
|
---|
| 858 | case WIN_PROC_16: SetWindowLong16( WIN_Handle16(hwnd), DWL_DLGPROC, (LONG)dlgProc ); break;
|
---|
| 859 | #endif
|
---|
| 860 | case WIN_PROC_32A: SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc ); break;
|
---|
| 861 | case WIN_PROC_32W: SetWindowLongW( hwnd, DWL_DLGPROC, (LONG)dlgProc ); break;
|
---|
| 862 | default: break;
|
---|
| 863 | }
|
---|
| 864 |
|
---|
| 865 | if (dlgInfo->hUserFont)
|
---|
| 866 | SendMessageA( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
|
---|
| 867 |
|
---|
| 868 | /* Create controls */
|
---|
| 869 |
|
---|
| 870 | if (DIALOG_CreateControls( hwnd, dlgTemplate, &template,
|
---|
| 871 | hInst, win32Template ))
|
---|
| 872 | {
|
---|
| 873 | HWND hwndPreInitFocus;
|
---|
| 874 |
|
---|
| 875 | /* Send initialisation messages and set focus */
|
---|
| 876 |
|
---|
| 877 | dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
|
---|
| 878 |
|
---|
| 879 | hwndPreInitFocus = GetFocus();
|
---|
| 880 | if (SendMessageA( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
|
---|
| 881 | {
|
---|
| 882 | /* check where the focus is again,
|
---|
| 883 | * some controls status might have changed in WM_INITDIALOG */
|
---|
| 884 | dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
|
---|
| 885 | if( dlgInfo->hwndFocus )
|
---|
| 886 | SetFocus( dlgInfo->hwndFocus );
|
---|
| 887 | }
|
---|
| 888 | else
|
---|
| 889 | {
|
---|
| 890 | /* If the dlgproc has returned FALSE (indicating handling of keyboard focus)
|
---|
| 891 | but the focus has not changed, set the focus where we expect it. */
|
---|
| 892 | if ((GetFocus() == hwndPreInitFocus) &&
|
---|
| 893 | (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
|
---|
| 894 | {
|
---|
| 895 | dlgInfo->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE);
|
---|
| 896 | if( dlgInfo->hwndFocus )
|
---|
| 897 | SetFocus( dlgInfo->hwndFocus );
|
---|
| 898 | }
|
---|
| 899 | }
|
---|
| 900 |
|
---|
| 901 | if (template.style & WS_VISIBLE && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE))
|
---|
| 902 | {
|
---|
| 903 | ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
|
---|
| 904 | }
|
---|
| 905 | return hwnd;
|
---|
| 906 | }
|
---|
| 907 | if( IsWindow(hwnd) ) DestroyWindow( hwnd );
|
---|
| 908 | if (modal && ownerEnabled) DIALOG_EnableOwner(owner);
|
---|
| 909 | return 0;
|
---|
| 910 | }
|
---|
| 911 |
|
---|
| 912 | #ifndef __WIN32OS2__
|
---|
| 913 | /***********************************************************************
|
---|
| 914 | * CreateDialog (USER.89)
|
---|
| 915 | */
|
---|
| 916 | HWND16 WINAPI CreateDialog16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
|
---|
| 917 | HWND16 owner, DLGPROC16 dlgProc )
|
---|
| 918 | {
|
---|
| 919 | return CreateDialogParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
|
---|
| 920 | }
|
---|
| 921 |
|
---|
| 922 |
|
---|
| 923 | /***********************************************************************
|
---|
| 924 | * CreateDialogParam (USER.241)
|
---|
| 925 | */
|
---|
| 926 | HWND16 WINAPI CreateDialogParam16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
|
---|
| 927 | HWND16 owner, DLGPROC16 dlgProc,
|
---|
| 928 | LPARAM param )
|
---|
| 929 | {
|
---|
| 930 | HWND16 hwnd = 0;
|
---|
| 931 | HRSRC16 hRsrc;
|
---|
| 932 | HGLOBAL16 hmem;
|
---|
| 933 | LPCVOID data;
|
---|
| 934 |
|
---|
| 935 | TRACE("%04x,%s,%04x,%08lx,%ld\n",
|
---|
| 936 | hInst, debugstr_a(dlgTemplate), owner, (DWORD)dlgProc, param );
|
---|
| 937 |
|
---|
| 938 | if (!(hRsrc = FindResource16( hInst, dlgTemplate, RT_DIALOGA ))) return 0;
|
---|
| 939 | if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
|
---|
| 940 | if (!(data = LockResource16( hmem ))) hwnd = 0;
|
---|
| 941 | else hwnd = CreateDialogIndirectParam16( hInst, data, owner,
|
---|
| 942 | dlgProc, param );
|
---|
| 943 | FreeResource16( hmem );
|
---|
| 944 | return hwnd;
|
---|
| 945 | }
|
---|
| 946 | #endif
|
---|
| 947 | /***********************************************************************
|
---|
| 948 | * CreateDialogParamA (USER32.@)
|
---|
| 949 | */
|
---|
| 950 | HWND WINAPI CreateDialogParamA( HINSTANCE hInst, LPCSTR name,
|
---|
| 951 | HWND owner, DLGPROC dlgProc,
|
---|
| 952 | LPARAM param )
|
---|
| 953 | {
|
---|
| 954 | HANDLE hrsrc = FindResourceA( hInst, name, RT_DIALOGA );
|
---|
| 955 | if (!hrsrc) return 0;
|
---|
| 956 | return CreateDialogIndirectParamA( hInst,
|
---|
| 957 | (LPVOID)LoadResource(hInst, hrsrc),
|
---|
| 958 | owner, dlgProc, param );
|
---|
| 959 | }
|
---|
| 960 |
|
---|
| 961 |
|
---|
| 962 | /***********************************************************************
|
---|
| 963 | * CreateDialogParamW (USER32.@)
|
---|
| 964 | */
|
---|
| 965 | HWND WINAPI CreateDialogParamW( HINSTANCE hInst, LPCWSTR name,
|
---|
| 966 | HWND owner, DLGPROC dlgProc,
|
---|
| 967 | LPARAM param )
|
---|
| 968 | {
|
---|
| 969 | HANDLE hrsrc = FindResourceW( hInst, name, RT_DIALOGW );
|
---|
| 970 | if (!hrsrc) return 0;
|
---|
| 971 | return CreateDialogIndirectParamW( hInst,
|
---|
| 972 | (LPVOID)LoadResource(hInst, hrsrc),
|
---|
| 973 | owner, dlgProc, param );
|
---|
| 974 | }
|
---|
| 975 |
|
---|
| 976 | #ifndef __WIN32OS2__
|
---|
| 977 | /***********************************************************************
|
---|
| 978 | * CreateDialogIndirect (USER.219)
|
---|
| 979 | */
|
---|
| 980 | HWND16 WINAPI CreateDialogIndirect16( HINSTANCE16 hInst, LPCVOID dlgTemplate,
|
---|
| 981 | HWND16 owner, DLGPROC16 dlgProc )
|
---|
| 982 | {
|
---|
| 983 | return CreateDialogIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0);
|
---|
| 984 | }
|
---|
| 985 |
|
---|
| 986 |
|
---|
| 987 | /***********************************************************************
|
---|
| 988 | * CreateDialogIndirectParam (USER.242)
|
---|
| 989 | * CreateDialogIndirectParam16 (USER32.@)
|
---|
| 990 | */
|
---|
| 991 | HWND16 WINAPI CreateDialogIndirectParam16( HINSTANCE16 hInst,
|
---|
| 992 | LPCVOID dlgTemplate,
|
---|
| 993 | HWND16 owner, DLGPROC16 dlgProc,
|
---|
| 994 | LPARAM param )
|
---|
| 995 | {
|
---|
| 996 | return WIN_Handle16( DIALOG_CreateIndirect( hInst, dlgTemplate, WIN_Handle32(owner),
|
---|
| 997 | (DLGPROC)dlgProc, param, WIN_PROC_16, FALSE ));
|
---|
| 998 | }
|
---|
| 999 | #endif
|
---|
| 1000 |
|
---|
| 1001 | /***********************************************************************
|
---|
| 1002 | * CreateDialogIndirectParamA (USER32.@)
|
---|
| 1003 | */
|
---|
| 1004 | HWND WINAPI CreateDialogIndirectParamA( HINSTANCE hInst,
|
---|
| 1005 | LPCVOID dlgTemplate,
|
---|
| 1006 | HWND owner, DLGPROC dlgProc,
|
---|
| 1007 | LPARAM param )
|
---|
| 1008 | {
|
---|
| 1009 | return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32A, FALSE );
|
---|
| 1010 | }
|
---|
| 1011 |
|
---|
| 1012 | /***********************************************************************
|
---|
| 1013 | * CreateDialogIndirectParamAorW (USER32.@)
|
---|
| 1014 | */
|
---|
| 1015 | HWND WINAPI CreateDialogIndirectParamAorW( HINSTANCE hInst,
|
---|
| 1016 | LPCVOID dlgTemplate,
|
---|
| 1017 | HWND owner, DLGPROC dlgProc,
|
---|
| 1018 | LPARAM param )
|
---|
| 1019 | { FIXME("assume WIN_PROC_32W\n");
|
---|
| 1020 | return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32W, FALSE );
|
---|
| 1021 | }
|
---|
| 1022 |
|
---|
| 1023 | /***********************************************************************
|
---|
| 1024 | * CreateDialogIndirectParamW (USER32.@)
|
---|
| 1025 | */
|
---|
| 1026 | HWND WINAPI CreateDialogIndirectParamW( HINSTANCE hInst,
|
---|
| 1027 | LPCVOID dlgTemplate,
|
---|
| 1028 | HWND owner, DLGPROC dlgProc,
|
---|
| 1029 | LPARAM param )
|
---|
| 1030 | {
|
---|
| 1031 | return DIALOG_CreateIndirect( hInst, dlgTemplate, owner, dlgProc, param, WIN_PROC_32W, FALSE );
|
---|
| 1032 | }
|
---|
| 1033 |
|
---|
| 1034 |
|
---|
| 1035 | /***********************************************************************
|
---|
| 1036 | * DIALOG_DoDialogBox
|
---|
| 1037 | */
|
---|
| 1038 | static INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
|
---|
| 1039 | {
|
---|
| 1040 | DIALOGINFO * dlgInfo;
|
---|
| 1041 | MSG msg;
|
---|
| 1042 | INT retval;
|
---|
| 1043 | HWND ownerMsg = GetAncestor( owner, GA_ROOT );
|
---|
| 1044 |
|
---|
| 1045 | if (!(dlgInfo = DIALOG_get_info( hwnd ))) return -1;
|
---|
| 1046 |
|
---|
| 1047 | if (!(dlgInfo->flags & DF_END)) /* was EndDialog called in WM_INITDIALOG ? */
|
---|
| 1048 | {
|
---|
| 1049 | ShowWindow( hwnd, SW_SHOW );
|
---|
| 1050 | for (;;)
|
---|
| 1051 | {
|
---|
| 1052 | if (!(GetWindowLongW( hwnd, GWL_STYLE ) & DS_NOIDLEMSG))
|
---|
| 1053 | {
|
---|
| 1054 | if (!PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
|
---|
| 1055 | {
|
---|
| 1056 | /* No message present -> send ENTERIDLE and wait */
|
---|
| 1057 | SendMessageW( ownerMsg, WM_ENTERIDLE, MSGF_DIALOGBOX, (LPARAM)hwnd );
|
---|
| 1058 | if (!GetMessageW( &msg, 0, 0, 0 )) break;
|
---|
| 1059 | }
|
---|
| 1060 | }
|
---|
| 1061 | else if (!GetMessageW( &msg, 0, 0, 0 )) break;
|
---|
| 1062 |
|
---|
| 1063 | if (CallMsgFilterW( &msg, MSGF_DIALOGBOX )) continue;
|
---|
| 1064 |
|
---|
| 1065 | if (!IsWindow( hwnd )) return -1;
|
---|
| 1066 | if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
|
---|
| 1067 | {
|
---|
| 1068 | TranslateMessage( &msg );
|
---|
| 1069 | DispatchMessageW( &msg );
|
---|
| 1070 | }
|
---|
| 1071 | if (dlgInfo->flags & DF_END) break;
|
---|
| 1072 | }
|
---|
| 1073 | }
|
---|
| 1074 | if (dlgInfo->flags & DF_OWNERENABLED) DIALOG_EnableOwner( owner );
|
---|
| 1075 | retval = dlgInfo->idResult;
|
---|
| 1076 | DestroyWindow( hwnd );
|
---|
| 1077 | return retval;
|
---|
| 1078 | }
|
---|
| 1079 |
|
---|
| 1080 | #ifndef __WIN32OS2__
|
---|
| 1081 | /***********************************************************************
|
---|
| 1082 | * DialogBox (USER.87)
|
---|
| 1083 | */
|
---|
| 1084 | INT16 WINAPI DialogBox16( HINSTANCE16 hInst, LPCSTR dlgTemplate,
|
---|
| 1085 | HWND16 owner, DLGPROC16 dlgProc )
|
---|
| 1086 | {
|
---|
| 1087 | return DialogBoxParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
|
---|
| 1088 | }
|
---|
| 1089 |
|
---|
| 1090 |
|
---|
| 1091 | /***********************************************************************
|
---|
| 1092 | * DialogBoxParam (USER.239)
|
---|
| 1093 | */
|
---|
| 1094 | INT16 WINAPI DialogBoxParam16( HINSTANCE16 hInst, LPCSTR template,
|
---|
| 1095 | HWND16 owner16, DLGPROC16 dlgProc, LPARAM param )
|
---|
| 1096 | {
|
---|
| 1097 | HWND hwnd = 0;
|
---|
| 1098 | HRSRC16 hRsrc;
|
---|
| 1099 | HGLOBAL16 hmem;
|
---|
| 1100 | LPCVOID data;
|
---|
| 1101 | int ret = -1;
|
---|
| 1102 |
|
---|
| 1103 | if (!(hRsrc = FindResource16( hInst, template, RT_DIALOGA ))) return 0;
|
---|
| 1104 | if (!(hmem = LoadResource16( hInst, hRsrc ))) return 0;
|
---|
| 1105 | if ((data = LockResource16( hmem )))
|
---|
| 1106 | {
|
---|
| 1107 | HWND owner = WIN_Handle32(owner16);
|
---|
| 1108 | hwnd = DIALOG_CreateIndirect( hInst, data, owner,
|
---|
| 1109 | (DLGPROC)dlgProc, param, WIN_PROC_16, TRUE );
|
---|
| 1110 | if (hwnd) ret = DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1111 | GlobalUnlock16( hmem );
|
---|
| 1112 | }
|
---|
| 1113 | FreeResource16( hmem );
|
---|
| 1114 | return ret;
|
---|
| 1115 | }
|
---|
| 1116 | #endif
|
---|
| 1117 |
|
---|
| 1118 | /***********************************************************************
|
---|
| 1119 | * DialogBoxParamA (USER32.@)
|
---|
| 1120 | */
|
---|
| 1121 | INT WINAPI DialogBoxParamA( HINSTANCE hInst, LPCSTR name,
|
---|
| 1122 | HWND owner, DLGPROC dlgProc, LPARAM param )
|
---|
| 1123 | {
|
---|
| 1124 | HWND hwnd;
|
---|
| 1125 | HANDLE hrsrc = FindResourceA( hInst, name, RT_DIALOGA );
|
---|
| 1126 | if (!hrsrc) return 0;
|
---|
| 1127 | hwnd = DIALOG_CreateIndirect( hInst, (LPVOID)LoadResource(hInst, hrsrc),
|
---|
| 1128 | owner, dlgProc, param, WIN_PROC_32A, TRUE );
|
---|
| 1129 | if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1130 | return -1;
|
---|
| 1131 | }
|
---|
| 1132 |
|
---|
| 1133 |
|
---|
| 1134 | /***********************************************************************
|
---|
| 1135 | * DialogBoxParamW (USER32.@)
|
---|
| 1136 | */
|
---|
| 1137 | INT WINAPI DialogBoxParamW( HINSTANCE hInst, LPCWSTR name,
|
---|
| 1138 | HWND owner, DLGPROC dlgProc, LPARAM param )
|
---|
| 1139 | {
|
---|
| 1140 | HWND hwnd;
|
---|
| 1141 | HANDLE hrsrc = FindResourceW( hInst, name, RT_DIALOGW );
|
---|
| 1142 | if (!hrsrc) return 0;
|
---|
| 1143 | hwnd = DIALOG_CreateIndirect( hInst, (LPVOID)LoadResource(hInst, hrsrc),
|
---|
| 1144 | owner, dlgProc, param, WIN_PROC_32W, TRUE );
|
---|
| 1145 | if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1146 | return -1;
|
---|
| 1147 | }
|
---|
| 1148 |
|
---|
| 1149 | #ifndef __WIN32OS2__
|
---|
| 1150 | /***********************************************************************
|
---|
| 1151 | * DialogBoxIndirect (USER.218)
|
---|
| 1152 | */
|
---|
| 1153 | INT16 WINAPI DialogBoxIndirect16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
|
---|
| 1154 | HWND16 owner, DLGPROC16 dlgProc )
|
---|
| 1155 | {
|
---|
| 1156 | return DialogBoxIndirectParam16( hInst, dlgTemplate, owner, dlgProc, 0 );
|
---|
| 1157 | }
|
---|
| 1158 |
|
---|
| 1159 |
|
---|
| 1160 | /***********************************************************************
|
---|
| 1161 | * DialogBoxIndirectParam (USER.240)
|
---|
| 1162 | * DialogBoxIndirectParam16 (USER32.@)
|
---|
| 1163 | */
|
---|
| 1164 | INT16 WINAPI DialogBoxIndirectParam16( HINSTANCE16 hInst, HANDLE16 dlgTemplate,
|
---|
| 1165 | HWND16 owner16, DLGPROC16 dlgProc,
|
---|
| 1166 | LPARAM param )
|
---|
| 1167 | {
|
---|
| 1168 | HWND hwnd, owner = WIN_Handle32( owner16 );
|
---|
| 1169 | LPCVOID ptr;
|
---|
| 1170 |
|
---|
| 1171 | if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
|
---|
| 1172 | hwnd = DIALOG_CreateIndirect( hInst, ptr, owner, (DLGPROC)dlgProc,
|
---|
| 1173 | param, WIN_PROC_16, TRUE );
|
---|
| 1174 | GlobalUnlock16( dlgTemplate );
|
---|
| 1175 | if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1176 | return -1;
|
---|
| 1177 | }
|
---|
| 1178 | #endif
|
---|
| 1179 |
|
---|
| 1180 | /***********************************************************************
|
---|
| 1181 | * DialogBoxIndirectParamA (USER32.@)
|
---|
| 1182 | */
|
---|
| 1183 | INT WINAPI DialogBoxIndirectParamA(HINSTANCE hInstance, LPCVOID template,
|
---|
| 1184 | HWND owner, DLGPROC dlgProc,
|
---|
| 1185 | LPARAM param )
|
---|
| 1186 | {
|
---|
| 1187 | HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner,
|
---|
| 1188 | dlgProc, param, WIN_PROC_32A, TRUE );
|
---|
| 1189 | if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1190 | return -1;
|
---|
| 1191 | }
|
---|
| 1192 |
|
---|
| 1193 |
|
---|
| 1194 | /***********************************************************************
|
---|
| 1195 | * DialogBoxIndirectParamW (USER32.@)
|
---|
| 1196 | */
|
---|
| 1197 | INT WINAPI DialogBoxIndirectParamW(HINSTANCE hInstance, LPCVOID template,
|
---|
| 1198 | HWND owner, DLGPROC dlgProc,
|
---|
| 1199 | LPARAM param )
|
---|
| 1200 | {
|
---|
| 1201 | HWND hwnd = DIALOG_CreateIndirect( hInstance, template, owner,
|
---|
| 1202 | dlgProc, param, WIN_PROC_32W, TRUE );
|
---|
| 1203 | if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1204 | return -1;
|
---|
| 1205 | }
|
---|
| 1206 |
|
---|
| 1207 | /***********************************************************************
|
---|
| 1208 | * DialogBoxIndirectParamAorW (USER32.@)
|
---|
| 1209 | */
|
---|
| 1210 | INT WINAPI DialogBoxIndirectParamAorW(HINSTANCE hInstance, LPCVOID template,
|
---|
| 1211 | HWND owner, DLGPROC dlgProc,
|
---|
| 1212 | LPARAM param, DWORD x )
|
---|
| 1213 | {
|
---|
| 1214 | HWND hwnd;
|
---|
| 1215 | FIXME("0x%08x %p 0x%08x %p 0x%08lx 0x%08lx\n",
|
---|
| 1216 | hInstance, template, owner, dlgProc, param, x);
|
---|
| 1217 | hwnd = DIALOG_CreateIndirect( hInstance, template, owner, dlgProc, param, WIN_PROC_32W, TRUE );
|
---|
| 1218 | if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
|
---|
| 1219 | return -1;
|
---|
| 1220 | }
|
---|
| 1221 |
|
---|
| 1222 | /***********************************************************************
|
---|
| 1223 | * EndDialog (USER32.@)
|
---|
| 1224 | */
|
---|
| 1225 | BOOL WINAPI EndDialog( HWND hwnd, INT retval )
|
---|
| 1226 | {
|
---|
| 1227 | BOOL wasEnabled = TRUE;
|
---|
| 1228 | DIALOGINFO * dlgInfo;
|
---|
| 1229 | HWND owner;
|
---|
| 1230 |
|
---|
| 1231 | TRACE("%04x %d\n", hwnd, retval );
|
---|
| 1232 |
|
---|
| 1233 | if (!(dlgInfo = DIALOG_get_info( hwnd )))
|
---|
| 1234 | {
|
---|
| 1235 | ERR("got invalid window handle (%04x); buggy app !?\n", hwnd);
|
---|
| 1236 | return FALSE;
|
---|
| 1237 | }
|
---|
| 1238 | dlgInfo->idResult = retval;
|
---|
| 1239 | dlgInfo->flags |= DF_END;
|
---|
| 1240 | wasEnabled = (dlgInfo->flags & DF_OWNERENABLED);
|
---|
| 1241 |
|
---|
| 1242 | if (wasEnabled && (owner = GetWindow( hwnd, GW_OWNER )))
|
---|
| 1243 | DIALOG_EnableOwner( owner );
|
---|
| 1244 |
|
---|
| 1245 | /* Windows sets the focus to the dialog itself in EndDialog */
|
---|
| 1246 |
|
---|
| 1247 | if (IsChild(hwnd, GetFocus()))
|
---|
| 1248 | SetFocus( hwnd );
|
---|
| 1249 |
|
---|
| 1250 | /* Don't have to send a ShowWindow(SW_HIDE), just do
|
---|
| 1251 | SetWindowPos with SWP_HIDEWINDOW as done in Windows */
|
---|
| 1252 |
|
---|
| 1253 | SetWindowPos(hwnd, (HWND)0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
|
---|
| 1254 | | SWP_NOZORDER | SWP_NOACTIVATE | SWP_HIDEWINDOW);
|
---|
| 1255 |
|
---|
| 1256 | /* unblock dialog loop */
|
---|
| 1257 | PostMessageA(hwnd, WM_NULL, 0, 0);
|
---|
| 1258 | return TRUE;
|
---|
| 1259 | }
|
---|
| 1260 |
|
---|
| 1261 |
|
---|
| 1262 | /***********************************************************************
|
---|
| 1263 | * DIALOG_IsAccelerator
|
---|
| 1264 | */
|
---|
| 1265 | static BOOL DIALOG_IsAccelerator( HWND hwnd, HWND hwndDlg, WPARAM vKey )
|
---|
| 1266 | {
|
---|
| 1267 | HWND hwndControl = hwnd;
|
---|
| 1268 | HWND hwndNext;
|
---|
| 1269 | INT dlgCode;
|
---|
| 1270 | WCHAR buffer[128];
|
---|
| 1271 |
|
---|
| 1272 | do
|
---|
| 1273 | {
|
---|
| 1274 | DWORD style = GetWindowLongW( hwndControl, GWL_STYLE );
|
---|
| 1275 | if ((style & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE)
|
---|
| 1276 | {
|
---|
| 1277 | dlgCode = SendMessageA( hwndControl, WM_GETDLGCODE, 0, 0 );
|
---|
| 1278 | if ( (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) &&
|
---|
| 1279 | GetWindowTextW( hwndControl, buffer, sizeof(buffer)/sizeof(WCHAR) ))
|
---|
| 1280 | {
|
---|
| 1281 | /* find the accelerator key */
|
---|
| 1282 | LPWSTR p = buffer - 2;
|
---|
| 1283 | char a_char = vKey;
|
---|
| 1284 | WCHAR w_char = 0;
|
---|
| 1285 |
|
---|
| 1286 | do
|
---|
| 1287 | {
|
---|
| 1288 | p = strchrW( p + 2, '&' );
|
---|
| 1289 | }
|
---|
| 1290 | while (p != NULL && p[1] == '&');
|
---|
| 1291 |
|
---|
| 1292 | /* and check if it's the one we're looking for */
|
---|
| 1293 | MultiByteToWideChar(CP_ACP, 0, &a_char, 1, &w_char, 1);
|
---|
| 1294 | if (p != NULL && toupperW( p[1] ) == toupperW( w_char ) )
|
---|
| 1295 | {
|
---|
| 1296 | if ((dlgCode & DLGC_STATIC) || (style & 0x0f) == BS_GROUPBOX )
|
---|
| 1297 | {
|
---|
| 1298 | /* set focus to the control */
|
---|
| 1299 | SendMessageA( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, 1);
|
---|
| 1300 | /* and bump it on to next */
|
---|
| 1301 | SendMessageA( hwndDlg, WM_NEXTDLGCTL, 0, 0);
|
---|
| 1302 | }
|
---|
| 1303 | else if (dlgCode & DLGC_BUTTON)
|
---|
| 1304 | {
|
---|
| 1305 | /* send BM_CLICK message to the control */
|
---|
| 1306 | SendMessageA( hwndControl, BM_CLICK, 0, 0 );
|
---|
| 1307 | }
|
---|
| 1308 | return TRUE;
|
---|
| 1309 | }
|
---|
| 1310 | }
|
---|
| 1311 | hwndNext = GetWindow( hwndControl, GW_CHILD );
|
---|
| 1312 | }
|
---|
| 1313 | else hwndNext = 0;
|
---|
| 1314 |
|
---|
| 1315 | if (!hwndNext) hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
|
---|
| 1316 |
|
---|
| 1317 | while (!hwndNext && hwndControl)
|
---|
| 1318 | {
|
---|
| 1319 | hwndControl = GetParent( hwndControl );
|
---|
| 1320 | if (hwndControl == hwndDlg)
|
---|
| 1321 | {
|
---|
| 1322 | if(hwnd==hwndDlg) /* prevent endless loop */
|
---|
| 1323 | {
|
---|
| 1324 | hwndNext=hwnd;
|
---|
| 1325 | break;
|
---|
| 1326 | }
|
---|
| 1327 | hwndNext = GetWindow( hwndDlg, GW_CHILD );
|
---|
| 1328 | }
|
---|
| 1329 | else
|
---|
| 1330 | hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
|
---|
| 1331 | }
|
---|
| 1332 | hwndControl = hwndNext;
|
---|
| 1333 | }
|
---|
| 1334 | while (hwndControl && (hwndControl != hwnd));
|
---|
| 1335 |
|
---|
| 1336 | return FALSE;
|
---|
| 1337 | }
|
---|
| 1338 |
|
---|
| 1339 | /***********************************************************************
|
---|
| 1340 | * DIALOG_FindMsgDestination
|
---|
| 1341 | *
|
---|
| 1342 | * The messages that IsDialogMessage sends may not go to the dialog
|
---|
| 1343 | * calling IsDialogMessage if that dialog is a child, and it has the
|
---|
| 1344 | * DS_CONTROL style set.
|
---|
| 1345 | * We propagate up until we hit one that does not have DS_CONTROL, or
|
---|
| 1346 | * whose parent is not a dialog.
|
---|
| 1347 | *
|
---|
| 1348 | * This is undocumented behaviour.
|
---|
| 1349 | */
|
---|
| 1350 | static HWND DIALOG_FindMsgDestination( HWND hwndDlg )
|
---|
| 1351 | {
|
---|
| 1352 | while (GetWindowLongA(hwndDlg, GWL_STYLE) & DS_CONTROL)
|
---|
| 1353 | {
|
---|
| 1354 | WND *pParent;
|
---|
| 1355 | HWND hParent = GetParent(hwndDlg);
|
---|
| 1356 | if (!hParent) break;
|
---|
| 1357 |
|
---|
| 1358 | pParent = WIN_FindWndPtr(hParent);
|
---|
| 1359 | if (!pParent) break;
|
---|
| 1360 |
|
---|
| 1361 | if (!(pParent->flags & WIN_ISDIALOG))
|
---|
| 1362 | {
|
---|
| 1363 | WIN_ReleaseWndPtr(pParent);
|
---|
| 1364 | break;
|
---|
| 1365 | }
|
---|
| 1366 | WIN_ReleaseWndPtr(pParent);
|
---|
| 1367 |
|
---|
| 1368 | hwndDlg = hParent;
|
---|
| 1369 | }
|
---|
| 1370 |
|
---|
| 1371 | return hwndDlg;
|
---|
| 1372 | }
|
---|
| 1373 |
|
---|
| 1374 | /***********************************************************************
|
---|
| 1375 | * DIALOG_IsDialogMessage
|
---|
| 1376 | */
|
---|
| 1377 | static BOOL DIALOG_IsDialogMessage( HWND hwnd, HWND hwndDlg,
|
---|
| 1378 | UINT message, WPARAM wParam,
|
---|
| 1379 | LPARAM lParam, BOOL *translate,
|
---|
| 1380 | BOOL *dispatch, INT dlgCode )
|
---|
| 1381 | {
|
---|
| 1382 | *translate = *dispatch = FALSE;
|
---|
| 1383 |
|
---|
| 1384 | if (message == WM_PAINT)
|
---|
| 1385 | {
|
---|
| 1386 | /* Apparently, we have to handle this one as well */
|
---|
| 1387 | *dispatch = TRUE;
|
---|
| 1388 | return TRUE;
|
---|
| 1389 | }
|
---|
| 1390 |
|
---|
| 1391 | /* Only the key messages get special processing */
|
---|
| 1392 | if ((message != WM_KEYDOWN) &&
|
---|
| 1393 | (message != WM_SYSKEYDOWN) &&
|
---|
| 1394 | (message != WM_SYSCHAR) &&
|
---|
| 1395 | (message != WM_CHAR))
|
---|
| 1396 | return FALSE;
|
---|
| 1397 |
|
---|
| 1398 | if (dlgCode & DLGC_WANTMESSAGE)
|
---|
| 1399 | {
|
---|
| 1400 | *translate = *dispatch = TRUE;
|
---|
| 1401 | return TRUE;
|
---|
| 1402 | }
|
---|
| 1403 |
|
---|
| 1404 | hwndDlg = DIALOG_FindMsgDestination(hwndDlg);
|
---|
| 1405 |
|
---|
| 1406 | switch(message)
|
---|
| 1407 | {
|
---|
| 1408 | case WM_KEYDOWN:
|
---|
| 1409 | switch(wParam)
|
---|
| 1410 | {
|
---|
| 1411 | case VK_TAB:
|
---|
| 1412 | if (!(dlgCode & DLGC_WANTTAB))
|
---|
| 1413 | {
|
---|
| 1414 | SendMessageA( hwndDlg, WM_NEXTDLGCTL,
|
---|
| 1415 | (GetKeyState(VK_SHIFT) & 0x8000), 0 );
|
---|
| 1416 | return TRUE;
|
---|
| 1417 | }
|
---|
| 1418 | break;
|
---|
| 1419 |
|
---|
| 1420 | case VK_RIGHT:
|
---|
| 1421 | case VK_DOWN:
|
---|
| 1422 | case VK_LEFT:
|
---|
| 1423 | case VK_UP:
|
---|
| 1424 | if (!(dlgCode & DLGC_WANTARROWS))
|
---|
| 1425 | {
|
---|
| 1426 | BOOL fPrevious = (wParam == VK_LEFT || wParam == VK_UP);
|
---|
| 1427 | HWND hwndNext =
|
---|
| 1428 | GetNextDlgGroupItem (hwndDlg, GetFocus(), fPrevious );
|
---|
| 1429 | SendMessageA( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
|
---|
| 1430 | return TRUE;
|
---|
| 1431 | }
|
---|
| 1432 | break;
|
---|
| 1433 |
|
---|
| 1434 | case VK_ESCAPE:
|
---|
| 1435 | SendMessageA( hwndDlg, WM_COMMAND, IDCANCEL,
|
---|
| 1436 | (LPARAM)GetDlgItem( hwndDlg, IDCANCEL ) );
|
---|
| 1437 | return TRUE;
|
---|
| 1438 |
|
---|
| 1439 | case VK_RETURN:
|
---|
| 1440 | {
|
---|
| 1441 | DWORD dw = SendMessageW( hwndDlg, DM_GETDEFID, 0, 0 );
|
---|
| 1442 | if (HIWORD(dw) == DC_HASDEFID)
|
---|
| 1443 | {
|
---|
| 1444 | SendMessageA( hwndDlg, WM_COMMAND,
|
---|
| 1445 | MAKEWPARAM( LOWORD(dw), BN_CLICKED ),
|
---|
| 1446 | (LPARAM)GetDlgItem(hwndDlg, LOWORD(dw)));
|
---|
| 1447 | }
|
---|
| 1448 | else
|
---|
| 1449 | {
|
---|
| 1450 | SendMessageA( hwndDlg, WM_COMMAND, IDOK,
|
---|
| 1451 | (LPARAM)GetDlgItem( hwndDlg, IDOK ) );
|
---|
| 1452 |
|
---|
| 1453 | }
|
---|
| 1454 | }
|
---|
| 1455 | return TRUE;
|
---|
| 1456 | }
|
---|
| 1457 | *translate = TRUE;
|
---|
| 1458 | break; /* case WM_KEYDOWN */
|
---|
| 1459 |
|
---|
| 1460 | case WM_CHAR:
|
---|
| 1461 | if (dlgCode & DLGC_WANTCHARS) break;
|
---|
| 1462 | /* drop through */
|
---|
| 1463 |
|
---|
| 1464 | case WM_SYSCHAR:
|
---|
| 1465 | if (DIALOG_IsAccelerator( WIN_GetFullHandle(hwnd), hwndDlg, wParam ))
|
---|
| 1466 | {
|
---|
| 1467 | /* don't translate or dispatch */
|
---|
| 1468 | return TRUE;
|
---|
| 1469 | }
|
---|
| 1470 | break;
|
---|
| 1471 |
|
---|
| 1472 | case WM_SYSKEYDOWN:
|
---|
| 1473 | *translate = TRUE;
|
---|
| 1474 | break;
|
---|
| 1475 | }
|
---|
| 1476 |
|
---|
| 1477 | /* If we get here, the message has not been treated specially */
|
---|
| 1478 | /* and can be sent to its destination window. */
|
---|
| 1479 | *dispatch = TRUE;
|
---|
| 1480 | return TRUE;
|
---|
| 1481 | }
|
---|
| 1482 |
|
---|
| 1483 | #ifndef __WIN32OS2__
|
---|
| 1484 | /***********************************************************************
|
---|
| 1485 | * IsDialogMessage (USER.90)
|
---|
| 1486 | */
|
---|
| 1487 | BOOL16 WINAPI IsDialogMessage16( HWND16 hwndDlg, SEGPTR msg16 )
|
---|
| 1488 | {
|
---|
| 1489 | LPMSG16 msg = MapSL(msg16);
|
---|
| 1490 | BOOL ret, translate, dispatch;
|
---|
| 1491 | INT dlgCode = 0;
|
---|
| 1492 |
|
---|
| 1493 | if ((hwndDlg != msg->hwnd) && !IsChild16( hwndDlg, msg->hwnd ))
|
---|
| 1494 | return FALSE;
|
---|
| 1495 |
|
---|
| 1496 | if ((msg->message == WM_KEYDOWN) ||
|
---|
| 1497 | (msg->message == WM_CHAR))
|
---|
| 1498 | {
|
---|
| 1499 | dlgCode = SendMessage16( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg16);
|
---|
| 1500 | }
|
---|
| 1501 | ret = DIALOG_IsDialogMessage( WIN_Handle32(msg->hwnd), WIN_Handle32(hwndDlg),
|
---|
| 1502 | msg->message, msg->wParam, msg->lParam,
|
---|
| 1503 | &translate, &dispatch, dlgCode );
|
---|
| 1504 | if (translate) TranslateMessage16( msg );
|
---|
| 1505 | if (dispatch) DispatchMessage16( msg );
|
---|
| 1506 | return ret;
|
---|
| 1507 | }
|
---|
| 1508 | #endif
|
---|
| 1509 |
|
---|
| 1510 | /***********************************************************************
|
---|
| 1511 | * IsDialogMessage (USER32.@)
|
---|
| 1512 | * IsDialogMessageA (USER32.@)
|
---|
| 1513 | */
|
---|
| 1514 | BOOL WINAPI IsDialogMessageA( HWND hwndDlg, LPMSG msg )
|
---|
| 1515 | {
|
---|
| 1516 | BOOL ret, translate, dispatch;
|
---|
| 1517 | INT dlgCode = 0;
|
---|
| 1518 |
|
---|
| 1519 | hwndDlg = WIN_GetFullHandle( hwndDlg );
|
---|
| 1520 | if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
|
---|
| 1521 | return FALSE;
|
---|
| 1522 |
|
---|
| 1523 | if ((msg->message == WM_KEYDOWN) ||
|
---|
| 1524 | (msg->message == WM_CHAR))
|
---|
| 1525 | {
|
---|
| 1526 | dlgCode = SendMessageA( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
|
---|
| 1527 | }
|
---|
| 1528 | ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
|
---|
| 1529 | msg->wParam, msg->lParam,
|
---|
| 1530 | &translate, &dispatch, dlgCode );
|
---|
| 1531 | if (translate) TranslateMessage( msg );
|
---|
| 1532 | if (dispatch) DispatchMessageA( msg );
|
---|
| 1533 | return ret;
|
---|
| 1534 | }
|
---|
| 1535 |
|
---|
| 1536 |
|
---|
| 1537 | /***********************************************************************
|
---|
| 1538 | * IsDialogMessageW (USER32.@)
|
---|
| 1539 | */
|
---|
| 1540 | BOOL WINAPI IsDialogMessageW( HWND hwndDlg, LPMSG msg )
|
---|
| 1541 | {
|
---|
| 1542 | BOOL ret, translate, dispatch;
|
---|
| 1543 | INT dlgCode = 0;
|
---|
| 1544 |
|
---|
| 1545 | hwndDlg = WIN_GetFullHandle( hwndDlg );
|
---|
| 1546 | if ((hwndDlg != msg->hwnd) && !IsChild( hwndDlg, msg->hwnd ))
|
---|
| 1547 | return FALSE;
|
---|
| 1548 |
|
---|
| 1549 | if ((msg->message == WM_KEYDOWN) ||
|
---|
| 1550 | (msg->message == WM_CHAR))
|
---|
| 1551 | {
|
---|
| 1552 | dlgCode = SendMessageW( msg->hwnd, WM_GETDLGCODE, 0, (LPARAM)msg);
|
---|
| 1553 | }
|
---|
| 1554 | ret = DIALOG_IsDialogMessage( msg->hwnd, hwndDlg, msg->message,
|
---|
| 1555 | msg->wParam, msg->lParam,
|
---|
| 1556 | &translate, &dispatch, dlgCode );
|
---|
| 1557 | if (translate) TranslateMessage( msg );
|
---|
| 1558 | if (dispatch) DispatchMessageW( msg );
|
---|
| 1559 | return ret;
|
---|
| 1560 | }
|
---|
| 1561 |
|
---|
| 1562 |
|
---|
| 1563 | /***********************************************************************
|
---|
| 1564 | * GetDlgCtrlID (USER32.@)
|
---|
| 1565 | */
|
---|
| 1566 | INT WINAPI GetDlgCtrlID( HWND hwnd )
|
---|
| 1567 | {
|
---|
| 1568 | return GetWindowLongW( hwnd, GWL_ID );
|
---|
| 1569 | }
|
---|
| 1570 |
|
---|
| 1571 |
|
---|
| 1572 | /***********************************************************************
|
---|
| 1573 | * GetDlgItem (USER32.@)
|
---|
| 1574 | */
|
---|
| 1575 | HWND WINAPI GetDlgItem( HWND hwndDlg, INT id )
|
---|
| 1576 | {
|
---|
| 1577 | int i;
|
---|
| 1578 | HWND *list = WIN_ListChildren( hwndDlg );
|
---|
| 1579 | HWND ret = 0;
|
---|
| 1580 |
|
---|
| 1581 | if (!list) return 0;
|
---|
| 1582 |
|
---|
| 1583 | for (i = 0; list[i]; i++) if (GetWindowLongW( list[i], GWL_ID ) == id) break;
|
---|
| 1584 | ret = list[i];
|
---|
| 1585 | HeapFree( GetProcessHeap(), 0, list );
|
---|
| 1586 | return ret;
|
---|
| 1587 | }
|
---|
| 1588 |
|
---|
| 1589 |
|
---|
| 1590 | /*******************************************************************
|
---|
| 1591 | * SendDlgItemMessageA (USER32.@)
|
---|
| 1592 | */
|
---|
| 1593 | LRESULT WINAPI SendDlgItemMessageA( HWND hwnd, INT id, UINT msg,
|
---|
| 1594 | WPARAM wParam, LPARAM lParam )
|
---|
| 1595 | {
|
---|
| 1596 | HWND hwndCtrl = GetDlgItem( hwnd, id );
|
---|
| 1597 | if (hwndCtrl) return SendMessageA( hwndCtrl, msg, wParam, lParam );
|
---|
| 1598 | else return 0;
|
---|
| 1599 | }
|
---|
| 1600 |
|
---|
| 1601 |
|
---|
| 1602 | /*******************************************************************
|
---|
| 1603 | * SendDlgItemMessageW (USER32.@)
|
---|
| 1604 | */
|
---|
| 1605 | LRESULT WINAPI SendDlgItemMessageW( HWND hwnd, INT id, UINT msg,
|
---|
| 1606 | WPARAM wParam, LPARAM lParam )
|
---|
| 1607 | {
|
---|
| 1608 | HWND hwndCtrl = GetDlgItem( hwnd, id );
|
---|
| 1609 | if (hwndCtrl) return SendMessageW( hwndCtrl, msg, wParam, lParam );
|
---|
| 1610 | else return 0;
|
---|
| 1611 | }
|
---|
| 1612 |
|
---|
| 1613 |
|
---|
| 1614 | /*******************************************************************
|
---|
| 1615 | * SetDlgItemTextA (USER32.@)
|
---|
| 1616 | */
|
---|
| 1617 | BOOL WINAPI SetDlgItemTextA( HWND hwnd, INT id, LPCSTR lpString )
|
---|
| 1618 | {
|
---|
| 1619 | return SendDlgItemMessageA( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
|
---|
| 1620 | }
|
---|
| 1621 |
|
---|
| 1622 |
|
---|
| 1623 | /*******************************************************************
|
---|
| 1624 | * SetDlgItemTextW (USER32.@)
|
---|
| 1625 | */
|
---|
| 1626 | BOOL WINAPI SetDlgItemTextW( HWND hwnd, INT id, LPCWSTR lpString )
|
---|
| 1627 | {
|
---|
| 1628 | return SendDlgItemMessageW( hwnd, id, WM_SETTEXT, 0, (LPARAM)lpString );
|
---|
| 1629 | }
|
---|
| 1630 |
|
---|
| 1631 |
|
---|
| 1632 | /***********************************************************************
|
---|
| 1633 | * GetDlgItemTextA (USER32.@)
|
---|
| 1634 | */
|
---|
| 1635 | INT WINAPI GetDlgItemTextA( HWND hwnd, INT id, LPSTR str, UINT len )
|
---|
| 1636 | {
|
---|
| 1637 | return (INT)SendDlgItemMessageA( hwnd, id, WM_GETTEXT,
|
---|
| 1638 | len, (LPARAM)str );
|
---|
| 1639 | }
|
---|
| 1640 |
|
---|
| 1641 |
|
---|
| 1642 | /***********************************************************************
|
---|
| 1643 | * GetDlgItemTextW (USER32.@)
|
---|
| 1644 | */
|
---|
| 1645 | INT WINAPI GetDlgItemTextW( HWND hwnd, INT id, LPWSTR str, UINT len )
|
---|
| 1646 | {
|
---|
| 1647 | return (INT)SendDlgItemMessageW( hwnd, id, WM_GETTEXT,
|
---|
| 1648 | len, (LPARAM)str );
|
---|
| 1649 | }
|
---|
| 1650 |
|
---|
| 1651 |
|
---|
| 1652 | /*******************************************************************
|
---|
| 1653 | * SetDlgItemInt (USER32.@)
|
---|
| 1654 | */
|
---|
| 1655 | BOOL WINAPI SetDlgItemInt( HWND hwnd, INT id, UINT value,
|
---|
| 1656 | BOOL fSigned )
|
---|
| 1657 | {
|
---|
| 1658 | char str[20];
|
---|
| 1659 |
|
---|
| 1660 | if (fSigned) sprintf( str, "%d", (INT)value );
|
---|
| 1661 | else sprintf( str, "%u", value );
|
---|
| 1662 | SendDlgItemMessageA( hwnd, id, WM_SETTEXT, 0, (LPARAM)str );
|
---|
| 1663 | return TRUE;
|
---|
| 1664 | }
|
---|
| 1665 |
|
---|
| 1666 |
|
---|
| 1667 | /***********************************************************************
|
---|
| 1668 | * GetDlgItemInt (USER32.@)
|
---|
| 1669 | */
|
---|
| 1670 | UINT WINAPI GetDlgItemInt( HWND hwnd, INT id, BOOL *translated,
|
---|
| 1671 | BOOL fSigned )
|
---|
| 1672 | {
|
---|
| 1673 | char str[30];
|
---|
| 1674 | char * endptr;
|
---|
| 1675 | long result = 0;
|
---|
| 1676 |
|
---|
| 1677 | if (translated) *translated = FALSE;
|
---|
| 1678 | if (!SendDlgItemMessageA(hwnd, id, WM_GETTEXT, sizeof(str), (LPARAM)str))
|
---|
| 1679 | return 0;
|
---|
| 1680 | if (fSigned)
|
---|
| 1681 | {
|
---|
| 1682 | result = strtol( str, &endptr, 10 );
|
---|
| 1683 | if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
|
---|
| 1684 | return 0;
|
---|
| 1685 | if (((result == LONG_MIN) || (result == LONG_MAX)) && (errno==ERANGE))
|
---|
| 1686 | return 0;
|
---|
| 1687 | }
|
---|
| 1688 | else
|
---|
| 1689 | {
|
---|
| 1690 | result = strtoul( str, &endptr, 10 );
|
---|
| 1691 | if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
|
---|
| 1692 | return 0;
|
---|
| 1693 | if ((result == ULONG_MAX) && (errno == ERANGE)) return 0;
|
---|
| 1694 | }
|
---|
| 1695 | if (translated) *translated = TRUE;
|
---|
| 1696 | return (UINT)result;
|
---|
| 1697 | }
|
---|
| 1698 |
|
---|
| 1699 |
|
---|
| 1700 | /***********************************************************************
|
---|
| 1701 | * CheckDlgButton (USER32.@)
|
---|
| 1702 | */
|
---|
| 1703 | BOOL WINAPI CheckDlgButton( HWND hwnd, INT id, UINT check )
|
---|
| 1704 | {
|
---|
| 1705 | SendDlgItemMessageA( hwnd, id, BM_SETCHECK, check, 0 );
|
---|
| 1706 | return TRUE;
|
---|
| 1707 | }
|
---|
| 1708 |
|
---|
| 1709 |
|
---|
| 1710 | /***********************************************************************
|
---|
| 1711 | * IsDlgButtonChecked (USER32.@)
|
---|
| 1712 | */
|
---|
| 1713 | UINT WINAPI IsDlgButtonChecked( HWND hwnd, UINT id )
|
---|
| 1714 | {
|
---|
| 1715 | return (UINT)SendDlgItemMessageA( hwnd, id, BM_GETCHECK, 0, 0 );
|
---|
| 1716 | }
|
---|
| 1717 |
|
---|
| 1718 |
|
---|
| 1719 | /***********************************************************************
|
---|
| 1720 | * CheckRB
|
---|
| 1721 | *
|
---|
| 1722 | * Callback function used to check/uncheck radio buttons that fall
|
---|
| 1723 | * within a specific range of IDs.
|
---|
| 1724 | */
|
---|
| 1725 | static BOOL CALLBACK CheckRB(HWND hwndChild, LPARAM lParam)
|
---|
| 1726 | {
|
---|
| 1727 | LONG lChildID = GetWindowLongA(hwndChild, GWL_ID);
|
---|
| 1728 | RADIOGROUP *lpRadioGroup = (RADIOGROUP *) lParam;
|
---|
| 1729 |
|
---|
| 1730 | if ((lChildID >= lpRadioGroup->firstID) &&
|
---|
| 1731 | (lChildID <= lpRadioGroup->lastID))
|
---|
| 1732 | {
|
---|
| 1733 | if (lChildID == lpRadioGroup->checkID)
|
---|
| 1734 | {
|
---|
| 1735 | SendMessageA(hwndChild, BM_SETCHECK, BST_CHECKED, 0);
|
---|
| 1736 | }
|
---|
| 1737 | else
|
---|
| 1738 | {
|
---|
| 1739 | SendMessageA(hwndChild, BM_SETCHECK, BST_UNCHECKED, 0);
|
---|
| 1740 | }
|
---|
| 1741 | }
|
---|
| 1742 |
|
---|
| 1743 | return TRUE;
|
---|
| 1744 | }
|
---|
| 1745 |
|
---|
| 1746 |
|
---|
| 1747 | /***********************************************************************
|
---|
| 1748 | * CheckRadioButton (USER32.@)
|
---|
| 1749 | */
|
---|
| 1750 | BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
|
---|
| 1751 | UINT lastID, UINT checkID )
|
---|
| 1752 | {
|
---|
| 1753 | RADIOGROUP radioGroup;
|
---|
| 1754 |
|
---|
| 1755 | /* perform bounds checking for a radio button group */
|
---|
| 1756 | radioGroup.firstID = min(min(firstID, lastID), checkID);
|
---|
| 1757 | radioGroup.lastID = max(max(firstID, lastID), checkID);
|
---|
| 1758 | radioGroup.checkID = checkID;
|
---|
| 1759 |
|
---|
| 1760 | return EnumChildWindows(hwndDlg, (WNDENUMPROC)CheckRB,
|
---|
| 1761 | (LPARAM)&radioGroup);
|
---|
| 1762 | }
|
---|
| 1763 |
|
---|
| 1764 |
|
---|
| 1765 | /***********************************************************************
|
---|
| 1766 | * GetDialogBaseUnits (USER.243)
|
---|
| 1767 | * GetDialogBaseUnits (USER32.@)
|
---|
| 1768 | */
|
---|
| 1769 | DWORD WINAPI GetDialogBaseUnits(void)
|
---|
| 1770 | {
|
---|
| 1771 | return MAKELONG( xBaseUnit, yBaseUnit );
|
---|
| 1772 | }
|
---|
| 1773 |
|
---|
| 1774 |
|
---|
| 1775 | /***********************************************************************
|
---|
| 1776 | * MapDialogRect (USER32.@)
|
---|
| 1777 | */
|
---|
| 1778 | BOOL WINAPI MapDialogRect( HWND hwnd, LPRECT rect )
|
---|
| 1779 | {
|
---|
| 1780 | DIALOGINFO * dlgInfo;
|
---|
| 1781 | if (!(dlgInfo = DIALOG_get_info( hwnd ))) return FALSE;
|
---|
| 1782 | rect->left = MulDiv(rect->left, dlgInfo->xBaseUnit, 4);
|
---|
| 1783 | rect->right = MulDiv(rect->right, dlgInfo->xBaseUnit, 4);
|
---|
| 1784 | rect->top = MulDiv(rect->top, dlgInfo->yBaseUnit, 8);
|
---|
| 1785 | rect->bottom = MulDiv(rect->bottom, dlgInfo->yBaseUnit, 8);
|
---|
| 1786 | return TRUE;
|
---|
| 1787 | }
|
---|
| 1788 |
|
---|
| 1789 |
|
---|
| 1790 | /***********************************************************************
|
---|
| 1791 | * GetNextDlgGroupItem (USER32.@)
|
---|
| 1792 | */
|
---|
| 1793 | HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
|
---|
| 1794 | {
|
---|
| 1795 | HWND hwnd, retvalue;
|
---|
| 1796 |
|
---|
| 1797 | hwndDlg = WIN_GetFullHandle( hwndDlg );
|
---|
| 1798 | hwndCtrl = WIN_GetFullHandle( hwndCtrl );
|
---|
| 1799 |
|
---|
| 1800 | if(hwndCtrl)
|
---|
| 1801 | {
|
---|
| 1802 | /* if the hwndCtrl is the child of the control in the hwndDlg,
|
---|
| 1803 | * then the hwndDlg has to be the parent of the hwndCtrl */
|
---|
| 1804 | if(GetParent(hwndCtrl) != hwndDlg && GetParent(GetParent(hwndCtrl)) == hwndDlg)
|
---|
| 1805 | hwndDlg = GetParent(hwndCtrl);
|
---|
| 1806 | }
|
---|
| 1807 |
|
---|
| 1808 | if (hwndCtrl)
|
---|
| 1809 | {
|
---|
| 1810 | /* Make sure hwndCtrl is a top-level child */
|
---|
| 1811 | HWND parent = GetParent( hwndCtrl );
|
---|
| 1812 | while (parent && parent != hwndDlg) parent = GetParent(parent);
|
---|
| 1813 | if (parent != hwndDlg) return 0;
|
---|
| 1814 | }
|
---|
| 1815 | else
|
---|
| 1816 | {
|
---|
| 1817 | /* No ctrl specified -> start from the beginning */
|
---|
| 1818 | if (!(hwndCtrl = GetWindow( hwndDlg, GW_CHILD ))) return 0;
|
---|
| 1819 | if (fPrevious) hwndCtrl = GetWindow( hwndCtrl, GW_HWNDLAST );
|
---|
| 1820 | }
|
---|
| 1821 |
|
---|
| 1822 | retvalue = hwndCtrl;
|
---|
| 1823 | hwnd = GetWindow( hwndCtrl, GW_HWNDNEXT );
|
---|
| 1824 | while (1)
|
---|
| 1825 | {
|
---|
| 1826 | if (!hwnd || (GetWindowLongW( hwnd, GWL_STYLE ) & WS_GROUP))
|
---|
| 1827 | {
|
---|
| 1828 | /* Wrap-around to the beginning of the group */
|
---|
| 1829 | HWND tmp;
|
---|
| 1830 |
|
---|
| 1831 | hwnd = GetWindow( hwndDlg, GW_CHILD );
|
---|
| 1832 | for (tmp = hwnd; tmp; tmp = GetWindow( tmp, GW_HWNDNEXT ) )
|
---|
| 1833 | {
|
---|
| 1834 | if (GetWindowLongW( tmp, GWL_STYLE ) & WS_GROUP) hwnd = tmp;
|
---|
| 1835 | if (tmp == hwndCtrl) break;
|
---|
| 1836 | }
|
---|
| 1837 | }
|
---|
| 1838 | if (hwnd == hwndCtrl) break;
|
---|
| 1839 | if ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_VISIBLE|WS_DISABLED)) == WS_VISIBLE)
|
---|
| 1840 | {
|
---|
| 1841 | retvalue = hwnd;
|
---|
| 1842 | if (!fPrevious) break;
|
---|
| 1843 | }
|
---|
| 1844 | hwnd = GetWindow( hwnd, GW_HWNDNEXT );
|
---|
| 1845 | }
|
---|
| 1846 | return retvalue;
|
---|
| 1847 | }
|
---|
| 1848 |
|
---|
| 1849 |
|
---|
| 1850 | /***********************************************************************
|
---|
| 1851 | * DIALOG_GetNextTabItem
|
---|
| 1852 | *
|
---|
| 1853 | * Helper for GetNextDlgTabItem
|
---|
| 1854 | */
|
---|
| 1855 | static HWND DIALOG_GetNextTabItem( HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious )
|
---|
| 1856 | {
|
---|
| 1857 | LONG dsStyle;
|
---|
| 1858 | LONG exStyle;
|
---|
| 1859 | UINT wndSearch = fPrevious ? GW_HWNDPREV : GW_HWNDNEXT;
|
---|
| 1860 | HWND retWnd = 0;
|
---|
| 1861 | HWND hChildFirst = 0;
|
---|
| 1862 |
|
---|
| 1863 | if(!hwndCtrl)
|
---|
| 1864 | {
|
---|
| 1865 | hChildFirst = GetWindow(hwndDlg,GW_CHILD);
|
---|
| 1866 | if(fPrevious) hChildFirst = GetWindow(hChildFirst,GW_HWNDLAST);
|
---|
| 1867 | }
|
---|
| 1868 | else if (IsChild( hwndMain, hwndCtrl ))
|
---|
| 1869 | {
|
---|
| 1870 | hChildFirst = GetWindow(hwndCtrl,wndSearch);
|
---|
| 1871 | if(!hChildFirst)
|
---|
| 1872 | {
|
---|
| 1873 | if(GetParent(hwndCtrl) != hwndMain)
|
---|
| 1874 | hChildFirst = GetWindow(GetParent(hwndCtrl),wndSearch);
|
---|
| 1875 | else
|
---|
| 1876 | {
|
---|
| 1877 | if(fPrevious)
|
---|
| 1878 | hChildFirst = GetWindow(hwndCtrl,GW_HWNDLAST);
|
---|
| 1879 | else
|
---|
| 1880 | hChildFirst = GetWindow(hwndCtrl,GW_HWNDFIRST);
|
---|
| 1881 | }
|
---|
| 1882 | }
|
---|
| 1883 | }
|
---|
| 1884 |
|
---|
| 1885 | while(hChildFirst)
|
---|
| 1886 | {
|
---|
| 1887 | BOOL bCtrl = FALSE;
|
---|
| 1888 | while(hChildFirst)
|
---|
| 1889 | {
|
---|
| 1890 | dsStyle = GetWindowLongA(hChildFirst,GWL_STYLE);
|
---|
| 1891 | exStyle = GetWindowLongA(hChildFirst,GWL_EXSTYLE);
|
---|
| 1892 | if( (dsStyle & DS_CONTROL || exStyle & WS_EX_CONTROLPARENT) && (dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED))
|
---|
| 1893 | {
|
---|
| 1894 | bCtrl=TRUE;
|
---|
| 1895 | break;
|
---|
| 1896 | }
|
---|
| 1897 | else if( (dsStyle & WS_TABSTOP) && (dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED))
|
---|
| 1898 | break;
|
---|
| 1899 | hChildFirst = GetWindow(hChildFirst,wndSearch);
|
---|
| 1900 | }
|
---|
| 1901 | if(hChildFirst)
|
---|
| 1902 | {
|
---|
| 1903 | if(bCtrl)
|
---|
| 1904 | retWnd = DIALOG_GetNextTabItem(hwndMain,hChildFirst,(HWND)NULL,fPrevious );
|
---|
| 1905 | else
|
---|
| 1906 | retWnd = hChildFirst;
|
---|
| 1907 | }
|
---|
| 1908 | if(retWnd) break;
|
---|
| 1909 | hChildFirst = GetWindow(hChildFirst,wndSearch);
|
---|
| 1910 | }
|
---|
| 1911 | if(!retWnd && hwndCtrl)
|
---|
| 1912 | {
|
---|
| 1913 | HWND hParent = GetParent(hwndCtrl);
|
---|
| 1914 | while(hParent)
|
---|
| 1915 | {
|
---|
| 1916 | if(hParent == hwndMain) break;
|
---|
| 1917 | retWnd = DIALOG_GetNextTabItem(hwndMain,GetParent(hParent),hParent,fPrevious );
|
---|
| 1918 | if(retWnd) break;
|
---|
| 1919 | hParent = GetParent(hParent);
|
---|
| 1920 | }
|
---|
| 1921 | if(!retWnd)
|
---|
| 1922 | retWnd = DIALOG_GetNextTabItem(hwndMain,hwndMain,(HWND)NULL,fPrevious );
|
---|
| 1923 | }
|
---|
| 1924 | return retWnd;
|
---|
| 1925 | }
|
---|
| 1926 |
|
---|
| 1927 | /***********************************************************************
|
---|
| 1928 | * GetNextDlgTabItem (USER32.@)
|
---|
| 1929 | */
|
---|
| 1930 | HWND WINAPI GetNextDlgTabItem( HWND hwndDlg, HWND hwndCtrl,
|
---|
| 1931 | BOOL fPrevious )
|
---|
| 1932 | {
|
---|
| 1933 | hwndDlg = WIN_GetFullHandle( hwndDlg );
|
---|
| 1934 | hwndCtrl = WIN_GetFullHandle( hwndCtrl );
|
---|
| 1935 | return DIALOG_GetNextTabItem(hwndDlg,hwndDlg,hwndCtrl,fPrevious);
|
---|
| 1936 | }
|
---|
| 1937 |
|
---|
| 1938 | /**********************************************************************
|
---|
| 1939 | * DIALOG_DlgDirSelect
|
---|
| 1940 | *
|
---|
| 1941 | * Helper function for DlgDirSelect*
|
---|
| 1942 | */
|
---|
| 1943 | static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPSTR str, INT len,
|
---|
| 1944 | INT id, BOOL unicode, BOOL combo )
|
---|
| 1945 | {
|
---|
| 1946 | char *buffer, *ptr;
|
---|
| 1947 | INT item, size;
|
---|
| 1948 | BOOL ret;
|
---|
| 1949 | HWND listbox = GetDlgItem( hwnd, id );
|
---|
| 1950 |
|
---|
| 1951 | TRACE("%04x '%s' %d\n", hwnd, str, id );
|
---|
| 1952 | if (!listbox) return FALSE;
|
---|
| 1953 |
|
---|
| 1954 | item = SendMessageA(listbox, combo ? CB_GETCURSEL : LB_GETCURSEL, 0, 0 );
|
---|
| 1955 | if (item == LB_ERR) return FALSE;
|
---|
| 1956 | size = SendMessageA(listbox, combo ? CB_GETLBTEXTLEN : LB_GETTEXTLEN, 0, 0 );
|
---|
| 1957 | if (size == LB_ERR) return FALSE;
|
---|
| 1958 |
|
---|
| 1959 | if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size+1 ))) return FALSE;
|
---|
| 1960 |
|
---|
| 1961 | SendMessageA( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT, item, (LPARAM)buffer );
|
---|
| 1962 |
|
---|
| 1963 | if ((ret = (buffer[0] == '['))) /* drive or directory */
|
---|
| 1964 | {
|
---|
| 1965 | if (buffer[1] == '-') /* drive */
|
---|
| 1966 | {
|
---|
| 1967 | buffer[3] = ':';
|
---|
| 1968 | buffer[4] = 0;
|
---|
| 1969 | ptr = buffer + 2;
|
---|
| 1970 | }
|
---|
| 1971 | else
|
---|
| 1972 | {
|
---|
| 1973 | buffer[strlen(buffer)-1] = '\\';
|
---|
| 1974 | ptr = buffer + 1;
|
---|
| 1975 | }
|
---|
| 1976 | }
|
---|
| 1977 | else ptr = buffer;
|
---|
| 1978 |
|
---|
| 1979 | if (unicode)
|
---|
| 1980 | {
|
---|
| 1981 | if (len > 0 && !MultiByteToWideChar( CP_ACP, 0, ptr, -1, (LPWSTR)str, len ))
|
---|
| 1982 | ((LPWSTR)str)[len-1] = 0;
|
---|
| 1983 | }
|
---|
| 1984 | else lstrcpynA( str, ptr, len );
|
---|
| 1985 | HeapFree( GetProcessHeap(), 0, buffer );
|
---|
| 1986 | TRACE("Returning %d '%s'\n", ret, str );
|
---|
| 1987 | return ret;
|
---|
| 1988 | }
|
---|
| 1989 |
|
---|
| 1990 |
|
---|
| 1991 | /**********************************************************************
|
---|
| 1992 | * DIALOG_DlgDirList
|
---|
| 1993 | *
|
---|
| 1994 | * Helper function for DlgDirList*
|
---|
| 1995 | */
|
---|
| 1996 | static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox,
|
---|
| 1997 | INT idStatic, UINT attrib, BOOL combo )
|
---|
| 1998 | {
|
---|
| 1999 | HWND hwnd;
|
---|
| 2000 | LPSTR orig_spec = spec;
|
---|
| 2001 |
|
---|
| 2002 | #define SENDMSG(msg,wparam,lparam) \
|
---|
| 2003 | ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
|
---|
| 2004 | : SendMessageA( hwnd, msg, wparam, lparam ))
|
---|
| 2005 |
|
---|
| 2006 | TRACE("%04x '%s' %d %d %04x\n",
|
---|
| 2007 | hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
|
---|
| 2008 |
|
---|
| 2009 | /* If the path exists and is a directory, chdir to it */
|
---|
| 2010 | if (!spec || !spec[0] || SetCurrentDirectoryA( spec )) spec = "*.*";
|
---|
| 2011 | else
|
---|
| 2012 | {
|
---|
| 2013 | char *p, *p2;
|
---|
| 2014 | p = spec;
|
---|
| 2015 | if ((p2 = strrchr( p, '\\' ))) p = p2;
|
---|
| 2016 | if ((p2 = strrchr( p, '/' ))) p = p2;
|
---|
| 2017 | if (p != spec)
|
---|
| 2018 | {
|
---|
| 2019 | char sep = *p;
|
---|
| 2020 | *p = 0;
|
---|
| 2021 | if (!SetCurrentDirectoryA( spec ))
|
---|
| 2022 | {
|
---|
| 2023 | *p = sep; /* Restore the original spec */
|
---|
| 2024 | return FALSE;
|
---|
| 2025 | }
|
---|
| 2026 | spec = p + 1;
|
---|
| 2027 | }
|
---|
| 2028 | }
|
---|
| 2029 |
|
---|
| 2030 | TRACE( "mask=%s\n", spec );
|
---|
| 2031 |
|
---|
| 2032 | if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
|
---|
| 2033 | {
|
---|
| 2034 | SENDMSG( combo ? CB_RESETCONTENT : LB_RESETCONTENT, 0, 0 );
|
---|
| 2035 | if (attrib & DDL_DIRECTORY)
|
---|
| 2036 | {
|
---|
| 2037 | if (!(attrib & DDL_EXCLUSIVE))
|
---|
| 2038 | {
|
---|
| 2039 | if (SENDMSG( combo ? CB_DIR : LB_DIR,
|
---|
| 2040 | attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
|
---|
| 2041 | (LPARAM)spec ) == LB_ERR)
|
---|
| 2042 | return FALSE;
|
---|
| 2043 | }
|
---|
| 2044 | if (SENDMSG( combo ? CB_DIR : LB_DIR,
|
---|
| 2045 | (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
|
---|
| 2046 | (LPARAM)"*.*" ) == LB_ERR)
|
---|
| 2047 | return FALSE;
|
---|
| 2048 | }
|
---|
| 2049 | else
|
---|
| 2050 | {
|
---|
| 2051 | if (SENDMSG( combo ? CB_DIR : LB_DIR, attrib,
|
---|
| 2052 | (LPARAM)spec ) == LB_ERR)
|
---|
| 2053 | return FALSE;
|
---|
| 2054 | }
|
---|
| 2055 | }
|
---|
| 2056 |
|
---|
| 2057 | if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
|
---|
| 2058 | {
|
---|
| 2059 | char temp[MAX_PATH];
|
---|
| 2060 | GetCurrentDirectoryA( sizeof(temp), temp );
|
---|
| 2061 | CharLowerA( temp );
|
---|
| 2062 | /* Can't use PostMessage() here, because the string is on the stack */
|
---|
| 2063 | SetDlgItemTextA( hDlg, idStatic, temp );
|
---|
| 2064 | }
|
---|
| 2065 |
|
---|
| 2066 | if (orig_spec && (spec != orig_spec))
|
---|
| 2067 | {
|
---|
| 2068 | /* Update the original file spec */
|
---|
| 2069 | char *p = spec;
|
---|
| 2070 | while ((*orig_spec++ = *p++));
|
---|
| 2071 | }
|
---|
| 2072 |
|
---|
| 2073 | return TRUE;
|
---|
| 2074 | #undef SENDMSG
|
---|
| 2075 | }
|
---|
| 2076 |
|
---|
| 2077 |
|
---|
| 2078 | /**********************************************************************
|
---|
| 2079 | * DIALOG_DlgDirListW
|
---|
| 2080 | *
|
---|
| 2081 | * Helper function for DlgDirList*W
|
---|
| 2082 | */
|
---|
| 2083 | static INT DIALOG_DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
|
---|
| 2084 | INT idStatic, UINT attrib, BOOL combo )
|
---|
| 2085 | {
|
---|
| 2086 | if (spec)
|
---|
| 2087 | {
|
---|
| 2088 | LPSTR specA = HEAP_strdupWtoA( GetProcessHeap(), 0, spec );
|
---|
| 2089 | INT ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic,
|
---|
| 2090 | attrib, combo );
|
---|
| 2091 | MultiByteToWideChar( CP_ACP, 0, specA, -1, spec, 0x7fffffff );
|
---|
| 2092 | HeapFree( GetProcessHeap(), 0, specA );
|
---|
| 2093 | return ret;
|
---|
| 2094 | }
|
---|
| 2095 | return DIALOG_DlgDirList( hDlg, NULL, idLBox, idStatic, attrib, combo );
|
---|
| 2096 | }
|
---|
| 2097 |
|
---|
| 2098 |
|
---|
| 2099 | /**********************************************************************
|
---|
| 2100 | * DlgDirSelectExA (USER32.@)
|
---|
| 2101 | */
|
---|
| 2102 | BOOL WINAPI DlgDirSelectExA( HWND hwnd, LPSTR str, INT len, INT id )
|
---|
| 2103 | {
|
---|
| 2104 | return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, FALSE );
|
---|
| 2105 | }
|
---|
| 2106 |
|
---|
| 2107 |
|
---|
| 2108 | /**********************************************************************
|
---|
| 2109 | * DlgDirSelectExW (USER32.@)
|
---|
| 2110 | */
|
---|
| 2111 | BOOL WINAPI DlgDirSelectExW( HWND hwnd, LPWSTR str, INT len, INT id )
|
---|
| 2112 | {
|
---|
| 2113 | return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, FALSE );
|
---|
| 2114 | }
|
---|
| 2115 |
|
---|
| 2116 |
|
---|
| 2117 | /**********************************************************************
|
---|
| 2118 | * DlgDirSelectComboBoxExA (USER32.@)
|
---|
| 2119 | */
|
---|
| 2120 | BOOL WINAPI DlgDirSelectComboBoxExA( HWND hwnd, LPSTR str, INT len,
|
---|
| 2121 | INT id )
|
---|
| 2122 | {
|
---|
| 2123 | return DIALOG_DlgDirSelect( hwnd, str, len, id, FALSE, TRUE );
|
---|
| 2124 | }
|
---|
| 2125 |
|
---|
| 2126 |
|
---|
| 2127 | /**********************************************************************
|
---|
| 2128 | * DlgDirSelectComboBoxExW (USER32.@)
|
---|
| 2129 | */
|
---|
| 2130 | BOOL WINAPI DlgDirSelectComboBoxExW( HWND hwnd, LPWSTR str, INT len,
|
---|
| 2131 | INT id)
|
---|
| 2132 | {
|
---|
| 2133 | return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE );
|
---|
| 2134 | }
|
---|
| 2135 |
|
---|
| 2136 |
|
---|
| 2137 | /**********************************************************************
|
---|
| 2138 | * DlgDirListA (USER32.@)
|
---|
| 2139 | */
|
---|
| 2140 | INT WINAPI DlgDirListA( HWND hDlg, LPSTR spec, INT idLBox,
|
---|
| 2141 | INT idStatic, UINT attrib )
|
---|
| 2142 | {
|
---|
| 2143 | return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
|
---|
| 2144 | }
|
---|
| 2145 |
|
---|
| 2146 |
|
---|
| 2147 | /**********************************************************************
|
---|
| 2148 | * DlgDirListW (USER32.@)
|
---|
| 2149 | */
|
---|
| 2150 | INT WINAPI DlgDirListW( HWND hDlg, LPWSTR spec, INT idLBox,
|
---|
| 2151 | INT idStatic, UINT attrib )
|
---|
| 2152 | {
|
---|
| 2153 | return DIALOG_DlgDirListW( hDlg, spec, idLBox, idStatic, attrib, FALSE );
|
---|
| 2154 | }
|
---|
| 2155 |
|
---|
| 2156 |
|
---|
| 2157 | /**********************************************************************
|
---|
| 2158 | * DlgDirListComboBoxA (USER32.@)
|
---|
| 2159 | */
|
---|
| 2160 | INT WINAPI DlgDirListComboBoxA( HWND hDlg, LPSTR spec, INT idCBox,
|
---|
| 2161 | INT idStatic, UINT attrib )
|
---|
| 2162 | {
|
---|
| 2163 | return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
|
---|
| 2164 | }
|
---|
| 2165 |
|
---|
| 2166 |
|
---|
| 2167 | /**********************************************************************
|
---|
| 2168 | * DlgDirListComboBoxW (USER32.@)
|
---|
| 2169 | */
|
---|
| 2170 | INT WINAPI DlgDirListComboBoxW( HWND hDlg, LPWSTR spec, INT idCBox,
|
---|
| 2171 | INT idStatic, UINT attrib )
|
---|
| 2172 | {
|
---|
| 2173 | return DIALOG_DlgDirListW( hDlg, spec, idCBox, idStatic, attrib, TRUE );
|
---|
| 2174 | }
|
---|