Author: gadamopoulos
Date: Mon Aug 15 20:53:12 2016
New Revision: 72233
URL:
http://svn.reactos.org/svn/reactos?rev=72233&view=rev
Log:
[EXPLORER]
- Implement resizing the taskbar in steps based on the way the rebar resizes. It works in
windows (a bit buggy) and it would work in ros if our rebar could resize on demand.
- Let CStartButton handle the creation of the start button.
Modified:
trunk/reactos/base/shell/explorer/traywnd.cpp
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywn…
==============================================================================
--- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Mon Aug 15 20:53:12
2016
@@ -64,16 +64,15 @@
const GUID IID_IShellDesktopTray = { 0x213e2df9, 0x9a14, 0x4328, { 0x99, 0xb1, 0x69,
0x61, 0xf9, 0x14, 0x3c, 0xe9 } };
class CStartButton
- : public CContainedWindow
+ : public CWindow
{
HIMAGELIST m_ImageList;
SIZE m_Size;
HFONT m_Font;
public:
- CStartButton(CMessageMap *pObject, DWORD dwMsgMapID)
- : CContainedWindow(pObject, dwMsgMapID),
- m_ImageList(NULL),
+ CStartButton()
+ : m_ImageList(NULL),
m_Font(NULL)
{
m_Size.cx = 0;
@@ -311,7 +310,7 @@
}
}
- SendMessage(WM_SETFONT, (WPARAM) m_Font, FALSE);
+ SetFont(m_Font, FALSE);
if (CreateImageList())
{
@@ -350,6 +349,36 @@
if (hbmOld != NULL)
DeleteObject(hbmOld);
}
+ }
+
+ HWND Create(HWND hwndParent)
+ {
+ WCHAR szStartCaption[32];
+ if (!LoadStringW(hExplorerInstance,
+ IDS_START,
+ szStartCaption,
+ _countof(szStartCaption)))
+ {
+ szStartCaption[0] = L'\0';
+ }
+
+ DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | BS_PUSHBUTTON |
BS_CENTER | BS_VCENTER | BS_BITMAP;
+
+ m_hWnd = CreateWindowEx(
+ 0,
+ WC_BUTTON,
+ szStartCaption,
+ dwStyle,
+ 0, 0, 0, 0,
+ hwndParent,
+ (HMENU) IDC_STARTBTN,
+ hExplorerInstance,
+ NULL);
+
+ if (m_hWnd)
+ Initialize();
+
+ return m_hWnd;
}
};
@@ -418,7 +447,7 @@
public:
CTrayWindow() :
- m_StartButton(this, 1),
+ m_StartButton(),
m_Theme(NULL),
m_CaptionFont(NULL),
m_Font(NULL),
@@ -1457,22 +1486,11 @@
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
- WCHAR szStartCaption[32];
-
((ITrayWindow*)this)->AddRef();
SetWindowTheme(m_hWnd, L"TaskBar", NULL);
- OnThemeChanged();
InterlockedIncrement(&TrayWndCount);
-
- if (!LoadStringW(hExplorerInstance,
- IDS_START,
- szStartCaption,
- _countof(szStartCaption)))
- {
- szStartCaption[0] = L'\0';
- }
if (m_CaptionFont == NULL)
{
@@ -1490,27 +1508,9 @@
}
}
}
-
+
/* Create the Start button */
- m_StartButton.SubclassWindow(CreateWindowEx(
- 0,
- WC_BUTTON,
- szStartCaption,
- WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
- BS_PUSHBUTTON | BS_CENTER | BS_VCENTER | BS_BITMAP,
- 0,
- 0,
- 0,
- 0,
- m_hWnd,
- (HMENU) IDC_STARTBTN,
- hExplorerInstance,
- NULL));
-
- if (m_StartButton.m_hWnd)
- {
- m_StartButton.Initialize();
- }
+ m_StartButton.Create(m_hWnd);
/* Load the saved tray window settings */
RegLoadSettings();
@@ -1520,11 +1520,6 @@
m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, 0);
/* Load the tray band site */
- if (m_TrayBandSite != NULL)
- {
- m_TrayBandSite.Release();
- }
-
m_TrayBandSite = CreateTrayBandSite(this, &m_Rebar, &m_TaskSwitch);
SetWindowTheme(m_Rebar, L"TaskBar", NULL);
@@ -2305,6 +2300,36 @@
if (!Locked)
{
+ /* Get the rect of the rebar */
+ RECT rebarRect, taskbarRect;
+ ::GetWindowRect(m_Rebar, &rebarRect);
+ ::GetWindowRect(m_hWnd, &taskbarRect);
+ OffsetRect(&rebarRect, -taskbarRect.left, -taskbarRect.top);
+
+ /* Calculate the difference of size of the taskbar and the rebar */
+ SIZE margins;
+ margins.cx = taskbarRect.right - taskbarRect.left - rebarRect.right +
rebarRect.left;
+ margins.cy = taskbarRect.bottom - taskbarRect.top - rebarRect.bottom +
rebarRect.top;
+
+ /* Calculate the new size of the rebar and make it resize, then change the
new taskbar size */
+ switch (m_Position)
+ {
+ case ABE_TOP:
+ rebarRect.bottom = rebarRect.top + pRect->bottom - pRect->top -
margins.cy;
+ ::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT,
(LPARAM)&rebarRect);
+ pRect->bottom = pRect->top + rebarRect.bottom - rebarRect.top +
margins.cy;
+ break;
+ case ABE_BOTTOM:
+ rebarRect.top = rebarRect.bottom - (pRect->bottom - pRect->top -
margins.cy);
+ ::SendMessageW(m_Rebar, RB_SIZETORECT, RBSTR_CHANGERECT,
(LPARAM)&rebarRect);
+ pRect->top = pRect->bottom - (rebarRect.bottom - rebarRect.top +
margins.cy);
+ break;
+ case ABE_LEFT:
+ case ABE_RIGHT:
+ /* FIXME: what to do here? */
+ break;
+ }
+
CalculateValidSize(m_Position, pRect);
}
else