Release 950319
[wine.git] / controls / widgets.c
blob20e22dcc5150740a60f5cdfed2c439303b3ba0d1
1 /*
2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
6 static char Copyright[] = "Copyright Alexandre Julliard, 1993";
7 */
9 #include "win.h"
10 #include "button.h"
11 #include "static.h"
12 #include "scroll.h"
13 #include "desktop.h"
14 #include "mdi.h"
15 #include "gdi.h"
16 #include "user.h"
18 LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
19 LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
20 LONG EditWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
21 LONG PopupMenuWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
22 LONG DesktopWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
23 LONG MDIClientWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
26 static WNDCLASS WIDGETS_BuiltinClasses[] =
28 { CS_GLOBALCLASS | CS_PARENTDC, ButtonWndProc, 0, sizeof(BUTTONINFO),
29 0, 0, 0, 0, NULL, "BUTTON" },
30 { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc, 0, sizeof(STATICINFO),
31 0, 0, 0, 0, NULL, "STATIC" },
32 { CS_GLOBALCLASS | CS_PARENTDC, ScrollBarWndProc, 0, sizeof(SCROLLINFO),
33 0, 0, 0, 0, NULL, "SCROLLBAR" },
34 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, ListBoxWndProc, 0, 8,
35 0, 0, 0, 0, NULL, "LISTBOX" },
36 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS, ComboBoxWndProc, 0, 8,
37 0, 0, 0, 0, NULL, "COMBOBOX" },
38 { CS_GLOBALCLASS | CS_PARENTDC, EditWndProc, 0, sizeof(WORD),
39 0, 0, 0, 0, NULL, "EDIT" },
40 { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, 8,
41 0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME },
42 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
43 0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },
44 { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc, 0, DLGWINDOWEXTRA,
45 0, 0, 0, 0, NULL, DIALOG_CLASS_NAME },
46 { CS_GLOBALCLASS, MDIClientWndProc, 0, sizeof(MDICLIENTINFO),
47 0, 0, 0, STOCK_LTGRAY_BRUSH, NULL, "MDICLIENT" }
50 #define NB_BUILTIN_CLASSES \
51 (sizeof(WIDGETS_BuiltinClasses)/sizeof(WIDGETS_BuiltinClasses[0]))
54 /***********************************************************************
55 * WIDGETS_Init
57 * Initialize the built-in window classes.
59 BOOL WIDGETS_Init(void)
61 int i;
62 HANDLE hName;
63 char *name;
64 WNDCLASS *class = WIDGETS_BuiltinClasses;
66 if (!(hName = USER_HEAP_ALLOC( 20 ))) return FALSE;
67 name = USER_HEAP_LIN_ADDR( hName );
68 for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++)
70 strcpy( name, class->lpszClassName );
71 class->lpszClassName = (LPSTR)USER_HEAP_SEG_ADDR( hName );
72 class->hCursor = LoadCursor( 0, IDC_ARROW );
73 if (!RegisterClass( class )) return FALSE;
75 USER_HEAP_FREE( hName );
76 return TRUE;