icons and tooltips for bookmarks

svn path=/trunk/; revision=8968
This commit is contained in:
Martin Fuchs 2004-04-04 19:12:55 +00:00
parent fad7ce3fb4
commit 199ffcb9bc
7 changed files with 47 additions and 9 deletions

View file

@ -68,3 +68,10 @@ If you search for more information, look into the CVS repository.
25.02.2004 m. fuchs rebar control for desktop bar
28.02.2004 m. fuchs "minimize all" functionality
various fixes for notification icons, task bar and desktop switching
12.03.2004 m. fuchs automatic adjustment start button to text size
15.03.2004 m. fuchs implementation of volume control tray icon
20.03.2004 m. fuchs context menu for notification area
21.03.2004 m. fuchs configuration dialog for notification icons
XML storage for configuration options
28.03.2004 m. fuchs configuration options for showing/hiding clock, ...
04.04.2004 m. fuchs import of IE bookmarks; explorer sidebar with bookmark display

View file

@ -277,9 +277,12 @@ MainFrame::MainFrame(HWND hwnd)
CheckMenuItem(_menu_info._hMenuView, ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED);
_hsidebar = CreateWindowEx(WS_EX_STATICEDGE, WC_TREEVIEW, TEXT("Sidebar"),
WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_NOTOOLTIPS|TVS_SHOWSELALWAYS,
WS_CHILD|WS_TABSTOP|WS_BORDER|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS|TVS_INFOTIP,
-1, -1, 200, 0, _hwnd, (HMENU)IDW_SIDEBAR, g_Globals._hInstance, 0);
_himl = ImageList_LoadBitmap(g_Globals._hInstance, MAKEINTRESOURCE(IDB_IMAGES), 16, 0, RGB(0,255,0));
TreeView_SetImageList(_hsidebar, _himl, TVSIL_NORMAL);
CheckMenuItem(_menu_info._hMenuView, ID_VIEW_SIDE_BAR, MF_BYCOMMAND|MF_CHECKED);
FillBookmarks();
@ -288,6 +291,8 @@ MainFrame::MainFrame(HWND hwnd)
MainFrame::~MainFrame()
{
ImageList_Destroy(_himl);
// don't exit desktop when closing file manager window
if (!g_Globals._desktop_mode)
PostQuitMessage(0);
@ -757,8 +762,25 @@ int MainFrame::Command(int id, int code)
int MainFrame::Notify(int id, NMHDR* pnmh)
{
if (pnmh->code == RBN_AUTOSIZE)
switch(pnmh->code) {
case RBN_AUTOSIZE:
resize_frame_rect(ClientRect(_hwnd));
break;
case TVN_GETINFOTIP: {
NMTVGETINFOTIP* pnmgit = (NMTVGETINFOTIP*)pnmh;
const BookmarkNode& node = *(BookmarkNode*)pnmgit->lParam;
if (node._type == BookmarkNode::BMNT_FOLDER) {
if (!node._pfolder->_description.empty())
lstrcpyn(pnmgit->pszText, node._pfolder->_description.c_str(), pnmgit->cchTextMax);
} else // BookmarkNode::BMNT_BOOKMARK
if (!node._pbookmark->_description.empty())
lstrcpyn(pnmgit->pszText, node._pbookmark->_description.c_str(), pnmgit->cchTextMax);
else
lstrcpyn(pnmgit->pszText, node._pbookmark->_url.c_str(), pnmgit->cchTextMax);
break;}
}
return 0;
}
@ -766,6 +788,9 @@ int MainFrame::Notify(int id, NMHDR* pnmh)
void MainFrame::resize_frame_rect(PRECT prect)
{
if (prect->bottom <= prect->top)
return; // avoid resizing children when receiving RBN_AUTOSIZE while getting minimized
if (_hwndrebar) {
int height = ClientRect(_hwndrebar).bottom;
MoveWindow(_hwndrebar, prect->left, prect->top, prect->right-prect->left, height, TRUE);

View file

@ -62,6 +62,8 @@ protected:
WindowHandle _hcommandedit;
WindowHandle _hsidebar;
HIMAGELIST _himl;
HMENU _hMenuFrame;
HMENU _hMenuWindow;

View file

@ -96,7 +96,7 @@ LRESULT ShellBrowserChild::Init(LPCREATESTRUCT pcs)
// create explorer treeview
if (_create_info._open_mode & OWM_EXPLORE)
_left_hwnd = CreateWindowEx(0, WC_TREEVIEW, NULL,
WS_CHILD|WS_TABSTOP|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_NOTOOLTIPS|TVS_SHOWSELALWAYS,
WS_CHILD|WS_TABSTOP|WS_VISIBLE|WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS,//|TVS_NOTOOLTIPS
0, rect.top, _split_pos-SPLIT_WIDTH/2, rect.bottom-rect.top,
_hwnd, (HMENU)IDC_FILETREE, g_Globals._hInstance, 0);

View file

@ -159,7 +159,7 @@ void BookmarkList::write(XMLPos& pos) const
folder._bookmarks.write(pos);
pos.back();
} else { // node._type == BookmarkNode::BMNT_BOOKMARK
} else { // BookmarkNode::BMNT_BOOKMARK
Bookmark& bookmark = *node._pbookmark;
if (!bookmark._url.empty()) {
@ -186,16 +186,19 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent) const
tvi.hInsertAfter = TVI_LAST;
TV_ITEM& tv = tvi.item;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tv.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
for(const_iterator it=begin(); it!=end(); ++it) {
const BookmarkNode& node = *it;
tv.lParam = (LPARAM)&node;
if (node._type == BookmarkNode::BMNT_FOLDER) {
const BookmarkFolder& folder = *node._pfolder;
tv.pszText = (LPTSTR)folder._name.c_str();
tv.iSelectedImage = tv.iImage = 0;
tv.iImage = 3;
tv.iSelectedImage = 4;
HTREEITEM hitem = TreeView_InsertItem(hwnd, &tvi);
folder._bookmarks.fill_tree(hwnd, hitem);
@ -203,7 +206,8 @@ void BookmarkList::fill_tree(HWND hwnd, HTREEITEM parent) const
const Bookmark& bookmark = *node._pbookmark;
tv.pszText = (LPTSTR)bookmark._name.c_str();
tv.iSelectedImage = tv.iImage = 0;
tv.iImage = 0;
tv.iSelectedImage = 1;
TreeView_InsertItem(hwnd, &tvi);
}
}

View file

@ -31,8 +31,8 @@ struct Bookmark
Bookmark() : _icon_idx(0) {}
String _name;
String _url;
String _description;
String _url;
String _icon_path;
int _icon_idx;

View file

@ -1017,7 +1017,7 @@ protected:
};
if (tooltip)
_tcsncpy(nid.szTip, tooltip, COUNTOF(nid.szTip));
lstrcpyn(nid.szTip, tooltip, COUNTOF(nid.szTip));
if (nid.szTip[0])
nid.uFlags |= NIF_TIP;