Corrected small bug in GetCommState16. Parity check can be disabled
[wine.git] / controls / widgets.c
blobf93207ed660ac51bb33d48350f6e0fafe399adbf
1 /*
2 * Windows widgets (built-in window classes)
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include <string.h>
8 #include <assert.h>
10 #include "win.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( HWND hwnd, UINT msg,
23 WPARAM wParam, LPARAM lParam );
24 extern LRESULT WINAPI ComboWndProc( HWND hwnd, UINT msg,
25 WPARAM wParam, LPARAM lParam );
26 extern LRESULT WINAPI ComboLBWndProc( HWND hwnd, UINT msg,
27 WPARAM wParam, LPARAM lParam );
28 extern LRESULT WINAPI ListBoxWndProc( HWND hwnd, UINT msg,
29 WPARAM wParam, LPARAM lParam );
30 extern LRESULT WINAPI PopupMenuWndProc( HWND hwnd, UINT msg,
31 WPARAM wParam, LPARAM lParam );
32 extern LRESULT WINAPI IconTitleWndProc( HWND hwnd, UINT msg,
33 WPARAM wParam, LPARAM lParam );
35 /* Built-in classes */
37 static WNDCLASSA 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,
42 (HCURSOR)IDC_ARROWA, 0, 0, "Button" },
43 /* BIC32_EDIT */
44 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
45 EditWndProc, 0, sizeof(void *), 0, 0,
46 (HCURSOR)IDC_IBEAMA, 0, 0, "Edit" },
47 /* BIC32_LISTBOX */
48 { CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
49 ListBoxWndProc, 0, sizeof(void *), 0, 0,
50 (HCURSOR)IDC_ARROWA, 0, 0, "ListBox" },
51 /* BIC32_COMBO */
52 { CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
53 ComboWndProc, 0, sizeof(void *), 0, 0,
54 (HCURSOR)IDC_ARROWA, 0, 0, "ComboBox" },
55 /* BIC32_COMBOLB */
56 { CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS, ComboLBWndProc,
57 0, sizeof(void *), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "ComboLBox" },
58 /* BIC32_POPUPMENU */
59 { CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc, 0, sizeof(HMENU),
60 0, 0, (HCURSOR)IDC_ARROWA, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
61 /* BIC32_STATIC */
62 { CS_GLOBALCLASS | CS_PARENTDC, StaticWndProc,
63 0, sizeof(STATICINFO), 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, "Static" },
64 /* BIC32_SCROLL */
65 { CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
66 ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0,
67 (HCURSOR)IDC_ARROWA, 0, 0, "ScrollBar"},
68 /* BIC32_MDICLIENT */
69 { CS_GLOBALCLASS, MDIClientWndProc,
70 0, sizeof(MDICLIENTINFO), 0, 0, 0, STOCK_LTGRAY_BRUSH, 0, "MDIClient" },
71 /* BIC32_DESKTOP */
72 { CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOP),
73 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DESKTOP_CLASS_NAME },
74 /* BIC32_DIALOG */
75 { CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProcA, 0, DLGWINDOWEXTRA,
76 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, DIALOG_CLASS_NAME },
77 /* BIC32_ICONTITLE */
78 { CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
79 0, 0, (HCURSOR)IDC_ARROWA, 0, 0, ICONTITLE_CLASS_NAME }
82 static ATOM bicAtomTable[BIC32_NB_CLASSES];
84 /***********************************************************************
85 * WIDGETS_Init
87 * Initialize the built-in window classes.
89 BOOL WIDGETS_Init(void)
91 int i;
92 WNDCLASSA *cls = WIDGETS_BuiltinClasses;
94 /* Create builtin classes */
96 for (i = 0; i < BIC32_NB_CLASSES; i++, cls++)
98 char name[20];
99 /* Just to make sure the string is > 0x10000 */
100 strcpy( name, (char *)cls->lpszClassName );
101 cls->lpszClassName = name;
102 cls->hCursor = LoadCursorA( 0, (LPCSTR)cls->hCursor );
103 if (!(bicAtomTable[i] = RegisterClassA( cls ))) return FALSE;
106 return TRUE;
110 /***********************************************************************
111 * WIDGETS_IsControl32
113 * Check whether pWnd is a built-in control or not.
115 BOOL WIDGETS_IsControl( WND* pWnd, BUILTIN_CLASS32 cls )
117 assert( cls < BIC32_NB_CLASSES );
118 return (pWnd->class->atomName == bicAtomTable[cls]);