fix imagelist loading

svn path=/trunk/; revision=8973
This commit is contained in:
Martin Fuchs 2004-04-04 23:13:11 +00:00
parent 987fbb6dc1
commit 26a52566a6
5 changed files with 12 additions and 11 deletions

View file

@ -275,7 +275,9 @@ LRESULT BackgroundWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
return TRUE; return TRUE;
case WM_MBUTTONDBLCLK: 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; break;
case PM_DISPLAY_VERSION: case PM_DISPLAY_VERSION:

View file

@ -1046,7 +1046,8 @@ void MainFrame::FillBookmarks()
TreeView_DeleteAllItems(_hsidebar); 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 #endif

View file

@ -173,7 +173,9 @@ void DesktopBar::RegisterHotkeys()
void DesktopBar::ProcessHotKey(int id_hotkey) void DesktopBar::ProcessHotKey(int id_hotkey)
{ {
switch(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 ///@todo implement all common hotkeys
} }
} }

View file

@ -254,10 +254,8 @@ void BookmarkList::write(XMLPos& pos) const
/// fill treeview control with bookmark tree content /// 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; TV_INSERTSTRUCT tvi;
tvi.hParent = parent; tvi.hParent = parent;
@ -279,7 +277,7 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent, HIMAGELIST himagelist)
tv.iSelectedImage = 4; tv.iSelectedImage = 4;
HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi); HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
folder._bookmarks.fill_tree(hwnd, hitem, himagelist); folder._bookmarks.fill_tree(hwnd, hitem, himagelist, hdc_wnd);
} else { } else {
const Bookmark& bookmark = *node._pbookmark; 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); const Icon& icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);
if ((ICON_ID)icon != ICID_NONE) 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); TreeView_InsertItem(hwnd, &tvi);
} }
} }
ReleaseDC(hwnd, hdc);
} }

View file

@ -69,7 +69,7 @@ struct BookmarkList : public list<BookmarkNode>
void read(const_XMLPos& pos); void read(const_XMLPos& pos);
void write(XMLPos& pos) const; 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 struct BookmarkFolder