From 10f0f6628e95080b0deec5f80dc60ae4d16c823c Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Wed, 20 Aug 2003 09:08:00 +0000 Subject: [PATCH] draw startmenu subfolder arrows svn path=/trunk/; revision=5696 --- reactos/subsys/system/explorer/explorer.cpp | 4 +- reactos/subsys/system/explorer/explorer.dsp | 4 ++ .../subsys/system/explorer/explorer_intres.h | 3 +- .../subsys/system/explorer/explorer_intres.rc | 1 + reactos/subsys/system/explorer/globals.h | 8 +-- reactos/subsys/system/explorer/res/arrow.ico | Bin 0 -> 318 bytes .../subsys/system/explorer/shell/entries.cpp | 8 +-- .../subsys/system/explorer/shell/entries.h | 2 +- reactos/subsys/system/explorer/shell/pane.cpp | 4 +- .../subsys/system/explorer/shell/shellfs.cpp | 14 ++-- .../system/explorer/taskbar/startmenu.cpp | 61 ++++++++++-------- .../system/explorer/taskbar/startmenu.h | 15 +++-- .../system/explorer/taskbar/taskbar.cpp | 38 +++++------ .../subsys/system/explorer/taskbar/taskbar.h | 5 -- .../subsys/system/explorer/utility/window.cpp | 13 +++- .../subsys/system/explorer/utility/window.h | 13 ++-- 16 files changed, 107 insertions(+), 86 deletions(-) create mode 100644 reactos/subsys/system/explorer/res/arrow.ico diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index ee83c059fa1..d2f04ff3649 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -63,12 +63,12 @@ ResString::ResString(UINT nid) ResIcon::ResIcon(UINT nid) { - _hicon = LoadIcon(g_Globals._hInstance, MAKEINTRESOURCE(nid)); + _hIcon = LoadIcon(g_Globals._hInstance, MAKEINTRESOURCE(nid)); } SmallIcon::SmallIcon(UINT nid) { - _hicon = (HICON)LoadImage(g_Globals._hInstance, MAKEINTRESOURCE(nid), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); + _hIcon = (HICON)LoadImage(g_Globals._hInstance, MAKEINTRESOURCE(nid), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); } diff --git a/reactos/subsys/system/explorer/explorer.dsp b/reactos/subsys/system/explorer/explorer.dsp index d9a2fab9a3e..dc1aa173531 100644 --- a/reactos/subsys/system/explorer/explorer.dsp +++ b/reactos/subsys/system/explorer/explorer.dsp @@ -509,6 +509,10 @@ SOURCE=.\shell\winfs.h # End Group # Begin Source File +SOURCE=.\res\arrow.ico +# End Source File +# Begin Source File + SOURCE=.\explorer.cpp # End Source File # Begin Source File diff --git a/reactos/subsys/system/explorer/explorer_intres.h b/reactos/subsys/system/explorer/explorer_intres.h index fd14610c199..30f2595af48 100644 --- a/reactos/subsys/system/explorer/explorer_intres.h +++ b/reactos/subsys/system/explorer/explorer_intres.h @@ -31,6 +31,7 @@ #define ID_EXECUTE 111 #define IDM_WINEFILE 112 #define IDI_LOGOFF 124 +#define IDI_FOLDERARROW 125 #define ID_VIEW_NAME 401 #define ID_VIEW_ALL_ATTRIBUTES 402 #define ID_VIEW_SELECTED_ATTRIBUTES 403 @@ -62,7 +63,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 126 +#define _APS_NEXT_RESOURCE_VALUE 127 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/reactos/subsys/system/explorer/explorer_intres.rc b/reactos/subsys/system/explorer/explorer_intres.rc index 1b88b21fdb2..88df83ab679 100644 --- a/reactos/subsys/system/explorer/explorer_intres.rc +++ b/reactos/subsys/system/explorer/explorer_intres.rc @@ -94,6 +94,7 @@ IDI_REACTOS ICON DISCARDABLE "res/reactos.ico" IDI_EXPLORER ICON DISCARDABLE "res/explorer.ico" IDI_STARTMENU ICON DISCARDABLE "res/startmenu.ico" IDI_LOGOFF ICON DISCARDABLE "res/logoff.ico" +IDI_FOLDERARROW ICON DISCARDABLE "res/arrow.ico" ///////////////////////////////////////////////////////////////////////////// // diff --git a/reactos/subsys/system/explorer/globals.h b/reactos/subsys/system/explorer/globals.h index baea6fab1d2..47217f6ae1d 100644 --- a/reactos/subsys/system/explorer/globals.h +++ b/reactos/subsys/system/explorer/globals.h @@ -48,18 +48,18 @@ struct ResIcon { ResIcon(UINT nid); - operator HICON() const {return _hicon;} + operator HICON() const {return _hIcon;} protected: - HICON _hicon; + HICON _hIcon; }; struct SmallIcon { SmallIcon(UINT nid); - operator HICON() const {return _hicon;} + operator HICON() const {return _hIcon;} protected: - HICON _hicon; + HICON _hIcon; }; diff --git a/reactos/subsys/system/explorer/res/arrow.ico b/reactos/subsys/system/explorer/res/arrow.ico new file mode 100644 index 0000000000000000000000000000000000000000..1e8018b95ae0db2c29fe10b95ef5196da7d4879f GIT binary patch literal 318 zcmc(ZyA6Oa3`8#y1Eiv+WXwnul#IYAcr)`Zp+Ta@_Pg_^u~f)fs~l^QW;=MZK+%Ls r(e+E3M5(o5D6Jv__aS>J(;bjrS$>Z3hkttP?QzfE`<`!Zf1xrL literal 0 HcmV?d00001 diff --git a/reactos/subsys/system/explorer/shell/entries.cpp b/reactos/subsys/system/explorer/shell/entries.cpp index 565c1a5d605..fcaae68c2a6 100644 --- a/reactos/subsys/system/explorer/shell/entries.cpp +++ b/reactos/subsys/system/explorer/shell/entries.cpp @@ -44,7 +44,7 @@ Entry::Entry(ENTRY_TYPE etype) _scanned = false; _bhfi_valid = false; _level = 0; - _hicon = 0; + _hIcon = 0; } Entry::Entry(Entry* parent) @@ -57,14 +57,14 @@ Entry::Entry(Entry* parent) _scanned = false; _bhfi_valid = false; _level = 0; - _hicon = 0; + _hIcon = 0; } // free a directory entry Entry::~Entry() { - if (_hicon && _hicon!=(HICON)-1) - DestroyIcon(_hicon); + if (_hIcon && _hIcon!=(HICON)-1) + DestroyIcon(_hIcon); } diff --git a/reactos/subsys/system/explorer/shell/entries.h b/reactos/subsys/system/explorer/shell/entries.h index 97a67a09c96..011b661b0a0 100644 --- a/reactos/subsys/system/explorer/shell/entries.h +++ b/reactos/subsys/system/explorer/shell/entries.h @@ -63,7 +63,7 @@ public: SFGAOF _shell_attribs; ENTRY_TYPE _etype; - HICON _hicon; + HICON _hIcon; BY_HANDLE_FILE_INFORMATION _bhfi; bool _bhfi_valid; diff --git a/reactos/subsys/system/explorer/shell/pane.cpp b/reactos/subsys/system/explorer/shell/pane.cpp index 3e2a98b4f85..b5e77e9ee49 100644 --- a/reactos/subsys/system/explorer/shell/pane.cpp +++ b/reactos/subsys/system/explorer/shell/pane.cpp @@ -472,8 +472,8 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol) if (cx > IMAGE_WIDTH) cx = IMAGE_WIDTH; - if (entry->_hicon && entry->_hicon!=(HICON)-1) - DrawIconEx(dis->hDC, img_pos, dis->rcItem.top, entry->_hicon, cx, GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); + if (entry->_hIcon && entry->_hIcon!=(HICON)-1) + DrawIconEx(dis->hDC, img_pos, dis->rcItem.top, entry->_hIcon, cx, GetSystemMetrics(SM_CYSMICON), 0, 0, DI_NORMAL); else ImageList_DrawEx(_himl, img, dis->hDC, img_pos, dis->rcItem.top, cx, diff --git a/reactos/subsys/system/explorer/shell/shellfs.cpp b/reactos/subsys/system/explorer/shell/shellfs.cpp index dd5f5eaa22e..a2263deb16b 100644 --- a/reactos/subsys/system/explorer/shell/shellfs.cpp +++ b/reactos/subsys/system/explorer/shell/shellfs.cpp @@ -175,7 +175,7 @@ static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl) if (SUCCEEDED(folder->GetUIObjectOf(0, 1, (LPCITEMIDLIST*)&pidl, IID_IExtractIcon, 0, (LPVOID*)&pExtract))) { TCHAR path[_MAX_PATH]; unsigned flags; - HICON hicon; + HICON hIcon; int idx; if (SUCCEEDED(pExtract->GetIconLocation(GIL_FORSHELL, path, _MAX_PATH, &idx, &flags))) { @@ -183,18 +183,18 @@ static HICON extract_icon(IShellFolder* folder, LPCITEMIDLIST pidl) if (idx == -1) idx = 0; // special case for some control panel applications - if ((int)ExtractIconEx(path, idx, 0, &hicon, 1) > 0) + if ((int)ExtractIconEx(path, idx, 0, &hIcon, 1) > 0) flags &= ~GIL_DONTCACHE; } else { HICON hIconLarge = 0; - HRESULT hr = pExtract->Extract(path, idx, &hIconLarge, &hicon, MAKELONG(0/*GetSystemMetrics(SM_CXICON)*/,GetSystemMetrics(SM_CXSMICON))); + HRESULT hr = pExtract->Extract(path, idx, &hIconLarge, &hIcon, MAKELONG(0/*GetSystemMetrics(SM_CXICON)*/,GetSystemMetrics(SM_CXSMICON))); if (SUCCEEDED(hr)) DestroyIcon(hIconLarge); } - return hicon; + return hIcon; } } @@ -275,10 +275,10 @@ void ShellDirectory::read_directory() // get display icons for files and virtual objects if (!(entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !(attribs & SFGAO_FILESYSTEM)) { - entry->_hicon = extract_icon(_folder, pidls[n]); + entry->_hIcon = extract_icon(_folder, pidls[n]); - if (!entry->_hicon) - entry->_hicon = (HICON)-1; // don't try again later + if (!entry->_hIcon) + entry->_hIcon = (HICON)-1; // don't try again later } entry->_down = NULL; diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.cpp b/reactos/subsys/system/explorer/taskbar/startmenu.cpp index ca2643cbd41..b304497aab7 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.cpp +++ b/reactos/subsys/system/explorer/taskbar/startmenu.cpp @@ -84,10 +84,19 @@ LRESULT StartMenu::Init(LPCREATESTRUCT pcs) if (super::Init(pcs)) return 1; - for(ShellEntryMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) { - const StartMenuEntry& sme = it->second; + // create buttons for registered entries in _entries + if (_entries.empty()) { + AddButton(ResString(IDS_EMPTY), 0, false, (UINT)-1, WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW|WS_DISABLED); + } else { + for(ShellEntryMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) { + const StartMenuEntry& sme = it->second; + bool showArrow = false; - AddButton(sme._title, sme._hIcon, it->first); + if (sme._entry && (sme._entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) + showArrow = true; + + AddButton(sme._title, sme._hIcon, showArrow, it->first); + } } return 0; @@ -194,7 +203,7 @@ StartMenuEntry& StartMenu::AddEntry(LPCTSTR title, HICON hIcon, UINT id) StartMenuEntry& StartMenu::AddEntry(const ShellFolder folder, const ShellEntry* entry) { - HICON hIcon = entry->_hicon; + HICON hIcon = entry->_hIcon; if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) hIcon = SmallIcon(IDI_EXPLORER); @@ -209,7 +218,7 @@ StartMenuEntry& StartMenu::AddEntry(const ShellFolder folder, const ShellEntry* } -void StartMenu::AddButton(LPCTSTR title, HICON hIcon, UINT id) +void StartMenu::AddButton(LPCTSTR title, HICON hIcon, bool showArrow, UINT id, DWORD style) { WindowRect rect(_hwnd); @@ -222,7 +231,7 @@ void StartMenu::AddButton(LPCTSTR title, HICON hIcon, UINT id) MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE); - StartMenuButton(_hwnd, rect.bottom-rect.top-STARTMENU_LINE_HEIGHT-4, title, id, hIcon); + StartMenuButton(_hwnd, rect.bottom-rect.top-STARTMENU_LINE_HEIGHT-4, title, id, hIcon, showArrow, style); } void StartMenu::AddSeparator() @@ -250,13 +259,13 @@ void StartMenu::CreateSubmenu(int id, const StartMenuFolders& new_folders, CREAT if (btn) { WindowRect pos(btn); - x = pos.right; - y = pos.top+STARTMENU_HEIGHT-4; + x = pos.right-8; // Submenus should overlap their parent a bit. + y = pos.top; } else { WindowRect pos(_hwnd); - x = pos.right; - y = pos.top+STARTMENU_HEIGHT-4; + x = pos.right-8; + y = pos.top; } StartMenu::Create(x, y, new_folders, _hwnd, creator); @@ -283,12 +292,10 @@ void StartMenu::CreateSubmenu(int id, int folder_id1, int folder_id2, CREATORFUN if (folder1) new_folders.push_back(folder1); - if (folder_id2 != -1) { - SpecialFolder folder2(folder_id2, _hwnd); + SpecialFolder folder2(folder_id2, _hwnd); - if (folder2) - new_folders.push_back(folder2); - } + if (folder2) + new_folders.push_back(folder2); CreateSubmenu(id, new_folders, creator); } @@ -335,21 +342,21 @@ LRESULT StartMenuRoot::Init(LPCREATESTRUCT pcs) AddSeparator(); // insert hard coded start entries - AddButton(ResString(IDS_PROGRAMS), 0, IDC_PROGRAMS); - AddButton(ResString(IDS_EXPLORE), SmallIcon(IDI_EXPLORER), IDC_EXPLORE); - AddButton(ResString(IDS_FAVORITES), 0, IDC_FAVORITES); - AddButton(ResString(IDS_DOCUMENTS), 0, IDC_DOCUMENTS); - AddButton(ResString(IDS_RECENT), 0, IDC_RECENT); - AddButton(ResString(IDS_SETTINGS), 0, IDC_SETTINGS); - AddButton(ResString(IDS_ADMIN), 0, IDC_ADMIN); - AddButton(ResString(IDS_SEARCH), 0, IDC_SEARCH); - AddButton(ResString(IDS_START_HELP),0, IDC_START_HELP); - AddButton(ResString(IDS_LAUNCH), 0, IDC_LAUNCH); + AddButton(ResString(IDS_PROGRAMS), 0, true, IDC_PROGRAMS); + AddButton(ResString(IDS_EXPLORE), SmallIcon(IDI_EXPLORER), false, IDC_EXPLORE); + AddButton(ResString(IDS_FAVORITES), 0, true, IDC_FAVORITES); + AddButton(ResString(IDS_DOCUMENTS), 0, true, IDC_DOCUMENTS); + AddButton(ResString(IDS_RECENT), 0, true, IDC_RECENT); + AddButton(ResString(IDS_SETTINGS), 0, true, IDC_SETTINGS); + AddButton(ResString(IDS_ADMIN), 0, true, IDC_ADMIN); + AddButton(ResString(IDS_SEARCH), 0, false, IDC_SEARCH); + AddButton(ResString(IDS_START_HELP),0, false, IDC_START_HELP); + AddButton(ResString(IDS_LAUNCH), 0, false, IDC_LAUNCH); AddSeparator(); - AddButton(ResString(IDS_SHUTDOWN), SmallIcon(IDI_LOGOFF), IDC_SHUTDOWN); - AddButton(ResString(IDS_LOGOFF), SmallIcon(IDI_LOGOFF), IDC_LOGOFF); + AddButton(ResString(IDS_SHUTDOWN), SmallIcon(IDI_LOGOFF), false, IDC_SHUTDOWN); + AddButton(ResString(IDS_LOGOFF), SmallIcon(IDI_LOGOFF), false, IDC_LOGOFF); return 0; } diff --git a/reactos/subsys/system/explorer/taskbar/startmenu.h b/reactos/subsys/system/explorer/taskbar/startmenu.h index 65ddd2b8dad..200acc508c4 100644 --- a/reactos/subsys/system/explorer/taskbar/startmenu.h +++ b/reactos/subsys/system/explorer/taskbar/startmenu.h @@ -33,14 +33,19 @@ #define TITLE_STARTMENU _T("Start Menu") +#define STARTMENU_WIDTH 150 +#define STARTMENU_LINE_HEIGHT 22 +#define STARTMENU_SEP_HEIGHT (STARTMENU_LINE_HEIGHT/2) + + // Startmenu button struct StartMenuButton : public Button { StartMenuButton(HWND parent, int y, LPCTSTR title, - UINT id, HICON hIcon=0, DWORD style=WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW, DWORD exStyle=0) - : Button(parent, title, 2, y, STARTMENU_WIDTH-4, STARTMENU_LINE_HEIGHT, id, style, exStyle) + UINT id, HICON hIcon=0, bool showArrow=false, DWORD style=WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW, DWORD exStyle=0) + : Button(parent, title, 0, y, ClientRect(parent).right, STARTMENU_LINE_HEIGHT, id, style, exStyle) { - *new StartmenuEntry(_hwnd, hIcon); + *new StartmenuEntry(_hwnd, hIcon, showArrow); SetWindowFont(_hwnd, GetStockFont(DEFAULT_GUI_FONT), FALSE); } @@ -50,7 +55,7 @@ struct StartMenuButton : public Button struct StartMenuSeparator : public Static { StartMenuSeparator(HWND parent, int y, DWORD style=WS_VISIBLE|WS_CHILD|SS_ETCHEDHORZ, DWORD exStyle=0) - : Static(parent, NULL, 2, y+STARTMENU_SEP_HEIGHT/2-1, STARTMENU_WIDTH-4, 2, -1, style, exStyle) + : Static(parent, NULL, 0, y+STARTMENU_SEP_HEIGHT/2-1, ClientRect(parent).right, 2, -1, style, exStyle) { } }; @@ -114,7 +119,7 @@ protected: void AddShellEntries(const ShellDirectory& dir, int max=-1, bool subfolders=true); - void AddButton(LPCTSTR title, HICON hIcon=0, UINT id=(UINT)-1); + void AddButton(LPCTSTR title, HICON hIcon=0, bool showArrow=false, UINT id=(UINT)-1, DWORD style=WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON|BS_OWNERDRAW); void AddSeparator(); void CreateSubmenu(int id, const StartMenuFolders& new_folders, CREATORFUNC creator=s_def_creator); diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.cpp b/reactos/subsys/system/explorer/taskbar/taskbar.cpp index bbf5138bf52..cb83d1d9c48 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/taskbar.cpp @@ -164,32 +164,32 @@ int DesktopBar::Command(int id, int code) static HICON get_window_icon(HWND hwnd) { - HICON hicon = 0; + HICON hIcon = 0; - SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hicon); + SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL2, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon); - if (!hicon) - SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hicon); + if (!hIcon) + SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon); - if (!hicon) - SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hicon); + if (!hIcon) + SendMessageTimeout(hwnd, WM_GETICON, ICON_BIG, 0, SMTO_ABORTIFHUNG, 1000, (LPDWORD)&hIcon); - if (!hicon) - hicon = (HICON)GetClassLong(hwnd, GCL_HICONSM); + if (!hIcon) + hIcon = (HICON)GetClassLong(hwnd, GCL_HICONSM); - if (!hicon) - hicon = (HICON)GetClassLong(hwnd, GCL_HICON); + if (!hIcon) + hIcon = (HICON)GetClassLong(hwnd, GCL_HICON); - if (!hicon) - SendMessageTimeout(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&hicon); + if (!hIcon) + SendMessageTimeout(hwnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (LPDWORD)&hIcon); - if (!hicon) - hicon = LoadIcon(0, IDI_APPLICATION); + if (!hIcon) + hIcon = LoadIcon(0, IDI_APPLICATION); - return hicon; + return hIcon; } -static HBITMAP create_bitmap_from_icon(HICON hicon, HWND hwnd, HBRUSH hbrush_bkgnd) +static HBITMAP create_bitmap_from_icon(HICON hIcon, HWND hwnd, HBRUSH hbrush_bkgnd) { HDC hdc_wnd = GetDC(hwnd); HBITMAP hbmp = CreateCompatibleBitmap(hdc_wnd, 16, 16); @@ -197,7 +197,7 @@ static HBITMAP create_bitmap_from_icon(HICON hicon, HWND hwnd, HBRUSH hbrush_bkg HDC hdc = CreateCompatibleDC(0); HBITMAP hbmp_org = SelectBitmap(hdc, hbmp); - DrawIconEx(hdc, 0, 0, hicon, 16, 16, 0, hbrush_bkgnd, DI_IMAGE); + DrawIconEx(hdc, 0, 0, hIcon, 16, 16, 0, hbrush_bkgnd, DI_IMAGE); SelectBitmap(hdc, hbmp_org); DeleteDC(hdc); @@ -352,8 +352,8 @@ BOOL CALLBACK TaskBar::EnumWndProc(HWND hwnd, LPARAM lparam) if (!last_id) found->second._id = pThis->_next_id++; } else { - HICON hicon = get_window_icon(hwnd); - HBITMAP hbmp = create_bitmap_from_icon(hicon, pThis->_htoolbar, GetSysColorBrush(COLOR_BTNFACE)); + HICON hIcon = get_window_icon(hwnd); + HBITMAP hbmp = create_bitmap_from_icon(hIcon, pThis->_htoolbar, GetSysColorBrush(COLOR_BTNFACE)); TBADDBITMAP ab = {0, (UINT_PTR)hbmp}; int bmp_idx = SendMessage(pThis->_htoolbar, TB_ADDBITMAP, 1, (LPARAM)&ab); diff --git a/reactos/subsys/system/explorer/taskbar/taskbar.h b/reactos/subsys/system/explorer/taskbar/taskbar.h index 20756b13a05..406a9914816 100644 --- a/reactos/subsys/system/explorer/taskbar/taskbar.h +++ b/reactos/subsys/system/explorer/taskbar/taskbar.h @@ -34,11 +34,6 @@ #define TASKBAR_LEFT 70 //#define TASKBAR_AT_TOP -#define STARTMENU_WIDTH 150 -#define STARTMENU_HEIGHT 4 -#define STARTMENU_LINE_HEIGHT 22 -#define STARTMENU_SEP_HEIGHT (STARTMENU_LINE_HEIGHT/2) - #define WM_SHELLHOOK_NOTIFY (WM_APP+0x10) diff --git a/reactos/subsys/system/explorer/utility/window.cpp b/reactos/subsys/system/explorer/utility/window.cpp index 02365e0f614..bca3dd4ba43 100644 --- a/reactos/subsys/system/explorer/utility/window.cpp +++ b/reactos/subsys/system/explorer/utility/window.cpp @@ -31,6 +31,7 @@ #include "window.h" #include "../globals.h" +#include "../explorer_intres.h" WindowClass::WindowClass(LPCTSTR classname, UINT style_, WNDPROC wndproc) @@ -593,7 +594,7 @@ void PictureButton::DrawItem(LPDRAWITEMSTRUCT dis) } else DrawFrameControl(dis->hDC, &dis->rcItem, DFC_BUTTON, style); - DrawIconEx(dis->hDC, iconPos.x, iconPos.y, _hicon, 16, 16, 0, GetSysColorBrush(COLOR_BTNFACE), DI_NORMAL); + DrawIconEx(dis->hDC, iconPos.x, iconPos.y, _hIcon, 16, 16, 0, GetSysColorBrush(COLOR_BTNFACE), DI_NORMAL); TCHAR text[BUFFER_LEN]; GetWindowText(_hwnd, text, BUFFER_LEN); @@ -648,13 +649,19 @@ void StartmenuEntry::DrawItem(LPDRAWITEMSTRUCT dis) HBRUSH bk_brush = GetSysColorBrush(bk_color); FillRect(dis->hDC, &dis->rcItem, bk_brush); - DrawIconEx(dis->hDC, iconPos.x, iconPos.y, _hicon, 16, 16, 0, bk_brush, DI_NORMAL); + DrawIconEx(dis->hDC, iconPos.x, iconPos.y, _hIcon, 16, 16, 0, bk_brush, DI_NORMAL); + + // draw submenu arrow at the right + if (_showArrow) { + SmallIcon arrowIcon(IDI_FOLDERARROW); + DrawIconEx(dis->hDC, dis->rcItem.right-16, iconPos.y, arrowIcon, 16, 16, 0, bk_brush, DI_NORMAL); + } TCHAR text[BUFFER_LEN]; GetWindowText(_hwnd, text, BUFFER_LEN); if (dis->itemState & (ODS_DISABLED|ODS_GRAYED)) - DrawGrayText(dis, &textRect, text, DT_SINGLELINE|DT_VCENTER|DT_CENTER); + DrawGrayText(dis, &textRect, text, DT_SINGLELINE|DT_VCENTER); else { BkMode mode(dis->hDC, TRANSPARENT); TextColor lcColor(dis->hDC, GetSysColor(text_color)); diff --git a/reactos/subsys/system/explorer/utility/window.h b/reactos/subsys/system/explorer/utility/window.h index b1ffdf4487b..65d1fff2e32 100644 --- a/reactos/subsys/system/explorer/utility/window.h +++ b/reactos/subsys/system/explorer/utility/window.h @@ -434,13 +434,13 @@ struct PictureButton : public OwnerdrawnButton { typedef OwnerdrawnButton super; - PictureButton(HWND hwnd, HICON hicon, bool flat=false) - : super(hwnd), _hicon(hicon), _flat(flat) {} + PictureButton(HWND hwnd, HICON hIcon, bool flat=false) + : super(hwnd), _hIcon(hIcon), _flat(flat) {} protected: virtual void DrawItem(LPDRAWITEMSTRUCT dis); - HICON _hicon; + HICON _hIcon; bool _flat; }; @@ -452,11 +452,12 @@ struct StartmenuEntry : public OwnerdrawnButton { typedef OwnerdrawnButton super; - StartmenuEntry(HWND hwnd, HICON hicon) - : super(hwnd), _hicon(hicon) {} + StartmenuEntry(HWND hwnd, HICON hIcon, bool showArrow) + : super(hwnd), _hIcon(hIcon), _showArrow(showArrow) {} protected: virtual void DrawItem(LPDRAWITEMSTRUCT dis); - HICON _hicon; + HICON _hIcon; + bool _showArrow; };