From 427c8aeb8f0a909970cc892c8540a12c7c8b76cf Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Wed, 25 Feb 2004 22:56:49 +0000 Subject: [PATCH] rebar control for desktop bar svn path=/trunk/; revision=8387 --- .../subsys/system/explorer/doc/changes.txt | 1 + .../system/explorer/taskbar/desktopbar.cpp | 52 +++++++++++++++++-- .../system/explorer/taskbar/desktopbar.h | 1 + .../system/explorer/taskbar/quicklaunch.cpp | 4 +- .../system/explorer/taskbar/taskbar.cpp | 7 +-- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/reactos/subsys/system/explorer/doc/changes.txt b/reactos/subsys/system/explorer/doc/changes.txt index 2ad53d9a8f5..5c9be3f46fc 100644 --- a/reactos/subsys/system/explorer/doc/changes.txt +++ b/reactos/subsys/system/explorer/doc/changes.txt @@ -65,3 +65,4 @@ If you search for more information, look into the CVS repository. 16.02.2004 m. fuchs lean explorer version without additional bells and whistles -> see CVS branch "lean-explorer" 23.02.2004 m. fuchs start menu navigation using first characters of entry names fixes for leaking GDI handles +25.02.2004 m. fuchs rebar control for desktop bar diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp index 759d7d2fc9d..abfdade55a6 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp @@ -103,6 +103,44 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs) _hwndQuickLaunch = QuickLaunchBar::Create(_hwnd); + // create rebar window to manage task and quick launch bar +#ifndef _NO_REBAR + _hwndrebar = CreateWindowEx(WS_EX_TOOLWINDOW, REBARCLASSNAME, NULL, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| + RBS_VARHEIGHT|RBS_AUTOSIZE|RBS_DBLCLKTOGGLE| //|RBS_REGISTERDROP + CCS_NODIVIDER|CCS_NOPARENTALIGN, + 0, 0, 0, 0, _hwnd, 0, g_Globals._hInstance, 0); + + REBARBANDINFO rbBand; + + rbBand.cbSize = sizeof(REBARBANDINFO); + rbBand.fMask = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE; +#ifndef RBBS_HIDETITLE // missing in MinGW headers as of 25.02.2004 +#define RBBS_HIDETITLE 0x400 +#endif + rbBand.fStyle = RBBS_CHILDEDGE|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE; + + rbBand.cxMinChild = 0; + rbBand.cyMinChild = 0; + rbBand.cyChild = 0; + rbBand.cyMaxChild = 0; + rbBand.cyIntegral = DESKTOPBARBAR_HEIGHT; + + rbBand.lpText = TEXT("Quicklaunchbar"); + rbBand.hwndChild = _hwndQuickLaunch; + rbBand.cxMinChild = 0; + rbBand.cyMinChild = HIWORD(SendMessage(_hwndQuickLaunch, TB_GETBUTTONSIZE, 0, 0)) + 2; + rbBand.cx = 250; + SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); + + rbBand.lpText = TEXT("Taskbar"); + rbBand.hwndChild = _hwndTaskBar; + rbBand.cxMinChild = 0; + rbBand.cyMinChild = ClientRect(_hwndTaskBar).bottom + 2; + rbBand.cx = 200; //pcs->cx-TASKBAR_LEFT-quicklaunch_width-(notifyarea_width+1); + SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); +#endif + RegisterHotkeys(); // notify all top level windows about the successfully created desktop bar @@ -204,15 +242,19 @@ void DesktopBar::Resize(int cx, int cy) HDWP hdwp = BeginDeferWindowPos(3); - if (_hwndTaskBar) - DeferWindowPos(hdwp, _hwndTaskBar, 0, TASKBAR_LEFT+quicklaunch_width, 0, cx-TASKBAR_LEFT-quicklaunch_width-(notifyarea_width+1), cy, SWP_NOZORDER|SWP_NOACTIVATE); + if (_hwndrebar) + DeferWindowPos(hdwp, _hwndrebar, 0, TASKBAR_LEFT, 0, cx-TASKBAR_LEFT-(notifyarea_width+1), cy, SWP_NOZORDER|SWP_NOACTIVATE); + else { + if (_hwndQuickLaunch) + DeferWindowPos(hdwp, _hwndQuickLaunch, 0, TASKBAR_LEFT, 1, quicklaunch_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE); + + if (_hwndTaskBar) + DeferWindowPos(hdwp, _hwndTaskBar, 0, TASKBAR_LEFT+quicklaunch_width, 0, cx-TASKBAR_LEFT-quicklaunch_width-(notifyarea_width+1), cy, SWP_NOZORDER|SWP_NOACTIVATE); + } if (_hwndNotify) DeferWindowPos(hdwp, _hwndNotify, 0, cx-(notifyarea_width+1), 1, notifyarea_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE); - if (_hwndQuickLaunch) - DeferWindowPos(hdwp, _hwndQuickLaunch, 0, TASKBAR_LEFT, 1, quicklaunch_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE); - EndDeferWindowPos(hdwp); WindowRect rect(_hwnd); diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.h b/reactos/subsys/system/explorer/taskbar/desktopbar.h index 64222c8052f..06a8271e41a 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.h +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.h @@ -92,6 +92,7 @@ protected: WindowHandle _hwndTaskBar; WindowHandle _hwndNotify; WindowHandle _hwndQuickLaunch; + WindowHandle _hwndrebar; struct StartMenuRoot* _startMenuRoot; }; diff --git a/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp b/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp index 8c411cdbc65..89b59f276c7 100644 --- a/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp +++ b/reactos/subsys/system/explorer/taskbar/quicklaunch.cpp @@ -65,7 +65,6 @@ QuickLaunchBar::QuickLaunchBar(HWND hwnd) SetWindowStyle(hwndToolTip, GetWindowStyle(hwndToolTip)|TTS_ALWAYSTIP); - // delay refresh to some time later PostMessage(hwnd, PM_REFRESH, 0, 0); } @@ -81,7 +80,8 @@ HWND QuickLaunchBar::Create(HWND hwndParent) ClientRect clnt(hwndParent); HWND hwnd = CreateToolbarEx(hwndParent, - WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|CCS_NORESIZE| + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| + CCS_TOP|CCS_NODIVIDER|CCS_NOPARENTALIGN|CCS_NORESIZE| TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE|TBSTYLE_FLAT, IDW_QUICKLAUNCHBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON)); diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.cpp b/reactos/subsys/system/explorer/taskbar/taskbar.cpp index 9c33e7ec8c4..b3e3189947c 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/taskbar.cpp @@ -72,7 +72,8 @@ HWND TaskBar::Create(HWND hwndParent) ClientRect clnt(hwndParent); return Window::Create(WINDOW_CREATOR(TaskBar), 0, - BtnWindowClass(CLASSNAME_TASKBAR), TITLE_TASKBAR, WS_CHILD|WS_VISIBLE, + BtnWindowClass(CLASSNAME_TASKBAR), TITLE_TASKBAR, + WS_CHILD|WS_VISIBLE | CCS_TOP|CCS_NODIVIDER|CCS_NORESIZE, TASKBAR_LEFT, 0, clnt.right-TASKBAR_LEFT-(NOTIFYAREA_WIDTH_DEF+1), clnt.bottom, hwndParent); } @@ -82,8 +83,8 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs) return 1; _htoolbar = CreateToolbarEx(_hwnd, - WS_CHILD|WS_VISIBLE|CCS_NODIVIDER|CCS_TOP| - TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE, + WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| + CCS_TOP|CCS_NODIVIDER | TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE, IDW_TASKTOOLBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON)); SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(80,160));