From 26a52566a6339339deacbb1475a86841b6258936 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 4 Apr 2004 23:13:11 +0000 Subject: [PATCH] fix imagelist loading svn path=/trunk/; revision=8973 --- reactos/subsys/system/explorer/desktop/desktop.cpp | 4 +++- reactos/subsys/system/explorer/shell/mainframe.cpp | 3 ++- reactos/subsys/system/explorer/taskbar/desktopbar.cpp | 4 +++- reactos/subsys/system/explorer/taskbar/favorites.cpp | 10 +++------- reactos/subsys/system/explorer/taskbar/favorites.h | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/reactos/subsys/system/explorer/desktop/desktop.cpp b/reactos/subsys/system/explorer/desktop/desktop.cpp index fa7cf78c0ad..848b645188e 100644 --- a/reactos/subsys/system/explorer/desktop/desktop.cpp +++ b/reactos/subsys/system/explorer/desktop/desktop.cpp @@ -275,7 +275,9 @@ LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) return TRUE; case WM_MBUTTONDBLCLK: - explorer_show_frame(SW_SHOWNORMAL); + /* Imagelist icons are missing if MainFrame::Create() is called directly from here! + explorer_show_frame(SW_SHOWNORMAL); */ + PostMessage(g_Globals._hwndDesktop, nmsg, wparam, lparam); break; case PM_DISPLAY_VERSION: diff --git a/reactos/subsys/system/explorer/shell/mainframe.cpp b/reactos/subsys/system/explorer/shell/mainframe.cpp index 2fcf7b35a43..8147b7b6693 100644 --- a/reactos/subsys/system/explorer/shell/mainframe.cpp +++ b/reactos/subsys/system/explorer/shell/mainframe.cpp @@ -1046,7 +1046,8 @@ void MainFrame::FillBookmarks() TreeView_DeleteAllItems(_hsidebar); - g_Globals._favorites.fill_tree(_hsidebar, TVI_ROOT, _himl); + WindowCanvas canvas(_hwnd); + g_Globals._favorites.fill_tree(_hsidebar, TVI_ROOT, _himl, canvas); } #endif diff --git a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp index 59e003a25b4..c5806b90646 100644 --- a/reactos/subsys/system/explorer/taskbar/desktopbar.cpp +++ b/reactos/subsys/system/explorer/taskbar/desktopbar.cpp @@ -173,7 +173,9 @@ void DesktopBar::RegisterHotkeys() void DesktopBar::ProcessHotKey(int id_hotkey) { switch(id_hotkey) { - case 0: explorer_show_frame(SW_SHOWNORMAL); break; + case 0: explorer_show_frame(SW_SHOWNORMAL); + break; + ///@todo implement all common hotkeys } } diff --git a/reactos/subsys/system/explorer/taskbar/favorites.cpp b/reactos/subsys/system/explorer/taskbar/favorites.cpp index 71c4f207f69..7244a2b28c1 100644 --- a/reactos/subsys/system/explorer/taskbar/favorites.cpp +++ b/reactos/subsys/system/explorer/taskbar/favorites.cpp @@ -254,10 +254,8 @@ void BookmarkList::write(XMLPos& pos) const /// fill treeview control with bookmark tree content -void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist) const +void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist, HDC hdc_wnd) const { - HDC hdc = GetDC(hwnd); - TV_INSERTSTRUCT tvi; tvi.hParent = parent; @@ -279,7 +277,7 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist) tv.iSelectedImage = 4; HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi); - folder._bookmarks.fill_tree(hwnd, hitem, himagelist); + folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd); } else { const Bookmark& bookmark = *node._pbookmark; @@ -292,14 +290,12 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist) const Icon& icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx); if ((ICON_ID)icon != ICID_NONE) - tv.iImage = tv.iSelectedImage = ImageList_Add(himagelist, icon.create_bitmap(RGB(255,255,255), GetStockBrush(WHITE_BRUSH), hdc), 0); + tv.iImage = tv.iSelectedImage = ImageList_Add(himagelist, icon.create_bitmap(RGB(255,255,255), GetStockBrush(WHITE_BRUSH), hdc_wnd), 0); } TreeView_InsertItem(hwnd, &tvi); } } - - ReleaseDC(hwnd, hdc); } diff --git a/reactos/subsys/system/explorer/taskbar/favorites.h b/reactos/subsys/system/explorer/taskbar/favorites.h index f56194a0cb8..ee56af7d9a4 100644 --- a/reactos/subsys/system/explorer/taskbar/favorites.h +++ b/reactos/subsys/system/explorer/taskbar/favorites.h @@ -69,7 +69,7 @@ struct BookmarkList : public list void read(const_XMLPos& pos); void write(XMLPos& pos) const; - void fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST) const; + void fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST, HDC hdc_wnd) const; }; struct BookmarkFolder