ReactOS  0.4.15-dev-3453-gff89651
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:2614
#define FNID_EDIT
Definition: ntuser.h:840
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
WNDPROC pfnStaticWndProc
Definition: ntuser.h:780
HRGN set_control_clipping(HDC hdc, const RECT *rect)
Definition: regcontrol.c:26
#define ICLS_MDICLIENT
Definition: ntuser.h:888
#define FNID_COMBOBOX
Definition: ntuser.h:837
const struct builtin_class_descr EDIT_builtin_class
Definition: edit.c:5371
LRESULT WINAPI ListBoxWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listbox.c:3285
#define LAYOUT_RTL
Definition: wingdi.h:1371
WORD ClsId
Definition: regcontrol.c:50
WORD ATOM
Definition: dimm.idl:113
#define TRUE
Definition: types.h:120
WNDPROC pfnGhostWndProc
Definition: ntuser.h:782
WNDPROC pfnEditWndProc
Definition: ntuser.h:777
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:813
WNDPROC pfnDefWindowProc
Definition: ntuser.h:770
#define FNID_MENU
Definition: ntuser.h:831
LONG NTSTATUS
Definition: precomp.h:26
#define ICLS_EDIT
Definition: ntuser.h:883
static HDC
Definition: imagelist.c:92
WNDPROC pfnMessageWindowProc
Definition: ntuser.h:771
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
WNDPROC pfnDialogWndProc
Definition: ntuser.h:776
#define ZeroMemory
Definition: winbase.h:1664
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:868
LRESULT WINAPI MDIClientWndProc_common(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode)
Definition: mdi.c:1101
WNDPROC pfnComboListBoxProc
Definition: ntuser.h:775
#define WM_NCCREATE
Definition: winuser.h:1670
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:117
LRESULT WINAPI ScrollBarWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: scrollbar.c:1461
& rect
Definition: startmenu.cpp:1413
WPARAM wParam
Definition: combotst.c:138
#define ICLS_DIALOG
Definition: ntuser.h:900
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define FNID_MESSAGEWND
Definition: ntuser.h:834
ATOM WINAPI RegisterClassExWOWW(WNDCLASSEXW *, LPDWORD, WORD, DWORD, BOOL)
Definition: class.c:1413
WNDPROC_EX pfnMDIClientWndProc
Definition: ntuser.h:812
#define ICLS_LISTBOX
Definition: ntuser.h:885
WORD fnid
Definition: regcontrol.c:49
WNDPROC pfnComboBoxWndProc
Definition: ntuser.h:774
#define FALSE
Definition: types.h:117
DWORD fnid
Definition: ntuser.h:679
unsigned int BOOL
Definition: ntddk_ex.h:94
WNDPROC pfnListBoxWndProc
Definition: ntuser.h:778
LRESULT CALLBACK GhostWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ghost.c:610
#define FNID_DIALOG
Definition: ntuser.h:839
WNDPROC_EX pfnButtonWndProc
Definition: ntuser.h:806
WNDPROC pfnDispatchDefWindowProc
Definition: ntuser.h:786
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
WNDPROC_EX pfnComboListBoxProc
Definition: ntuser.h:808
WNDPROC pfnMenuWndProc
Definition: ntuser.h:768
LONG_PTR LPARAM
Definition: windef.h:208
WNDPROC_EX pfnListBoxWndProc
Definition: ntuser.h:811
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:898
WNDPROC_EX pfnEditWndProc
Definition: ntuser.h:810
LRESULT WINAPI ImeWndProcW(HWND, UINT, WPARAM, LPARAM)
Definition: imm.c:192
#define FNID_MDICLIENT
Definition: ntuser.h:842
#define ICLS_STATIC
Definition: ntuser.h:884
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:1596
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
Status
Definition: gdiplustypes.h:24
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
static const struct @4891 g_SysClasses[]
#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:109
LRESULT WINAPI ImeWndProcA(HWND, UINT, WPARAM, LPARAM)
Definition: imm.c:187
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define WINAPI
Definition: msvc.h:6
LRESULT WINAPI ImeWndProc_common(HWND, UINT, WPARAM, LPARAM, BOOL)
Definition: imm.c:136
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:783
WNDPROC pfnScrollBarWndProc
Definition: ntuser.h:766
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:4752
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:807
LRESULT WINAPI SwitchWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: appswitch.c:842
#define ICLS_IME
Definition: ntuser.h:897
PWND FASTCALL ValidateHwnd(HWND hwnd)
Definition: misc.c:359
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:225
static HRGN hrgn
Definition: win.c:55
WNDPROC pfnDesktopWndProc
Definition: ntuser.h:769
#define FNID_COMBOLBOX
Definition: ntuser.h:838
WNDPROC_EX pfnImeWndProc
Definition: ntuser.h:814
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define FNID_LISTBOX
Definition: ntuser.h:841
const struct builtin_class_descr MENU_builtin_class
#define ICLS_COMBOLBOX
Definition: ntuser.h:889
LRESULT WINAPI MDIClientWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: mdi.c:1355
static PFNCLIENT pfnClientA
Definition: regcontrol.c:15
LRESULT WINAPI StaticWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: static.c:585
Definition: ntuser.h:663
#define FNID_GHOST
Definition: ntuser.h:845
WNDPROC pfnImeWndProc
Definition: ntuser.h:781
WNDPROC_EX pfnGhostWndProc
Definition: ntuser.h:815
WNDPROC pfnSwitchWindowProc
Definition: ntuser.h:772
LRESULT WINAPI PopupMenuWndProcA(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
Definition: menu.c:376
DWORD WINAPI GetLayout(_In_ HDC hdc)
Definition: coord.c:750
static PFNCLIENTWORKER pfnClientWorker
Definition: regcontrol.c:17
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
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:836
LRESULT WINAPI EditWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
LRESULT WINAPI ListBoxWndProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: listbox.c:3277
WNDPROC_EX pfnCtfHookProc
Definition: ntuser.h:816
LRESULT WINAPI ButtonWndProcW(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
WNDPROC_EX pfnDialogWndProc
Definition: ntuser.h:809
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:1467
const struct builtin_class_descr COMBOLBOX_builtin_class
Definition: listbox.c:142
WNDPROC pfnDispatchHook
Definition: ntuser.h:785
LRESULT WINAPI DesktopWndProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: message.c:1307
BOOL WINAPI RegisterSystemControls(VOID)
Definition: regcontrol.c:70
#define ICLASS_TO_MASK(iCls)
Definition: ntuser.h:872
BOOL NTAPI NtUserSetWindowFNID(HWND hWnd, WORD fnID)
Definition: window.c:4089
#define ICLS_BUTTON
Definition: ntuser.h:882
LRESULT WINAPI ComboWndProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
WNDPROC pfnDispatchMessage
Definition: ntuser.h:787
WNDPROC pfnButtonWndProc
Definition: ntuser.h:773
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:901
WNDPROC pfnHkINLPCWPRETSTRUCT
Definition: ntuser.h:784
WNDPROC pfnTitleWndProc
Definition: ntuser.h:767
LONG_PTR LRESULT
Definition: windef.h:209
WNDPROC pfnMDIClientWndProc
Definition: ntuser.h:779
LPARAM lParam
Definition: combotst.c:139
#define FNID_STATIC
Definition: ntuser.h:843
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:788
#define ICLS_COMBOBOX
Definition: ntuser.h:887