ReactOS  0.4.14-dev-55-g2da92ac
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  {
33  DeleteObject( hrgn );
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 
46 static const struct
47 {
48  const struct builtin_class_descr *desc;
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 
111 LRESULT
112 WINAPI
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 
131  return DefWindowProc(hwnd, message, wParam, lParam );
132 }
133 
134 LRESULT
135 WINAPI
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 }
LRESULT WINAPI ListBoxWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: listbox.c:2600
#define FNID_EDIT
Definition: ntuser.h:832
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
LRESULT WINAPI DesktopWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:33
Definition: tftpd.h:59
#define TRUE
Definition: types.h:120
WNDPROC pfnStaticWndProc
Definition: ntuser.h:772
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: regcontrol.c:26
#define ICLS_MDICLIENT
Definition: ntuser.h:879
#define FNID_COMBOBOX
Definition: ntuser.h:829
const struct builtin_class_descr EDIT_builtin_class
Definition: edit.c:5363
LRESULT WINAPI ListBoxWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listbox.c:3274
#define LAYOUT_RTL
Definition: wingdi.h:1370
WORD ClsId
Definition: regcontrol.c:50
WORD ATOM
Definition: dimm.idl:113
WNDPROC pfnGhostWndProc
Definition: ntuser.h:774
WNDPROC pfnEditWndProc
Definition: ntuser.h:769
static const struct @4137 g_SysClasses[]
LRESULT WINAPI SwitchWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: appswitch.c:837
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const struct builtin_class_descr BUTTON_builtin_class
Definition: button.c:142
LRESULT WINAPI MsgWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: regcontrol.c:113
WNDPROC_EX pfnStaticWndProc
Definition: ntuser.h:805
WNDPROC pfnDefWindowProc
Definition: ntuser.h:762
#define FNID_MENU
Definition: ntuser.h:823
LONG NTSTATUS
Definition: precomp.h:26
#define ICLS_EDIT
Definition: ntuser.h:874
static HDC
Definition: imagelist.c:92
WNDPROC pfnMessageWindowProc
Definition: ntuser.h:763
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
WNDPROC pfnDialogWndProc
Definition: ntuser.h:768
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
LRESULT WINAPI PopupMenuWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: menu.c:305
UINT_PTR WPARAM
Definition: windef.h:207
#define FNID_DESTROY
Definition: ntuser.h:859
LRESULT WINAPI MDIClientWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: mdi.c:1101
WNDPROC pfnComboListBoxProc
Definition: ntuser.h:767
#define WM_NCCREATE
Definition: winuser.h:1665
LRESULT WINAPI GhostWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: ghost.c:515
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
HINSTANCE User32Instance
Definition: dllmain.c:27
NTSTATUS NTAPI NtUserInitializeClientPfnArrays(PPFNCLIENT pfnClientA, PPFNCLIENT pfnClientW, PPFNCLIENTWORKER pfnClientWorker, HINSTANCE hmodUser)
Definition: ntstubs.c:124
LRESULT WINAPI ScrollBarWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1420
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define ICLS_DIALOG
Definition: ntuser.h:891
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define FNID_MESSAGEWND
Definition: ntuser.h:826
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *, LPDWORD, WORD, DWORD, BOOL)
Definition: class.c:1411
WNDPROC_EX pfnMDIClientWndProc
Definition: ntuser.h:804
#define ICLS_LISTBOX
Definition: ntuser.h:876
WORD fnid
Definition: regcontrol.c:49
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
WNDPROC pfnComboBoxWndProc
Definition: ntuser.h:766
DWORD fnid
Definition: ntuser.h:673
unsigned int BOOL
Definition: ntddk_ex.h:94
WNDPROC pfnListBoxWndProc
Definition: ntuser.h:770
LRESULT CALLBACK GhostWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:610
#define FNID_DIALOG
Definition: ntuser.h:831
WNDPROC_EX pfnButtonWndProc
Definition: ntuser.h:798
WNDPROC pfnDispatchDefWindowProc
Definition: ntuser.h:778
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
WNDPROC_EX pfnComboListBoxProc
Definition: ntuser.h:800
smooth NULL
Definition: ftsmooth.c:416
WNDPROC pfnMenuWndProc
Definition: ntuser.h:760
LONG_PTR LPARAM
Definition: windef.h:208
WNDPROC_EX pfnListBoxWndProc
Definition: ntuser.h:803
const struct builtin_class_descr MDICLIENT_builtin_class
Definition: mdi.c:213
BOOL WINAPI RegisterClientPFN(VOID)
Definition: regcontrol.c:143
#define ICLS_GHOST
Definition: ntuser.h:889
WNDPROC_EX pfnEditWndProc
Definition: ntuser.h:802
LRESULT WINAPI ImeWndProcW(HWND, UINT, WPARAM, LPARAM)
Definition: imm.c:280
#define FNID_MDICLIENT
Definition: ntuser.h:834
#define ICLS_STATIC
Definition: ntuser.h:875
LRESULT WINAPI StaticWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:576
const struct builtin_class_descr COMBO_builtin_class
Definition: combo.c:67
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: button.c:243
LRESULT WINAPI IconTitleWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: icontitle.c:184
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LRESULT WINAPI User32DefWindowProc(HWND, UINT, WPARAM, LPARAM, BOOL)
Definition: defwnd.c:316
LRESULT CALLBACK GhostWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:604
const struct builtin_class_descr DIALOG_builtin_class
Definition: dialog.c:111
LRESULT WINAPI ImeWndProcA(HWND, UINT, WPARAM, LPARAM)
Definition: imm.c:275
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define WINAPI
Definition: msvc.h:8
LRESULT WINAPI ImeWndProc_common(HWND, UINT, WPARAM, LPARAM, BOOL)
Definition: imm.c:224
unsigned short WORD
Definition: ntddk_ex.h:93
LRESULT WINAPI MDIClientWndProcW(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1364
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
WNDPROC pfnHkINLPCWPSTRUCT
Definition: ntuser.h:775
WNDPROC pfnScrollBarWndProc
Definition: ntuser.h:758
LRESULT WINAPI ComboWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: combo.c:1822
LRESULT WINAPI EditWndProc_common(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: edit.c:4743
LRESULT WINAPI DefDlgProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI StaticWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: static.c:337
WNDPROC_EX pfnComboBoxWndProc
Definition: ntuser.h:799
LRESULT WINAPI SwitchWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: appswitch.c:842
#define ICLS_IME
Definition: ntuser.h:888
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:369
HDC hdc
Definition: main.c:9
LRESULT WINAPI DialogWndProc_common(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: regcontrol.c:136
BOOL WINAPI RegisterIMEClass(VOID)
Definition: imm.c:313
static HRGN hrgn
Definition: win.c:55
WNDPROC pfnDesktopWndProc
Definition: ntuser.h:761
#define FNID_COMBOLBOX
Definition: ntuser.h:830
WNDPROC_EX pfnImeWndProc
Definition: ntuser.h:806
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define FNID_LISTBOX
Definition: ntuser.h:833
const struct builtin_class_descr MENU_builtin_class
#define ICLS_COMBOLBOX
Definition: ntuser.h:880
LRESULT WINAPI MDIClientWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1355
static PFNCLIENT pfnClientA
Definition: regcontrol.c:15
Status
Definition: gdiplustypes.h:24
LRESULT WINAPI StaticWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:585
Definition: ntuser.h:657
#define FNID_GHOST
Definition: ntuser.h:837
WNDPROC pfnImeWndProc
Definition: ntuser.h:773
WNDPROC_EX pfnGhostWndProc
Definition: ntuser.h:807
WNDPROC pfnSwitchWindowProc
Definition: ntuser.h:764
LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: menu.c:376
DWORD WINAPI GetLayout(_In_ HDC hdc)
Definition: coord.c:741
static PFNCLIENTWORKER pfnClientWorker
Definition: regcontrol.c:17
const struct builtin_class_descr STATIC_builtin_class
Definition: static.c:81
LRESULT WINAPI EditWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
#define FNID_BUTTON
Definition: ntuser.h:828
LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned int UINT
Definition: ndis.h:50
LRESULT WINAPI ListBoxWndProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listbox.c:3266
WNDPROC_EX pfnCtfHookProc
Definition: ntuser.h:808
LRESULT WINAPI ButtonWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WNDPROC_EX pfnDialogWndProc
Definition: ntuser.h:801
LRESULT WINAPI ButtonWndProcA(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
LRESULT WINAPI ScrollBarWndProcA(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1426
const struct builtin_class_descr COMBOLBOX_builtin_class
Definition: listbox.c:142
WNDPROC pfnDispatchHook
Definition: ntuser.h:777
LRESULT WINAPI DesktopWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: message.c:1306
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:863
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4122
#define ICLS_BUTTON
Definition: ntuser.h:873
LRESULT WINAPI ComboWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
WNDPROC pfnDispatchMessage
Definition: ntuser.h:779
WNDPROC pfnButtonWndProc
Definition: ntuser.h:765
static PFNCLIENT pfnClientW
Definition: regcontrol.c:16
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
DWORD RegisterDefaultClasses
Definition: regcontrol.c:13
const struct builtin_class_descr LISTBOX_builtin_class
Definition: listbox.c:126
#define ICLS_MENU
Definition: ntuser.h:892
WNDPROC pfnHkINLPCWPRETSTRUCT
Definition: ntuser.h:776
WNDPROC pfnTitleWndProc
Definition: ntuser.h:759
LONG_PTR LRESULT
Definition: windef.h:209
WNDPROC pfnMDIClientWndProc
Definition: ntuser.h:771
LPARAM lParam
Definition: combotst.c:139
#define FNID_STATIC
Definition: ntuser.h:835
const struct builtin_class_descr GHOST_builtin_class
Definition: ghost.c:17
LRESULT WINAPI ComboWndProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
WCHAR WndClass[]
Definition: capicon.c:23
WNDPROC pfnMDIActivateDlgProc
Definition: ntuser.h:780
#define ICLS_COMBOBOX
Definition: ntuser.h:878