Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

FavoritesMenu Struct Reference

Bookmarks sub-startmenu. More...

#include <startmenu.h>

Inheritance diagram for FavoritesMenu:
Inheritance graph
[legend]
Collaboration diagram for FavoritesMenu:
Collaboration graph
[legend]

List of all members.

Public Types

typedef StartMenu super

Public Member Functions

 FavoritesMenu (HWND hwnd, const StartMenuCreateInfo &create_info)

Protected Member Functions

virtual int Command (int id, int code)
virtual void AddEntries ()

Protected Attributes

BookmarkList _bookmarks
BookmarkMap _entries

Detailed Description

Bookmarks sub-startmenu.

Definition at line 459 of file startmenu.h.


Member Typedef Documentation

Reimplemented from StartMenu.

Definition at line 461 of file startmenu.h.


Constructor & Destructor Documentation

FavoritesMenu::FavoritesMenu ( HWND  hwnd,
const StartMenuCreateInfo create_info 
) [inline]

Definition at line 463 of file startmenu.h.

     :  super(hwnd, create_info),
        _bookmarks(*(BookmarkList*)create_info._info)
    {
    }

Member Function Documentation

void FavoritesMenu::AddEntries (  ) [protected, virtual]

Reimplemented from StartMenu.

Definition at line 2243 of file startmenu.cpp.

References _bookmarks, StartMenu::_create_info, Bookmark::_description, _entries, StartMenuCreateInfo::_filter, ExplorerGlobals::_icon_cache, Bookmark::_icon_idx, Bookmark::_icon_path, Bookmark::_name, BookmarkFolder::_name, StartMenu::_next_id, BookmarkNode::_pbookmark, BookmarkNode::_pfolder, _tcsstr, BookmarkNode::_type, Bookmark::_url, StartMenu::AddButton(), StartMenu::AddEntries(), BookmarkNode::BMNT_BOOKMARK, BookmarkNode::BMNT_FOLDER, IconCache::extract(), g_Globals, ICID_BOOKMARK, ICID_FOLDER, ICID_NONE, and String::toLower().

{
    super::AddEntries();

    String lwr_filter = _create_info._filter;
    lwr_filter.toLower();

    for(BookmarkList::iterator it=_bookmarks.begin(); it!=_bookmarks.end(); ++it) {
        BookmarkNode& node = *it;

        int id = ++_next_id;

        _entries[id] = node;

        if (node._type == BookmarkNode::BMNT_FOLDER) {
            BookmarkFolder& folder = *node._pfolder;

            AddButton(folder._name, ICID_FOLDER, true, id);
        } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
            Bookmark& bookmark = *node._pbookmark;

            ICON_ID icon = ICID_NONE;

            if (!bookmark._icon_path.empty())
                icon = g_Globals._icon_cache.extract(bookmark._icon_path, bookmark._icon_idx);

             // filter non-directory entries
            if (!lwr_filter.empty()) {
                String lwr_name = bookmark._name;
                String lwr_desc = bookmark._description;
                String lwr_url = bookmark._url;

                lwr_name.toLower();
                lwr_desc.toLower();
                lwr_url.toLower();

                if (!_tcsstr(lwr_name,lwr_filter) && !_tcsstr(lwr_desc,lwr_filter) && !_tcsstr(lwr_url,lwr_filter))
                    continue;
            }

            AddButton(bookmark._name, icon!=ICID_NONE?icon:ICID_BOOKMARK, false, id);
        }
    }
}

Here is the call graph for this function:

int FavoritesMenu::Command ( int  id,
int  code 
) [protected, virtual]

Reimplemented from StartMenu.

Definition at line 2288 of file startmenu.cpp.

References BookmarkFolder::_bookmarks, _entries, WindowHandle::_hwnd, BookmarkFolder::_name, BookmarkNode::_pbookmark, BookmarkNode::_pfolder, BookmarkNode::_type, Bookmark::_url, BookmarkNode::BMNT_BOOKMARK, BookmarkNode::BMNT_FOLDER, StartMenu::CloseOtherSubmenus(), StartMenu::CloseStartMenu(), StartMenu::Command(), StartMenu::CreateSubmenu(), HWND, launch_file(), and STARTMENU_CREATOR.

{
    BookmarkMap::iterator found = _entries.find(id);

    if (found != _entries.end()) {
        BookmarkNode& node = found->second;

        if (node._type == BookmarkNode::BMNT_FOLDER) {
            BookmarkFolder& folder = *node._pfolder;

            if (CloseOtherSubmenus(id))
                CreateSubmenu(id, folder._name, STARTMENU_CREATOR(FavoritesMenu), &static_cast<BookmarkList&>(folder._bookmarks));
        } else if (node._type == BookmarkNode::BMNT_BOOKMARK) {
            Bookmark& bookmark = *node._pbookmark;

            String url = bookmark._url;
            HWND hparent = GetParent(_hwnd);

            CloseStartMenu(id);

            launch_file(hparent, url, SW_SHOWNORMAL);
        }

        return 0;
    }

    return super::Command(id, code);
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 473 of file startmenu.h.

Referenced by AddEntries().

Reimplemented from StartMenu.

Definition at line 474 of file startmenu.h.

Referenced by AddEntries(), and Command().


The documentation for this struct was generated from the following files:

ROS Explorer Source Code Documentation
generated on 02.01.2013 by doxygen

ROS Explorer Homepage