Release 960606
[wine.git] / controls / widgets.c
blob7205bc098db73455ba75433297dbb564dc0dc340
1 /*
2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "win.h"
8 #include "button.h"
9 #include "static.h"
10 #include "scroll.h"
11 #include "desktop.h"
12 #include "mdi.h"
13 #include "gdi.h"
14 #include "user.h"
15 #include "module.h"
16 #include "heap.h"
18 static WNDCLASS16 WIDGETS_BuiltinClasses16[] =
20 { CS_GLOBALCLASS | CS_PARENTDC,
21 (WNDPROC16)"StaticWndProc", 0, sizeof(STATICINFO),
22 0, 0, 0, 0, 0, (SEGPTR)"STATIC" },
23 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
24 (WNDPROC16)"ScrollBarWndProc", 0, sizeof(SCROLLINFO),
25 0, 0, 0, 0, 0, (SEGPTR)"SCROLLBAR" },
26 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
27 (WNDPROC16)"ListBoxWndProc", 0, 8,
28 0, 0, 0, 0, 0, (SEGPTR)"LISTBOX" },
29 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
30 (WNDPROC16)"ComboBoxWndProc", 0, 8,
31 0, 0, 0, 0, 0, (SEGPTR)"COMBOBOX" },
32 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
33 (WNDPROC16)"ComboLBoxWndProc", 0, 8,
34 0, 0, 0, 0, 0, (SEGPTR)"COMBOLBOX" },
35 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
36 (WNDPROC16)"EditWndProc", 0, sizeof(DWORD),
37 0, 0, 0, 0, 0, (SEGPTR)"EDIT" },
38 { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"PopupMenuWndProc", 0, 8,
39 0, 0, 0, 0, 0, (SEGPTR)POPUPMENU_CLASS_NAME },
40 { CS_GLOBALCLASS | CS_SAVEBITS, (WNDPROC16)"DefDlgProc", 0, DLGWINDOWEXTRA,
41 0, 0, 0, 0, 0, (SEGPTR)DIALOG_CLASS_NAME },
42 { CS_GLOBALCLASS, (WNDPROC16)"MDIClientWndProc", 0, sizeof(MDICLIENTINFO),
43 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, (SEGPTR)"MDICLIENT" }
46 #define NB_BUILTIN_CLASSES16 \
47 (sizeof(WIDGETS_BuiltinClasses16)/sizeof(WIDGETS_BuiltinClasses16[0]))
49 static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
51 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
52 ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "BUTTON" },
53 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
54 0, 0, 0, 0, 0, DESKTOP_CLASS_NAME }
57 #define NB_BUILTIN_CLASSES32 \
58 (sizeof(WIDGETS_BuiltinClasses32)/sizeof(WIDGETS_BuiltinClasses32[0]))
61 /***********************************************************************
62 * WIDGETS_Init
64 * Initialize the built-in window classes.
66 BOOL WIDGETS_Init(void)
68 int i;
69 char *name;
70 WNDCLASS16 *class16 = WIDGETS_BuiltinClasses16;
71 WNDCLASS32A *class32 = WIDGETS_BuiltinClasses32;
73 if (!(name = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE;
75 /* Create 16-bit classes */
77 for (i = 0; i < NB_BUILTIN_CLASSES16; i++, class16++)
79 strcpy( name, (char *)class16->lpszClassName );
80 class16->lpszClassName = SEGPTR_GET(name);
81 class16->hCursor = LoadCursor( 0, IDC_ARROW );
82 class16->lpfnWndProc = MODULE_GetWndProcEntry16( (char *)class16->lpfnWndProc );
83 if (!RegisterClass16( class16 )) return FALSE;
86 /* Create 32-bit classes */
88 for (i = 0; i < NB_BUILTIN_CLASSES32; i++, class32++)
90 /* Just to make sure the string is > 0x10000 */
91 strcpy( name, (char *)class32->lpszClassName );
92 class32->lpszClassName = name;
93 class32->hCursor = LoadCursor( 0, IDC_ARROW );
94 if (!RegisterClass32A( class32 )) return FALSE;
97 SEGPTR_FREE(name);
98 return TRUE;