2009-09-07 04:55:00 +00:00
|
|
|
/*
|
2003-06-16 13:46:26 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS User32
|
|
|
|
* PURPOSE: Built-in control registration
|
2009-09-07 04:55:00 +00:00
|
|
|
* FILE: dll/win32/user32/controls/regcontrol.c
|
2003-06-16 13:46:26 +00:00
|
|
|
* PROGRAMER: Ge van Geldorp (ge@gse.nl)
|
|
|
|
* REVISION HISTORY: 2003/06/16 GvG Created
|
|
|
|
* NOTES: Adapted from Wine
|
|
|
|
*/
|
|
|
|
|
2005-06-19 18:06:53 +00:00
|
|
|
#include <user32.h>
|
2003-06-16 13:46:26 +00:00
|
|
|
|
2006-06-26 13:16:43 +00:00
|
|
|
#include <wine/debug.h>
|
2009-09-07 04:55:00 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(user32);
|
|
|
|
|
|
|
|
DWORD RegisterDefaultClasses = FALSE;
|
2006-06-26 13:16:43 +00:00
|
|
|
|
2009-07-26 01:59:08 +00:00
|
|
|
static PFNCLIENT pfnClientA;
|
|
|
|
static PFNCLIENT pfnClientW;
|
|
|
|
static PFNCLIENTWORKER pfnClientWorker;
|
|
|
|
|
2009-09-07 04:55:00 +00:00
|
|
|
//
|
|
|
|
// FIXME!
|
|
|
|
// These are not "System Classes" but Global Classes that are registered
|
|
|
|
// every time a process is created, so these can be unregistered as the msdn
|
|
|
|
// documents states.
|
|
|
|
//
|
2007-11-16 07:12:59 +00:00
|
|
|
static const struct
|
2004-12-24 17:45:59 +00:00
|
|
|
{
|
2007-11-16 07:12:59 +00:00
|
|
|
const struct builtin_class_descr *desc;
|
2009-09-07 04:55:00 +00:00
|
|
|
WORD fnid;
|
|
|
|
WORD ClsId;
|
2007-11-16 07:12:59 +00:00
|
|
|
} g_SysClasses[] =
|
2003-06-16 13:46:26 +00:00
|
|
|
{
|
2009-09-07 04:55:00 +00:00
|
|
|
{ &DIALOG_builtin_class, FNID_DIALOG, ICLS_DIALOG},
|
|
|
|
/* { &POPUPMENU_builtin_class, FNID_MENU, ICLS_MENU}, // moved to win32k */
|
|
|
|
{ &COMBO_builtin_class, FNID_COMBOBOX, ICLS_COMBOBOX},
|
|
|
|
{ &COMBOLBOX_builtin_class, FNID_COMBOLBOX, ICLS_COMBOLBOX},
|
|
|
|
{ &MDICLIENT_builtin_class, FNID_MDICLIENT, ICLS_MDICLIENT},
|
2003-11-02 06:58:57 +00:00
|
|
|
#if 0
|
2009-09-07 04:55:00 +00:00
|
|
|
{ &MENU_builtin_class, FNID_MENU, ICLS_MENU},
|
2003-06-16 13:46:26 +00:00
|
|
|
#endif
|
2009-09-07 04:55:00 +00:00
|
|
|
/* { &SCROLL_builtin_class, FNID_SCROLLBAR, ICLS_SCROLLBAR}, // moved to win32k */
|
|
|
|
{ &BUTTON_builtin_class, FNID_BUTTON, ICLS_BUTTON},
|
|
|
|
{ &LISTBOX_builtin_class, FNID_LISTBOX, ICLS_LISTBOX},
|
|
|
|
{ &EDIT_builtin_class, FNID_EDIT, ICLS_EDIT},
|
|
|
|
/* { &ICONTITLE_builtin_class, FNID_ICONTITLE, ICLS_ICONTITLE}, // moved to win32k */
|
|
|
|
{ &STATIC_builtin_class, FNID_STATIC, ICLS_STATIC},
|
2007-11-16 07:12:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
BOOL WINAPI RegisterSystemControls(VOID)
|
|
|
|
{
|
2009-09-07 04:55:00 +00:00
|
|
|
WNDCLASSEXW WndClass;
|
2007-11-16 07:12:59 +00:00
|
|
|
UINT i;
|
2009-09-07 04:55:00 +00:00
|
|
|
ATOM atom;
|
|
|
|
|
|
|
|
if (RegisterDefaultClasses) return TRUE;
|
|
|
|
|
|
|
|
ZeroMemory(&WndClass, sizeof(WndClass));
|
2004-12-21 21:38:27 +00:00
|
|
|
|
2009-09-07 04:55:00 +00:00
|
|
|
WndClass.cbSize = sizeof(WndClass);
|
2003-12-07 23:02:57 +00:00
|
|
|
|
2009-09-07 04:55:00 +00:00
|
|
|
for (i = 0; i != sizeof(g_SysClasses) / sizeof(g_SysClasses[0]); i++)
|
2004-12-24 17:45:59 +00:00
|
|
|
{
|
2009-09-07 04:55:00 +00:00
|
|
|
WndClass.lpszClassName = g_SysClasses[i].desc->name;
|
|
|
|
|
|
|
|
// Set Global bit!
|
|
|
|
WndClass.style = g_SysClasses[i].desc->style|CS_GLOBALCLASS;
|
|
|
|
WndClass.lpfnWndProc = g_SysClasses[i].desc->procW;
|
|
|
|
WndClass.cbWndExtra = g_SysClasses[i].desc->extra;
|
|
|
|
WndClass.hCursor = LoadCursorW(NULL, g_SysClasses[i].desc->cursor);
|
|
|
|
WndClass.hbrBackground= g_SysClasses[i].desc->brush;
|
|
|
|
|
|
|
|
atom = RegisterClassExWOWW( &WndClass,
|
|
|
|
0,
|
|
|
|
g_SysClasses[i].fnid,
|
|
|
|
0,
|
|
|
|
FALSE);
|
|
|
|
if (atom)
|
|
|
|
RegisterDefaultClasses |= ICLASS_TO_MASK(g_SysClasses[i].ClsId);
|
2004-12-24 17:45:59 +00:00
|
|
|
}
|
2004-12-21 21:38:27 +00:00
|
|
|
|
2009-09-07 04:55:00 +00:00
|
|
|
return TRUE;
|
2003-06-16 13:46:26 +00:00
|
|
|
}
|
2009-07-12 02:09:49 +00:00
|
|
|
|
2009-07-26 01:59:08 +00:00
|
|
|
LRESULT
|
|
|
|
WINAPI
|
|
|
|
MsgWindowProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
|
|
|
|
{
|
|
|
|
if (message == WM_NCCREATE) return TRUE;
|
|
|
|
return 0;
|
|
|
|
}
|
2009-07-12 02:09:49 +00:00
|
|
|
|
2009-07-26 01:59:08 +00:00
|
|
|
LRESULT
|
|
|
|
WINAPI
|
|
|
|
DialogWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode)
|
|
|
|
{
|
|
|
|
if (unicode)
|
|
|
|
return DefDlgProcW( hwnd, uMsg, wParam, lParam);
|
|
|
|
return DefDlgProcA( hwnd, uMsg, wParam, lParam);
|
|
|
|
}
|
2009-07-12 02:09:49 +00:00
|
|
|
|
|
|
|
BOOL WINAPI RegisterClientPFN(VOID)
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
2009-07-26 01:59:08 +00:00
|
|
|
pfnClientA.pfnScrollBarWndProc = ScrollBarWndProcA;
|
|
|
|
pfnClientW.pfnScrollBarWndProc = ScrollBarWndProcW;
|
|
|
|
pfnClientA.pfnTitleWndProc = IconTitleWndProc;
|
|
|
|
pfnClientW.pfnTitleWndProc = IconTitleWndProc;
|
|
|
|
pfnClientA.pfnMenuWndProc = PopupMenuWndProcA;
|
|
|
|
pfnClientW.pfnMenuWndProc = PopupMenuWndProcW;
|
|
|
|
pfnClientA.pfnDesktopWndProc = DesktopWndProc;
|
2009-07-12 02:09:49 +00:00
|
|
|
pfnClientW.pfnDesktopWndProc = DesktopWndProc;
|
|
|
|
pfnClientA.pfnDefWindowProc = DefWindowProcA;
|
|
|
|
pfnClientW.pfnDefWindowProc = DefWindowProcW;
|
2009-07-26 01:59:08 +00:00
|
|
|
pfnClientA.pfnMessageWindowProc = MsgWindowProc;
|
|
|
|
pfnClientW.pfnMessageWindowProc = MsgWindowProc;
|
2009-07-12 02:09:49 +00:00
|
|
|
pfnClientA.pfnSwitchWindowProc = DefWindowProcA;
|
|
|
|
pfnClientW.pfnSwitchWindowProc = DefWindowProcW;
|
2009-07-26 01:59:08 +00:00
|
|
|
pfnClientA.pfnButtonWndProc = ButtonWndProcA;
|
|
|
|
pfnClientW.pfnButtonWndProc = ButtonWndProcW;
|
|
|
|
pfnClientA.pfnComboBoxWndProc = ComboWndProcA;
|
|
|
|
pfnClientW.pfnComboBoxWndProc = ComboWndProcW;
|
|
|
|
pfnClientA.pfnComboListBoxProc = ListBoxWndProcA;
|
|
|
|
pfnClientW.pfnComboListBoxProc = ListBoxWndProcW;
|
|
|
|
pfnClientA.pfnDialogWndProc = DefDlgProcA;
|
|
|
|
pfnClientW.pfnDialogWndProc = DefDlgProcW;
|
|
|
|
pfnClientA.pfnEditWndProc = EditWndProcA;
|
|
|
|
pfnClientW.pfnEditWndProc = EditWndProcW;
|
|
|
|
pfnClientA.pfnListBoxWndProc = ListBoxWndProcA;
|
|
|
|
pfnClientW.pfnListBoxWndProc = ListBoxWndProcW;
|
|
|
|
pfnClientA.pfnMDIClientWndProc = MDIClientWndProcA;
|
|
|
|
pfnClientW.pfnMDIClientWndProc = MDIClientWndProcW;
|
|
|
|
pfnClientA.pfnStaticWndProc = StaticWndProcA;
|
|
|
|
pfnClientW.pfnStaticWndProc = StaticWndProcW;
|
2009-07-12 02:09:49 +00:00
|
|
|
pfnClientA.pfnImeWndProc = DefWindowProcA;
|
|
|
|
pfnClientW.pfnImeWndProc = DefWindowProcW;
|
|
|
|
pfnClientA.pfnGhostWndProc = DefWindowProcA;
|
|
|
|
pfnClientW.pfnGhostWndProc = DefWindowProcW;
|
|
|
|
pfnClientA.pfnHkINLPCWPSTRUCT = DefWindowProcA;
|
|
|
|
pfnClientW.pfnHkINLPCWPSTRUCT = DefWindowProcW;
|
|
|
|
pfnClientA.pfnHkINLPCWPRETSTRUCT = DefWindowProcA;
|
|
|
|
pfnClientW.pfnHkINLPCWPRETSTRUCT = DefWindowProcW;
|
|
|
|
pfnClientA.pfnDispatchHook = DefWindowProcA;
|
|
|
|
pfnClientW.pfnDispatchHook = DefWindowProcW;
|
|
|
|
pfnClientA.pfnDispatchDefWindowProc = DefWindowProcA;
|
|
|
|
pfnClientW.pfnDispatchDefWindowProc = DefWindowProcW;
|
|
|
|
pfnClientA.pfnDispatchMessage = DefWindowProcA;
|
|
|
|
pfnClientW.pfnDispatchMessage = DefWindowProcW;
|
|
|
|
pfnClientA.pfnMDIActivateDlgProc = DefWindowProcA;
|
|
|
|
pfnClientW.pfnMDIActivateDlgProc = DefWindowProcW;
|
|
|
|
|
2009-07-26 01:59:08 +00:00
|
|
|
pfnClientWorker.pfnButtonWndProc = ButtonWndProc_common;
|
|
|
|
pfnClientWorker.pfnComboBoxWndProc = ComboWndProc_common;
|
|
|
|
pfnClientWorker.pfnComboListBoxProc = ListBoxWndProc_common;
|
|
|
|
pfnClientWorker.pfnDialogWndProc = DialogWndProc_common;
|
|
|
|
pfnClientWorker.pfnEditWndProc = EditWndProc_common;
|
|
|
|
pfnClientWorker.pfnListBoxWndProc = ListBoxWndProc_common;
|
|
|
|
pfnClientWorker.pfnMDIClientWndProc = MDIClientWndProc_common;
|
|
|
|
pfnClientWorker.pfnStaticWndProc = StaticWndProc_common;
|
2009-07-12 02:09:49 +00:00
|
|
|
pfnClientWorker.pfnImeWndProc = User32DefWindowProc;
|
|
|
|
pfnClientWorker.pfnGhostWndProc = User32DefWindowProc;
|
|
|
|
pfnClientWorker.pfnCtfHookProc = User32DefWindowProc;
|
|
|
|
|
|
|
|
Status = NtUserInitializeClientPfnArrays( &pfnClientA,
|
|
|
|
&pfnClientW,
|
|
|
|
&pfnClientWorker,
|
|
|
|
User32Instance);
|
|
|
|
|
|
|
|
return NT_SUCCESS(Status) ? TRUE : FALSE;
|
|
|
|
}
|