New file, some helper functions for icon cache.
[wine/multimedia.git] / controls / widgets.c
blob51fe1bc0329e224a59ce45702efa6fa64c6899a1
1 /*
2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include <assert.h>
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 "module.h"
17 #include "heap.h"
19 /* Window procedures */
21 extern LRESULT WINAPI EditWndProc( HWND32 hwnd, UINT32 msg,
22 WPARAM32 wParam, LPARAM lParam );
23 extern LRESULT WINAPI ComboWndProc( HWND32 hwnd, UINT32 msg,
24 WPARAM32 wParam, LPARAM lParam );
25 extern LRESULT WINAPI ComboLBWndProc( HWND32 hwnd, UINT32 msg,
26 WPARAM32 wParam, LPARAM lParam );
27 extern LRESULT WINAPI ListBoxWndProc( HWND32 hwnd, UINT32 msg,
28 WPARAM32 wParam, LPARAM lParam );
29 extern LRESULT WINAPI PopupMenuWndProc( HWND32 hwnd, UINT32 msg,
30 WPARAM32 wParam, LPARAM lParam );
31 extern LRESULT WINAPI IconTitleWndProc( HWND32 hwnd, UINT32 msg,
32 WPARAM32 wParam, LPARAM lParam );
34 /* Built-in classes */
36 static WNDCLASS32A WIDGETS_BuiltinClasses[BIC32_NB_CLASSES] =
38 /* BIC32_BUTTON */
39 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
40 ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0,
41 (HCURSOR32)IDC_ARROW32A, 0, 0, "Button" },
42 /* BIC32_EDIT */
43 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
44 EditWndProc, 0, sizeof(void *), 0, 0,
45 (HCURSOR32)IDC_IBEAM32A, 0, 0, "Edit" },
46 /* BIC32_LISTBOX */
47 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
48 ListBoxWndProc, 0, sizeof(void *), 0, 0,
49 (HCURSOR32)IDC_ARROW32A, 0, 0, "ListBox" },
50 /* BIC32_COMBO */
51 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
52 ComboWndProc, 0, sizeof(void *), 0, 0,
53 (HCURSOR32)IDC_ARROW32A, 0, 0, "ComboBox" },
54 /* BIC32_COMBOLB */
55 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc,
56 0, sizeof(void *), 0, 0, (HCURSOR32)IDC_ARROW32A, 0, 0, "ComboLBox" },
57 /* BIC32_POPUPMENU */
58 { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, sizeof(HMENU32),
59 0, 0, (HCURSOR32)IDC_ARROW32A, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
60 /* BIC32_STATIC */
61 { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc,
62 0, sizeof(STATICINFO), 0, 0, (HCURSOR32)IDC_ARROW32A, 0, 0, "Static" },
63 /* BIC32_SCROLL */
64 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
65 ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0,
66 (HCURSOR32)IDC_ARROW32A, 0, 0, "ScrollBar"},
67 /* BIC32_MDICLIENT */
68 { CS_GLOBALCLASS, MDIClientWndProc,
69 0, sizeof(MDICLIENTINFO), 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, "MDIClient" },
70 /* BIC32_DESKTOP */
71 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
72 0, 0, (HCURSOR32)IDC_ARROW32A, 0, 0, DESKTOP_CLASS_NAME },
73 /* BIC32_DIALOG */
74 { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc32A, 0, DLGWINDOWEXTRA,
75 0, 0, (HCURSOR32)IDC_ARROW32A, 0, 0, DIALOG_CLASS_NAME },
76 /* BIC32_ICONTITLE */
77 { CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
78 0, 0, (HCURSOR32)IDC_ARROW32A, 0, 0, ICONTITLE_CLASS_NAME }
81 static ATOM bicAtomTable[BIC32_NB_CLASSES];
83 /***********************************************************************
84 * WIDGETS_Init
86 * Initialize the built-in window classes.
88 BOOL32 WIDGETS_Init(void)
90 int i;
91 WNDCLASS32A *cls = WIDGETS_BuiltinClasses;
93 /* Create builtin classes */
95 for (i = 0; i < BIC32_NB_CLASSES; i++, cls++)
97 char name[20];
98 /* Just to make sure the string is > 0x10000 */
99 strcpy( name, (char *)cls->lpszClassName );
100 cls->lpszClassName = name;
101 cls->hCursor = LoadCursor32A( 0, (LPCSTR)cls->hCursor );
102 if (!(bicAtomTable[i] = RegisterClass32A( cls ))) return FALSE;
105 return TRUE;
109 /***********************************************************************
110 * WIDGETS_IsControl32
112 * Check whether pWnd is a built-in control or not.
114 BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls )
116 assert( cls < BIC32_NB_CLASSES );
117 return (pWnd->class->atomName == bicAtomTable[cls]);