ReactOS 0.4.16-dev-340-g0540c21
regcontrol.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS User32
4 * PURPOSE: Built-in control registration
5 * FILE: win32ss/user/user32/controls/regcontrol.c
6 * PROGRAMER: Ge van Geldorp (ge@gse.nl)
7 * REVISION HISTORY: 2003/06/16 GvG Created
8 * NOTES: Adapted from Wine
9 */
10
11#include <user32.h>
12
14
18
19
20/***********************************************************************
21 * set_control_clipping
22 *
23 * Set clipping for a builtin control that uses CS_PARENTDC.
24 * Return the previous clip region if any.
25 */
27{
28 RECT rc = *rect;
29 HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
30
31 if (GetClipRgn( hdc, hrgn ) != 1)
32 {
34 hrgn = 0;
35 }
36 DPtoLP( hdc, (POINT *)&rc, 2 );
37 if (GetLayout( hdc ) & LAYOUT_RTL) /* compensate for the shifting done by IntersectClipRect */
38 {
39 rc.left++;
40 rc.right++;
41 }
42 IntersectClipRect( hdc, rc.left, rc.top, rc.right, rc.bottom );
43 return hrgn;
44}
45
46static const struct
47{
51} g_SysClasses[] =
52{
54/* { &POPUPMENU_builtin_class, FNID_MENU, ICLS_MENU}, // moved to win32k */
58#if 0
60#endif
61/* { &SCROLL_builtin_class, FNID_SCROLLBAR, ICLS_SCROLLBAR}, // moved to win32k */
65/* { &ICONTITLE_builtin_class, FNID_ICONTITLE, ICLS_ICONTITLE}, // moved to win32k */
68};
69
71{
73 UINT i;
74 ATOM atom;
75
76 if (RegisterDefaultClasses) return TRUE;
77
78 ZeroMemory(&WndClass, sizeof(WndClass));
79
80 WndClass.cbSize = sizeof(WndClass);
81
82 for (i = 0; i != sizeof(g_SysClasses) / sizeof(g_SysClasses[0]); i++)
83 {
84 WndClass.lpszClassName = g_SysClasses[i].desc->name;
85
86 // Set Global bit!
87 WndClass.style = g_SysClasses[i].desc->style|CS_GLOBALCLASS;
88 WndClass.lpfnWndProc = g_SysClasses[i].desc->procW;
89 WndClass.cbWndExtra = g_SysClasses[i].desc->extra;
90 WndClass.hCursor = LoadCursorW(NULL, g_SysClasses[i].desc->cursor);
91 WndClass.hbrBackground= g_SysClasses[i].desc->brush;
92
94 0,
96 0,
97 FALSE);
98 if (atom)
100 }
101
102 if ( //gpsi->dwSRVIFlags & SRVINFO_IMM32 && Not supported yet, need NlsMbCodePageTag working in Win32k.
103 !(RegisterDefaultClasses & ICLASS_TO_MASK(ICLS_IME))) // So, work like XP.
104 {
106 }
107
108 return TRUE;
109}
110
112WINAPI
114{
115 PWND pWnd;
116
117 pWnd = ValidateHwnd(hwnd);
118 if (pWnd)
119 {
120 if (!pWnd->fnid)
121 {
123 }
124 }
125
126 if (message == WM_NCCREATE) return TRUE;
127
128 if (message == WM_DESTROY)
130
132}
133
135WINAPI
137{
138 if (unicode)
139 return DefDlgProcW( hwnd, uMsg, wParam, lParam);
140 return DefDlgProcA( hwnd, uMsg, wParam, lParam);
141}
142
144{
146
193
205
207 &pfnClientW,
210
211 return NT_SUCCESS(Status) ? TRUE : FALSE;
212}
static HRGN hrgn
LRESULT WINAPI SwitchWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: appswitch.c:820
LRESULT WINAPI SwitchWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: appswitch.c:825
LONG NTSTATUS
Definition: precomp.h:26
WCHAR WndClass[]
Definition: capicon.c:23
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
LRESULT WINAPI DesktopWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:33
LRESULT WINAPI ButtonWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI MDIClientWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1360
LRESULT WINAPI DesktopWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: message.c:1307
LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI EditWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI ComboWndProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI ButtonWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI User32DefWindowProc(HWND, UINT, WPARAM, LPARAM, BOOL)
Definition: defwnd.c:312
LRESULT WINAPI MDIClientWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1351
LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: menu.c:297
LRESULT WINAPI MDIClientWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: mdi.c:1097
LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: menu.c:368
LRESULT WINAPI ComboWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ValidateHwnd(hwnd)
Definition: precomp.h:85
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
pKey DeleteObject()
DWORD WINAPI GetLayout(_In_ HDC hdc)
Definition: coord.c:750
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LRESULT WINAPI IconTitleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: icontitle.c:184
#define ICLS_IME
Definition: ntuser.h:927
#define ICLS_DIALOG
Definition: ntuser.h:930
#define ICLS_LISTBOX
Definition: ntuser.h:915
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:902
#define ICLS_EDIT
Definition: ntuser.h:913
#define ICLS_GHOST
Definition: ntuser.h:928
NTSTATUS NTAPI NtUserInitializeClientPfnArrays(PPFNCLIENT pfnClientA, PPFNCLIENT pfnClientW, PPFNCLIENTWORKER pfnClientWorker, HINSTANCE hmodUser)
Definition: ntstubs.c:101
#define ICLS_COMBOBOX
Definition: ntuser.h:917
#define ICLS_STATIC
Definition: ntuser.h:914
#define FNID_DESTROY
Definition: ntuser.h:898
#define FNID_LISTBOX
Definition: ntuser.h:871
#define FNID_BUTTON
Definition: ntuser.h:866
#define FNID_COMBOBOX
Definition: ntuser.h:867
#define FNID_DIALOG
Definition: ntuser.h:869
#define ICLS_MENU
Definition: ntuser.h:931
#define ICLS_COMBOLBOX
Definition: ntuser.h:919
#define FNID_STATIC
Definition: ntuser.h:873
#define FNID_EDIT
Definition: ntuser.h:870
#define ICLS_BUTTON
Definition: ntuser.h:912
#define FNID_GHOST
Definition: ntuser.h:875
#define FNID_MENU
Definition: ntuser.h:861
#define ICLS_MDICLIENT
Definition: ntuser.h:918
#define FNID_MESSAGEWND
Definition: ntuser.h:864
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4335
#define FNID_COMBOLBOX
Definition: ntuser.h:868
#define FNID_MDICLIENT
Definition: ntuser.h:872
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
unsigned int UINT
Definition: ndis.h:50
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
static PFNCLIENT pfnClientA
Definition: regcontrol.c:15
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: regcontrol.c:26
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
static const struct @5136 g_SysClasses[]
WORD fnid
Definition: regcontrol.c:49
WORD ClsId
Definition: regcontrol.c:50
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
LRESULT WINAPI MsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: regcontrol.c:113
static PFNCLIENT pfnClientW
Definition: regcontrol.c:16
LRESULT WINAPI DialogWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: regcontrol.c:136
static PFNCLIENTWORKER pfnClientWorker
Definition: regcontrol.c:17
BOOL WINAPI RegisterClientPFN(VOID)
Definition: regcontrol.c:143
const struct builtin_class_descr DIALOG_builtin_class
Definition: dialog.c:109
LRESULT WINAPI ImeWndProcA(HWND, UINT, WPARAM, LPARAM)
Definition: imm.c:1090
const struct builtin_class_descr MDICLIENT_builtin_class
Definition: mdi.c:212
const struct builtin_class_descr MENU_builtin_class
LRESULT WINAPI ImeWndProcW(HWND, UINT, WPARAM, LPARAM)
Definition: imm.c:1096
BOOL WINAPI RegisterIMEClass(VOID)
Definition: imm.c:1127
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *, LPDWORD, WORD, DWORD, BOOL)
Definition: class.c:1262
LRESULT WINAPI ImeWndProc_common(HWND, UINT, WPARAM, LPARAM, BOOL)
Definition: imm.c:935
#define DefWindowProc
Definition: ros2win.h:31
& rect
Definition: startmenu.cpp:1413
WNDPROC_EX pfnDialogWndProc
Definition: ntuser.h:839
WNDPROC_EX pfnComboListBoxProc
Definition: ntuser.h:838
WNDPROC_EX pfnImeWndProc
Definition: ntuser.h:844
WNDPROC_EX pfnGhostWndProc
Definition: ntuser.h:845
WNDPROC_EX pfnComboBoxWndProc
Definition: ntuser.h:837
WNDPROC_EX pfnMDIClientWndProc
Definition: ntuser.h:842
WNDPROC_EX pfnEditWndProc
Definition: ntuser.h:840
WNDPROC_EX pfnButtonWndProc
Definition: ntuser.h:836
WNDPROC_EX pfnListBoxWndProc
Definition: ntuser.h:841
WNDPROC_EX pfnStaticWndProc
Definition: ntuser.h:843
WNDPROC_EX pfnCtfHookProc
Definition: ntuser.h:846
WNDPROC pfnDispatchDefWindowProc
Definition: ntuser.h:816
WNDPROC pfnMDIClientWndProc
Definition: ntuser.h:809
WNDPROC pfnGhostWndProc
Definition: ntuser.h:812
WNDPROC pfnScrollBarWndProc
Definition: ntuser.h:796
WNDPROC pfnDispatchMessage
Definition: ntuser.h:817
WNDPROC pfnMessageWindowProc
Definition: ntuser.h:801
WNDPROC pfnStaticWndProc
Definition: ntuser.h:810
WNDPROC pfnComboListBoxProc
Definition: ntuser.h:805
WNDPROC pfnComboBoxWndProc
Definition: ntuser.h:804
WNDPROC pfnMDIActivateDlgProc
Definition: ntuser.h:818
WNDPROC pfnTitleWndProc
Definition: ntuser.h:797
WNDPROC pfnDefWindowProc
Definition: ntuser.h:800
WNDPROC pfnMenuWndProc
Definition: ntuser.h:798
WNDPROC pfnButtonWndProc
Definition: ntuser.h:803
WNDPROC pfnSwitchWindowProc
Definition: ntuser.h:802
WNDPROC pfnDialogWndProc
Definition: ntuser.h:806
WNDPROC pfnEditWndProc
Definition: ntuser.h:807
WNDPROC pfnHkINLPCWPSTRUCT
Definition: ntuser.h:813
WNDPROC pfnDispatchHook
Definition: ntuser.h:815
WNDPROC pfnImeWndProc
Definition: ntuser.h:811
WNDPROC pfnDesktopWndProc
Definition: ntuser.h:799
WNDPROC pfnListBoxWndProc
Definition: ntuser.h:808
WNDPROC pfnHkINLPCWPRETSTRUCT
Definition: ntuser.h:814
Definition: ntuser.h:694
DWORD fnid
Definition: ntuser.h:709
Definition: tftpd.h:60
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LRESULT CALLBACK GhostWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:604
LRESULT CALLBACK GhostWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:610
const struct builtin_class_descr GHOST_builtin_class
Definition: ghost.c:17
LRESULT WINAPI GhostWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: ghost.c:515
LRESULT WINAPI ScrollBarWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1460
LRESULT WINAPI ScrollBarWndProcA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1466
HINSTANCE User32Instance
Definition: dllmain.c:27
LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: button.c:243
const struct builtin_class_descr BUTTON_builtin_class
Definition: button.c:142
LRESULT WINAPI ComboWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: combo.c:1814
const struct builtin_class_descr COMBO_builtin_class
Definition: combo.c:67
const struct builtin_class_descr EDIT_builtin_class
Definition: edit.c:5518
LRESULT WINAPI EditWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: edit.c:4854
const struct builtin_class_descr LISTBOX_builtin_class
Definition: listbox.c:126
LRESULT WINAPI ListBoxWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listbox.c:3285
LRESULT WINAPI ListBoxWndProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listbox.c:3277
const struct builtin_class_descr COMBOLBOX_builtin_class
Definition: listbox.c:142
LRESULT WINAPI ListBoxWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: listbox.c:2614
const struct builtin_class_descr STATIC_builtin_class
Definition: static.c:81
LRESULT WINAPI StaticWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: static.c:337
LRESULT WINAPI StaticWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:585
LRESULT WINAPI StaticWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:576
#define ZeroMemory
Definition: winbase.h:1737
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define LAYOUT_RTL
Definition: wingdi.h:1371
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefDlgProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_NCCREATE
Definition: winuser.h:1686
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define WM_DESTROY
Definition: winuser.h:1612