Release 960717
[wine/multimedia.git] / controls / widgets.c
blob4f8a78c75f747da4c750ee2238e739685c0fe5cf
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 typedef struct
20 UINT16 style;
21 INT16 wndExtra;
22 HBRUSH16 background;
23 LPCSTR procName;
24 LPCSTR className;
25 } BUILTIN_CLASS_INFO16;
27 static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
29 { CS_GLOBALCLASS | CS_PARENTDC,
30 sizeof(STATICINFO), 0, "StaticWndProc", "STATIC" },
31 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
32 sizeof(SCROLLINFO), 0, "ScrollBarWndProc", "SCROLLBAR" },
33 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
34 8, 0, "ListBoxWndProc", "LISTBOX" },
35 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
36 8, 0, "ComboBoxWndProc", "COMBOBOX" },
37 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
38 8, 0, "ComboLBoxWndProc", "COMBOLBOX" },
39 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
40 sizeof(DWORD), 0, "EditWndProc", "EDIT" },
41 { CS_GLOBALCLASS | CS_SAVEBITS,
42 sizeof(HMENU32), 0, "PopupMenuWndProc", POPUPMENU_CLASS_NAME },
43 { CS_GLOBALCLASS | CS_SAVEBITS,
44 DLGWINDOWEXTRA, 0, "DefDlgProc", DIALOG_CLASS_NAME },
45 { CS_GLOBALCLASS, sizeof(MDICLIENTINFO),
46 STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDICLIENT" }
49 #define NB_BUILTIN_CLASSES16 \
50 (sizeof(WIDGETS_BuiltinClasses16)/sizeof(WIDGETS_BuiltinClasses16[0]))
52 static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
54 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
55 ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "BUTTON" },
56 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
57 0, 0, 0, 0, 0, DESKTOP_CLASS_NAME }
60 #define NB_BUILTIN_CLASSES32 \
61 (sizeof(WIDGETS_BuiltinClasses32)/sizeof(WIDGETS_BuiltinClasses32[0]))
64 /***********************************************************************
65 * WIDGETS_Init
67 * Initialize the built-in window classes.
69 BOOL WIDGETS_Init(void)
71 int i;
72 char *name;
73 const BUILTIN_CLASS_INFO16 *info16 = WIDGETS_BuiltinClasses16;
74 WNDCLASS16 class16;
75 WNDCLASS32A *class32 = WIDGETS_BuiltinClasses32;
77 if (!(name = SEGPTR_ALLOC( 20 * sizeof(char) ))) return FALSE;
79 /* Create 16-bit classes */
81 class16.cbClsExtra = 0;
82 class16.hInstance = 0;
83 class16.hIcon = 0;
84 class16.hCursor = LoadCursor16( 0, IDC_ARROW );
85 class16.lpszMenuName = (SEGPTR)0;
86 class16.lpszClassName = SEGPTR_GET(name);
87 for (i = 0; i < NB_BUILTIN_CLASSES16; i++, info16++)
89 class16.style = info16->style;
90 class16.lpfnWndProc = (WNDPROC16)MODULE_GetWndProcEntry16( info16->procName );
91 class16.cbWndExtra = info16->wndExtra;
92 class16.hbrBackground = info16->background;
93 strcpy( name, info16->className );
94 if (!RegisterClass16( &class16 )) return FALSE;
97 /* Create 32-bit classes */
99 for (i = 0; i < NB_BUILTIN_CLASSES32; i++, class32++)
101 /* Just to make sure the string is > 0x10000 */
102 strcpy( name, (char *)class32->lpszClassName );
103 class32->lpszClassName = name;
104 class32->hCursor = LoadCursor16( 0, IDC_ARROW );
105 if (!RegisterClass32A( class32 )) return FALSE;
108 SEGPTR_FREE(name);
109 return TRUE;