Added more conversion routines (rate conversion is implemented).
[wine.git] / controls / widgets.c
blob13b605269c01b159615c8b77bf8c19e1b094591a
1 /*
2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include <assert.h>
8 #include <string.h>
10 #include "win.h"
11 #include "button.h"
12 #include "combo.h"
13 #include "desktop.h"
14 #include "gdi.h"
15 #include "heap.h"
16 #include "mdi.h"
17 #include "menu.h"
18 #include "scroll.h"
19 #include "static.h"
21 /* Built-in classes */
23 static WNDCLASSA WIDGETS_BuiltinClasses[BIC32_NB_CLASSES] =
25 /* BIC32_BUTTON */
26 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
27 ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0,
28 (HCURSOR)IDC_ARROWA, 0, 0, "Button" },
29 /* BIC32_EDIT */
30 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
31 EditWndProc, 0, sizeof(void *), 0, 0,
32 (HCURSOR)IDC_IBEAMA, 0, 0, "Edit" },
33 /* BIC32_LISTBOX */
34 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
35 ListBoxWndProc, 0, sizeof(void *), 0, 0,
36 (HCURSOR)IDC_ARROWA, 0, 0, "ListBox" },
37 /* BIC32_COMBO */
38 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
39 ComboWndProc, 0, sizeof(void *), 0, 0,
40 (HCURSOR)IDC_ARROWA, 0, 0, "ComboBox" },
41 /* BIC32_COMBOLB */
42 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc,
43 0, sizeof(void *), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "ComboLBox" },
44 /* BIC32_POPUPMENU */
45 { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, sizeof(HMENU),
46 0, 0, (HCURSOR)IDC_ARROWA, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
47 /* BIC32_STATIC */
48 { CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC, StaticWndProc,
49 0, sizeof(STATICINFO), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "Static" },
50 /* BIC32_SCROLL */
51 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
52 ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0,
53 (HCURSOR)IDC_ARROWA, 0, 0, "ScrollBar"},
54 /* BIC32_MDICLIENT */
55 { CS_GLOBALCLASS, MDIClientWndProc,
56 0, sizeof(MDICLIENTINFO), 0, 0, (HCURSOR)IDC_ARROWA, STOCK_LTGRAY_BRUSH, 0, "MDIClient" },
57 /* BIC32_DESKTOP */
58 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOP),
59 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DESKTOP_CLASS_NAME },
60 /* BIC32_DIALOG */
61 { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProcA, 0, DLGWINDOWEXTRA,
62 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DIALOG_CLASS_NAME },
63 /* BIC32_ICONTITLE */
64 { CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
65 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, ICONTITLE_CLASS_NAME }
68 static ATOM bicAtomTable[BIC32_NB_CLASSES];
70 /***********************************************************************
71 * WIDGETS_Init
73 * Initialize the built-in window classes.
75 BOOL WIDGETS_Init(void)
77 int i;
78 WNDCLASSA *cls = WIDGETS_BuiltinClasses;
80 /* Create builtin classes */
82 for (i = 0; i < BIC32_NB_CLASSES; i++, cls++)
84 char name[20];
85 /* Just to make sure the string is > 0x10000 */
86 strcpy( name, (char *)cls->lpszClassName );
87 cls->lpszClassName = name;
88 cls->hCursor = LoadCursorA( 0, (LPCSTR)cls->hCursor );
89 if (!(bicAtomTable[i] = RegisterClassA( cls ))) return FALSE;
92 return TRUE;
96 /***********************************************************************
97 * WIDGETS_IsControl32
99 * Check whether pWnd is a built-in control or not.
101 BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls )
103 assert( cls < BIC32_NB_CLASSES );
104 return (GetClassWord(pWnd->hwndSelf, GCW_ATOM) == bicAtomTable[cls]);