mirror of
https://github.com/reactos/reactos.git
synced 2025-05-08 11:24:14 +00:00
[COMCTL32] -Differentiate between v5 and v6 toolbar and make their CCM_SETVERSION behave correct according to their version.
svn path=/trunk/; revision=74922
This commit is contained in:
parent
2130f6ee4b
commit
f71f869a95
3 changed files with 87 additions and 10 deletions
|
@ -177,6 +177,10 @@ extern void UPDOWN_Register(void) DECLSPEC_HIDDEN;
|
|||
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;
|
||||
|
|
|
@ -207,7 +207,7 @@ static HANDLE CreateComctl32ActCtx(BOOL bV6)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void RegisterControls()
|
||||
static void RegisterControls(BOOL bV6)
|
||||
{
|
||||
ANIMATE_Register ();
|
||||
COMBOEX_Register ();
|
||||
|
@ -225,14 +225,23 @@ static void RegisterControls()
|
|||
STATUS_Register ();
|
||||
SYSLINK_Register ();
|
||||
TAB_Register ();
|
||||
TOOLBAR_Register ();
|
||||
TOOLTIPS_Register ();
|
||||
TRACKBAR_Register ();
|
||||
TREEVIEW_Register ();
|
||||
UPDOWN_Register ();
|
||||
|
||||
if (!bV6)
|
||||
{
|
||||
TOOLBAR_Register ();
|
||||
}
|
||||
else
|
||||
{
|
||||
BUTTON_Register();
|
||||
TOOLBARv6_Register();
|
||||
}
|
||||
}
|
||||
|
||||
static void UnregisterControls()
|
||||
static void UnregisterControls(BOOL bV6)
|
||||
{
|
||||
ANIMATE_Unregister ();
|
||||
COMBOEX_Unregister ();
|
||||
|
@ -250,11 +259,21 @@ static void UnregisterControls()
|
|||
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 @@ static void InitializeClasses()
|
|||
/* 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 @@ static void UninitializeClasses()
|
|||
|
||||
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 @@ static void UninitializeClasses()
|
|||
{
|
||||
activated = ActivateActCtx(hActCtx6, &ulCookie);
|
||||
THEMING_Uninitialize();
|
||||
UnregisterControls();
|
||||
BUTTON_Unregister();
|
||||
UnregisterControls(TRUE);
|
||||
if (activated) DeactivateActCtx(0, ulCookie);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5268,6 +5268,16 @@ TOOLBAR_SetVersion (TOOLBAR_INFO *infoPtr, INT iVersion)
|
|||
{
|
||||
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 @@ TOOLBAR_NCCalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
|
||||
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 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, const CREATESTRUCTW *lpcs)
|
|||
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 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
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 @@ TOOLBAR_Unregister (void)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue