From 1a8c4560074c87fd4e068ab6b3a768f4e8608669 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Fri, 26 Aug 2005 20:03:41 +0000 Subject: [PATCH] Make the explorer taskbar look a bit nicer. svn path=/trunk/; revision=17562 --- .../system/explorer/explorer.exe.manifest | 22 ++++++++++ reactos/subsys/system/explorer/explorer.rc | 4 ++ .../system/explorer/taskbar/desktopbar.cpp | 41 ++++++++++++------- .../system/explorer/taskbar/desktopbar.h | 4 +- .../system/explorer/taskbar/taskbar.cpp | 13 +++++- 5 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 reactos/subsys/system/explorer/explorer.exe.manifest diff --git a/reactos/subsys/system/explorer/explorer.exe.manifest b/reactos/subsys/system/explorer/explorer.exe.manifest new file mode 100644 index 00000000000..1790af0bf2d --- /dev/null +++ b/reactos/subsys/system/explorer/explorer.exe.manifest @@ -0,0 +1,22 @@ + + + +Universal picture viewer + + + + + + diff --git a/reactos/subsys/system/explorer/explorer.rc b/reactos/subsys/system/explorer/explorer.rc index 484fc4934ec..acaeab815cf 100644 --- a/reactos/subsys/system/explorer/explorer.rc +++ b/reactos/subsys/system/explorer/explorer.rc @@ -19,3 +19,7 @@ BEGIN IDS_VERSION_STR REACTOS_STR_PRODUCT_VERSION IDS_EXPLORER_VERSION_STR "ReactOS %s Explorer" END + +#define MANIFEST_RESOURCE_ID 1 + +MANIFEST_RESOURCE_ID RT_MANIFEST "explorer.exe.manifest" diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp index 582a4616c23..6bc5a9862a6 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp @@ -99,7 +99,7 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs) _taskbar_pos = start_btn_width + 6; - new PictureButton(Button(_hwnd, start_str, 2, 2, start_btn_width, DESKTOPBARBAR_HEIGHT-8, IDC_START, WS_VISIBLE|WS_CHILD|BS_OWNERDRAW), + new PictureButton(Button(_hwnd, start_str, 1, 1, start_btn_width, REBARBAND_HEIGHT, IDC_START, WS_VISIBLE|WS_CHILD|BS_OWNERDRAW), SmallIcon(IDI_STARTMENU)/*, GetStockBrush(WHITE_BRUSH)*/); // create task bar @@ -124,36 +124,33 @@ LRESULT DesktopBar::Init(LPCREATESTRUCT pcs) _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, + CCS_NODIVIDER|CCS_NOPARENTALIGN|CCS_TOP, 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; + rbBand.fMask = RBBIM_TEXT|RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE|RBBIM_ID|RBBIM_IDEALSIZE; #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; //@@ OK? + rbBand.cyChild = REBARBAND_HEIGHT; + rbBand.cyMaxChild = (ULONG)-1; + rbBand.cyMinChild = REBARBAND_HEIGHT; + rbBand.cyIntegral = REBARBAND_HEIGHT + 3; //@@ OK? + rbBand.cxMinChild = rbBand.cyIntegral * 3; + rbBand.fStyle = RBBS_VARIABLEHEIGHT|RBBS_GRIPPERALWAYS|RBBS_HIDETITLE; rbBand.lpText = TEXT("Quicklaunch"); rbBand.hwndChild = _hwndQuickLaunch; - rbBand.cxMinChild = 0; - rbBand.cyMinChild = HIWORD(SendMessage(_hwndQuickLaunch, TB_GETBUTTONSIZE, 0, 0)) + 2; rbBand.cx = 250; + rbBand.wID = IDW_QUICKLAUNCHBAR; 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_pos-quicklaunch_width-(notifyarea_width+1); + rbBand.wID = IDW_TASKTOOLBAR; SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand); #endif @@ -274,6 +271,20 @@ LRESULT DesktopBar::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) return 0; } +int DesktopBar::Notify(int id, NMHDR* pnmh) +{ + if (pnmh->code == RBN_CHILDSIZE) { + /* align the task bands to the top, so it's in row with the Start button */ + NMREBARCHILDSIZE *childSize = (NMREBARCHILDSIZE*)pnmh; + if (childSize->wID == IDW_TASKTOOLBAR) { + int cy = childSize->rcChild.top - childSize->rcBand.top; + childSize->rcChild.bottom -= cy; + childSize->rcChild.top -= cy; + } + } + + return 0; +} void DesktopBar::Resize(int cx, int cy) { @@ -284,7 +295,7 @@ void DesktopBar::Resize(int cx, int cy) HDWP hdwp = BeginDeferWindowPos(3); if (_hwndrebar) - DeferWindowPos(hdwp, _hwndrebar, 0, _taskbar_pos, 0, cx-_taskbar_pos-(notifyarea_width+1), cy, SWP_NOZORDER|SWP_NOACTIVATE); + DeferWindowPos(hdwp, _hwndrebar, 0, _taskbar_pos, 1, cx-_taskbar_pos-(notifyarea_width+1), cy-2, SWP_NOZORDER|SWP_NOACTIVATE); else { if (_hwndQuickLaunch) DeferWindowPos(hdwp, _hwndQuickLaunch, 0, _taskbar_pos, 1, quicklaunch_width, cy-2, SWP_NOZORDER|SWP_NOACTIVATE); diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.h b/reactos/subsys/system/explorer/taskbar/desktopbar.h index 5c187c7056b..d2cd1b158e5 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.h +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.h @@ -30,7 +30,8 @@ #define TITLE_EXPLORERBAR TEXT("") // use an empty window title, so windows taskmanager does not show the window in its application list -#define DESKTOPBARBAR_HEIGHT 29 +#define DESKTOPBARBAR_HEIGHT (GetSystemMetrics(SM_CYSIZE) + 5 * GetSystemMetrics(SM_CYEDGE)) +#define REBARBAND_HEIGHT (GetSystemMetrics(SM_CYSIZE) + 2 * GetSystemMetrics(SM_CYEDGE)) #define IDC_START 0x1000 @@ -89,6 +90,7 @@ protected: LRESULT Init(LPCREATESTRUCT pcs); LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam); + int Notify(int id, NMHDR* pnmh); int Command(int id, int code); void Resize(int cx, int cy); diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.cpp b/reactos/subsys/system/explorer/taskbar/taskbar.cpp index 4d608709945..fe8da761075 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/taskbar.cpp @@ -118,12 +118,15 @@ HWND TaskBar::Create(HWND hwndParent) LRESULT TaskBar::Init(LPCREATESTRUCT pcs) { + TBMETRICS metrics; + if (super::Init(pcs)) return 1; + /* FIXME: There's an internal padding for non-flat toolbar. Get rid of it somehow. */ _htoolbar = CreateToolbarEx(_hwnd, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN| - CCS_TOP|CCS_NODIVIDER | TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE,//|TBSTYLE_AUTOSIZE + CCS_TOP|CCS_NODIVIDER|TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE,//|TBSTYLE_AUTOSIZE IDW_TASKTOOLBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON)); SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(TASKBUTTONWIDTH_MAX,TASKBUTTONWIDTH_MAX)); @@ -132,6 +135,14 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs) //SetWindowFont(_htoolbar, GetStockFont(ANSI_VAR_FONT), FALSE); //SendMessage(_htoolbar, TB_SETPADDING, 0, MAKELPARAM(8,8)); + metrics.cbSize = sizeof(TBMETRICS); + metrics.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING; + metrics.cxBarPad = 0; + metrics.cyBarPad = 0; + metrics.cxButtonSpacing = 3; + metrics.cyButtonSpacing = 3; + SendMessage(_htoolbar, TB_SETMETRICS, 0, (LPARAM)&metrics); + _next_id = IDC_FIRST_APP; // register the taskbar window as task manager window to make the following call to RegisterShellHookWindow working