Make the explorer taskbar look a bit nicer.
authorFilip Navara <filip.navara@gmail.com>
Fri, 26 Aug 2005 20:03:41 +0000 (20:03 +0000)
committerFilip Navara <filip.navara@gmail.com>
Fri, 26 Aug 2005 20:03:41 +0000 (20:03 +0000)
svn path=/trunk/; revision=17562

reactos/subsys/system/explorer/explorer.exe.manifest [new file with mode: 0644]
reactos/subsys/system/explorer/explorer.rc
reactos/subsys/system/explorer/taskbar/desktopbar.cpp
reactos/subsys/system/explorer/taskbar/desktopbar.h
reactos/subsys/system/explorer/taskbar/taskbar.cpp

diff --git a/reactos/subsys/system/explorer/explorer.exe.manifest b/reactos/subsys/system/explorer/explorer.exe.manifest
new file mode 100644 (file)
index 0000000..1790af0
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">\r
+<assemblyIdentity\r
+    version="1.0.0.0"\r
+    processorArchitecture="X86"\r
+    name="IrfanView"\r
+    type="win32"\r
+/>\r
+<description>Universal picture viewer</description>\r
+<dependency>\r
+    <dependentAssembly>\r
+        <assemblyIdentity\r
+            type="win32"\r
+            name="Microsoft.Windows.Common-Controls"\r
+            version="6.0.0.0"\r
+            processorArchitecture="X86"\r
+            publicKeyToken="6595b64144ccf1df"\r
+            language="*"\r
+        />\r
+    </dependentAssembly>\r
+</dependency>\r
+</assembly>\r
index 484fc49..acaeab8 100644 (file)
@@ -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"
index 582a461..6bc5a98 100644 (file)
@@ -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);
index 5c187c7..d2cd1b1 100644 (file)
@@ -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);
index 4d60870..fe8da76 100644 (file)
@@ -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