Release 980329
[wine/multimedia.git] / controls / widgets.c
blobb8fcfc4661e338f21f27ad7e3cab79fa7ec402cb
1 /*
2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include <assert.h>
9 #include "win.h"
10 #include "commctrl.h"
11 #include "button.h"
12 #include "static.h"
13 #include "scroll.h"
14 #include "desktop.h"
15 #include "mdi.h"
16 #include "gdi.h"
17 #include "module.h"
18 #include "heap.h"
20 /* Window procedures */
22 extern LRESULT WINAPI EditWndProc( HWND32 hwnd, UINT32 msg,
23 WPARAM32 wParam, LPARAM lParam );
24 extern LRESULT WINAPI ComboWndProc( HWND32 hwnd, UINT32 msg,
25 WPARAM32 wParam, LPARAM lParam );
26 extern LRESULT WINAPI ComboLBWndProc( HWND32 hwnd, UINT32 msg,
27 WPARAM32 wParam, LPARAM lParam );
28 extern LRESULT WINAPI ListBoxWndProc( HWND32 hwnd, UINT32 msg,
29 WPARAM32 wParam, LPARAM lParam );
30 extern LRESULT WINAPI PopupMenuWndProc( HWND32 hwnd, UINT32 msg,
31 WPARAM32 wParam, LPARAM lParam );
32 extern LRESULT WINAPI IconTitleWndProc( HWND32 hwnd, UINT32 msg,
33 WPARAM32 wParam, LPARAM lParam );
35 /* Built-in classes */
37 static WNDCLASS32A WIDGETS_BuiltinClasses[BIC32_NB_CLASSES] =
39 /* BIC32_BUTTON */
40 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
41 ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, IDC_ARROW, 0, 0, "Button" },
42 /* BIC32_EDIT */
43 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
44 EditWndProc, 0, sizeof(void *), 0, 0, IDC_IBEAM, 0, 0, "Edit" },
45 /* BIC32_LISTBOX */
46 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
47 ListBoxWndProc, 0, sizeof(void *), 0, 0, IDC_ARROW, 0, 0, "ListBox" },
48 /* BIC32_COMBO */
49 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
50 ComboWndProc, 0, sizeof(void *), 0, 0, IDC_ARROW, 0, 0, "ComboBox" },
51 /* BIC32_COMBOLB */
52 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
53 ComboLBWndProc, 0, sizeof(void *), 0, 0, IDC_ARROW, 0, 0, "ComboLBox" },
54 /* BIC32_POPUPMENU */
55 { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0,
56 sizeof(HMENU32), 0, 0, IDC_ARROW, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
57 /* BIC32_STATIC */
58 { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc,
59 0, sizeof(STATICINFO), 0, 0, IDC_ARROW, 0, 0, "Static" },
60 /* BIC32_SCROLL */
61 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
62 ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, IDC_ARROW, 0, 0, "ScrollBar"},
63 /* BIC32_MDICLIENT */
64 { CS_GLOBALCLASS, MDIClientWndProc,
65 0, sizeof(MDICLIENTINFO), 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, "MDIClient" },
66 /* BIC32_DESKTOP */
67 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
68 0, 0, IDC_ARROW, 0, 0, DESKTOP_CLASS_NAME },
69 /* BIC32_DIALOG */
70 { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc32A, 0, DLGWINDOWEXTRA,
71 0, 0, IDC_ARROW, 0, 0, DIALOG_CLASS_NAME },
72 /* BIC32_ICONTITLE */
73 { CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
74 0, 0, IDC_ARROW, 0, 0, ICONTITLE_CLASS_NAME }
77 static ATOM bicAtomTable[BIC32_NB_CLASSES];
79 /***********************************************************************
80 * WIDGETS_Init
82 * Initialize the built-in window classes.
84 BOOL32 WIDGETS_Init(void)
86 int i;
87 WNDCLASS32A *cls = WIDGETS_BuiltinClasses;
89 /* Create builtin classes */
91 for (i = 0; i < BIC32_NB_CLASSES; i++, cls++)
93 char name[20];
94 /* Just to make sure the string is > 0x10000 */
95 strcpy( name, (char *)cls->lpszClassName );
96 cls->lpszClassName = name;
97 cls->hCursor = LoadCursor32A( 0, (LPCSTR)cls->hCursor );
98 if (!(bicAtomTable[i] = RegisterClass32A( cls ))) return FALSE;
101 /* FIXME: hack to enable using built-in controls with Windows COMCTL32 */
102 InitCommonControls();
103 return TRUE;
107 /***********************************************************************
108 * WIDGETS_IsControl32
110 * Check whether pWnd is a built-in control or not.
112 BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls )
114 assert( cls < BIC32_NB_CLASSES );
115 return (pWnd->class->atomName == bicAtomTable[cls]);