FindResourceExA/W should search for the specified language resource only.
[wine.git] / controls / widgets.c
blob2eabec438dd0e3a6e16d226b2fcb141f6a33eb91
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 "module.h"
19 #include "scroll.h"
20 #include "static.h"
22 /* Built-in classes */
24 static WNDCLASSA WIDGETS_BuiltinClasses[BIC32_NB_CLASSES] =
26 /* BIC32_BUTTON */
27 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
28 ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0,
29 (HCURSOR)IDC_ARROWA, 0, 0, "Button" },
30 /* BIC32_EDIT */
31 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
32 EditWndProc, 0, sizeof(void *), 0, 0,
33 (HCURSOR)IDC_IBEAMA, 0, 0, "Edit" },
34 /* BIC32_LISTBOX */
35 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
36 ListBoxWndProc, 0, sizeof(void *), 0, 0,
37 (HCURSOR)IDC_ARROWA, 0, 0, "ListBox" },
38 /* BIC32_COMBO */
39 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
40 ComboWndProc, 0, sizeof(void *), 0, 0,
41 (HCURSOR)IDC_ARROWA, 0, 0, "ComboBox" },
42 /* BIC32_COMBOLB */
43 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc,
44 0, sizeof(void *), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "ComboLBox" },
45 /* BIC32_POPUPMENU */
46 { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, sizeof(HMENU),
47 0, 0, (HCURSOR)IDC_ARROWA, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
48 /* BIC32_STATIC */
49 { CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC, StaticWndProc,
50 0, sizeof(STATICINFO), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "Static" },
51 /* BIC32_SCROLL */
52 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
53 ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0,
54 (HCURSOR)IDC_ARROWA, 0, 0, "ScrollBar"},
55 /* BIC32_MDICLIENT */
56 { CS_GLOBALCLASS, MDIClientWndProc,
57 0, sizeof(MDICLIENTINFO), 0, 0, (HCURSOR)IDC_ARROWA, STOCK_LTGRAY_BRUSH, 0, "MDIClient" },
58 /* BIC32_DESKTOP */
59 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOP),
60 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DESKTOP_CLASS_NAME },
61 /* BIC32_DIALOG */
62 { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProcA, 0, DLGWINDOWEXTRA,
63 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DIALOG_CLASS_NAME },
64 /* BIC32_ICONTITLE */
65 { CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
66 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, ICONTITLE_CLASS_NAME }
69 static ATOM bicAtomTable[BIC32_NB_CLASSES];
71 /***********************************************************************
72 * WIDGETS_Init
74 * Initialize the built-in window classes.
76 BOOL WIDGETS_Init(void)
78 int i;
79 WNDCLASSA *cls = WIDGETS_BuiltinClasses;
81 /* Create builtin classes */
83 for (i = 0; i < BIC32_NB_CLASSES; i++, cls++)
85 char name[20];
86 /* Just to make sure the string is > 0x10000 */
87 strcpy( name, (char *)cls->lpszClassName );
88 cls->lpszClassName = name;
89 cls->hCursor = LoadCursorA( 0, (LPCSTR)cls->hCursor );
90 if (!(bicAtomTable[i] = RegisterClassA( cls ))) return FALSE;
93 return TRUE;
97 /***********************************************************************
98 * WIDGETS_IsControl32
100 * Check whether pWnd is a built-in control or not.
102 BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls )
104 assert( cls < BIC32_NB_CLASSES );
105 return (GetClassWord(pWnd->hwndSelf, GCW_ATOM) == bicAtomTable[cls]);