Author: gadamopoulos
Date: Mon Jun 5 14:23:42 2017
New Revision: 74922
URL:
http://svn.reactos.org/svn/reactos?rev=74922&view=rev
Log:
[COMCTL32] -Differentiate between v5 and v6 toolbar and make their CCM_SETVERSION behave
correct according to their version.
Modified:
trunk/reactos/dll/win32/comctl32/comctl32.h
trunk/reactos/dll/win32/comctl32/commctrl.c
trunk/reactos/dll/win32/comctl32/toolbar.c
Modified: trunk/reactos/dll/win32/comctl32/comctl32.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] Mon Jun 5 14:23:42 2017
@@ -177,6 +177,10 @@
extern void UPDOWN_Unregister(void) DECLSPEC_HIDDEN;
extern void BUTTON_Register();
extern void BUTTON_Unregister();
+#ifdef __REACTOS__
+extern void TOOLBARv6_Register(void) DECLSPEC_HIDDEN;
+extern void TOOLBARv6_Unregister(void) DECLSPEC_HIDDEN;
+#endif
int MONTHCAL_MonthLength(int month, int year) DECLSPEC_HIDDEN;
int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) DECLSPEC_HIDDEN;
Modified: trunk/reactos/dll/win32/comctl32/commctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctr…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Mon Jun 5 14:23:42 2017
@@ -207,7 +207,7 @@
return ret;
}
-static void RegisterControls()
+static void RegisterControls(BOOL bV6)
{
ANIMATE_Register ();
COMBOEX_Register ();
@@ -225,14 +225,23 @@
STATUS_Register ();
SYSLINK_Register ();
TAB_Register ();
- TOOLBAR_Register ();
TOOLTIPS_Register ();
TRACKBAR_Register ();
TREEVIEW_Register ();
UPDOWN_Register ();
-}
-
-static void UnregisterControls()
+
+ if (!bV6)
+ {
+ TOOLBAR_Register ();
+ }
+ else
+ {
+ BUTTON_Register();
+ TOOLBARv6_Register();
+ }
+}
+
+static void UnregisterControls(BOOL bV6)
{
ANIMATE_Unregister ();
COMBOEX_Unregister ();
@@ -250,11 +259,21 @@
STATUS_Unregister ();
SYSLINK_Unregister ();
TAB_Unregister ();
- TOOLBAR_Unregister ();
TOOLTIPS_Unregister ();
TRACKBAR_Unregister ();
TREEVIEW_Unregister ();
UPDOWN_Unregister ();
+
+ if (!bV6)
+ {
+ TOOLBAR_Unregister ();
+ }
+ else
+ {
+ BUTTON_Unregister();
+ TOOLBARv6_Unregister ();
+ }
+
}
static void InitializeClasses()
@@ -267,15 +286,14 @@
/* Register the classes once no matter what */
hActCtx5 = CreateComctl32ActCtx(FALSE);
activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5,
&ulCookie) : FALSE);
- RegisterControls(); /* Register the classes pretending to be v5 */
+ RegisterControls(FALSE); /* Register the classes pretending to be v5 */
if (activated) DeactivateActCtx(0, ulCookie);
hActCtx6 = CreateComctl32ActCtx(TRUE);
if (hActCtx6 != INVALID_HANDLE_VALUE)
{
activated = ActivateActCtx(hActCtx6, &ulCookie);
- RegisterControls(); /* Register the classes pretending to be v6 */
- BUTTON_Register();
+ RegisterControls(TRUE); /* Register the classes pretending to be v6 */
if (activated) DeactivateActCtx(0, ulCookie);
/* Initialize the themed controls only when the v6 manifest is present */
@@ -291,7 +309,7 @@
hActCtx5 = CreateComctl32ActCtx(FALSE);
activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5,
&ulCookie) : FALSE);
- UnregisterControls();
+ UnregisterControls(FALSE);
if (activated) DeactivateActCtx(0, ulCookie);
hActCtx6 = CreateComctl32ActCtx(TRUE);
@@ -299,8 +317,7 @@
{
activated = ActivateActCtx(hActCtx6, &ulCookie);
THEMING_Uninitialize();
- UnregisterControls();
- BUTTON_Unregister();
+ UnregisterControls(TRUE);
if (activated) DeactivateActCtx(0, ulCookie);
}
}
Modified: trunk/reactos/dll/win32/comctl32/toolbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/toolbar…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] Mon Jun 5 14:23:42 2017
@@ -5268,6 +5268,16 @@
{
INT iOldVersion = infoPtr->iVersion;
+#ifdef __REACTOS__
+ /* The v6 control doesn't support changing its version */
+ if (iOldVersion == 6)
+ return iOldVersion;
+
+ /* And a control that is not v6 can't be set to be a v6 one */
+ if (iVersion >= 6)
+ return -1;
+#endif
+
infoPtr->iVersion = iVersion;
if (infoPtr->iVersion >= 5)
@@ -6178,7 +6188,11 @@
static LRESULT
+#ifdef __REACTOS__
+TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs, int iVersion)
+#else
TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
+#endif
{
TOOLBAR_INFO *infoPtr;
DWORD styleadd = 0;
@@ -6212,7 +6226,11 @@
infoPtr->dwDTFlags = (lpcs->style & TBSTYLE_LIST) ? DT_LEFT | DT_VCENTER |
DT_SINGLELINE | DT_END_ELLIPSIS: DT_CENTER | DT_END_ELLIPSIS;
infoPtr->bAnchor = FALSE; /* no anchor highlighting */
infoPtr->bDragOutSent = FALSE;
+#ifdef __REACTOS__
+ infoPtr->iVersion = iVersion;
+#else
infoPtr->iVersion = 0;
+#endif
infoPtr->hwndSelf = hwnd;
infoPtr->bDoRedraw = TRUE;
infoPtr->clrBtnHighlight = CLR_DEFAULT;
@@ -7003,7 +7021,11 @@
return TOOLBAR_NCCalcSize (hwnd, wParam, lParam);
case WM_NCCREATE:
+#ifdef __REACTOS__
+ return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam, 0);
+#else
return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam);
+#endif
case WM_NCPAINT:
return TOOLBAR_NCPaint (hwnd, wParam, lParam);
@@ -7089,6 +7111,40 @@
UnregisterClassW (TOOLBARCLASSNAMEW, NULL);
}
+#ifdef __REACTOS__
+static LRESULT WINAPI
+ToolbarV6WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ if (uMsg == WM_NCCREATE)
+ return TOOLBAR_NCCreate (hwnd, wParam, (CREATESTRUCTW*)lParam, 6);
+ else
+ return ToolbarWindowProc(hwnd, uMsg, wParam, lParam);
+}
+
+VOID
+TOOLBARv6_Register (void)
+{
+ WNDCLASSW wndClass;
+
+ ZeroMemory (&wndClass, sizeof(WNDCLASSW));
+ wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
+ wndClass.lpfnWndProc = ToolbarV6WindowProc;
+ wndClass.cbClsExtra = 0;
+ wndClass.cbWndExtra = sizeof(TOOLBAR_INFO *);
+ wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
+ wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
+ wndClass.lpszClassName = TOOLBARCLASSNAMEW;
+
+ RegisterClassW (&wndClass);
+}
+
+VOID
+TOOLBARv6_Unregister (void)
+{
+ UnregisterClassW (TOOLBARCLASSNAMEW, NULL);
+}
+#endif
+
static HIMAGELIST TOOLBAR_InsertImageList(PIMLENTRY **pies, INT *cies, HIMAGELIST himl,
INT id)
{
HIMAGELIST himlold;