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

StartMenu Struct Reference

Startmenu window. More...

#include <startmenu.h>

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

List of all members.

Public Types

typedef ExtContextMenuHandlerT
< OwnerDrawParent
< DialogWindow > > 
super

Public Member Functions

 StartMenu (HWND hwnd, int icon_size=ICON_SIZE_SMALL)
 StartMenu (HWND hwnd, const StartMenuCreateInfo &create_info, int icon_size=ICON_SIZE_SMALL)
 ~StartMenu ()

Static Public Member Functions

static HWND Create (int x, int y, const StartMenuFolders &, HWND hwndParent, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL, const String &filter="")

Static Public Attributes

static CREATORFUNC_INFO s_def_creator = STARTMENU_CREATOR(StartMenu)

Protected Types

enum  SCROLL_MODE { SCROLL_NOT, SCROLL_UP, SCROLL_DOWN }

Protected Member Functions

LRESULT Init (LPCREATESTRUCT pcs)
LRESULT WndProc (UINT nmsg, WPARAM wparam, LPARAM lparam)
int Command (int id, int code)
void ResizeButtons (int cx)
virtual void AddEntries ()
ShellEntryMap::iterator AddEntry (const String &title, ICON_ID icon_id, Entry *entry)
ShellEntryMap::iterator AddEntry (const String &title, ICON_ID icon_id=ICID_NONE, int id=-1)
ShellEntryMap::iterator AddEntry (const ShellFolder folder, ShellEntry *entry)
ShellEntryMap::iterator AddEntry (const ShellFolder folder, Entry *entry)
void AddShellEntries (const ShellDirectory &dir, int max=-1, const String &ignore="")
void AddButton (LPCTSTR title, ICON_ID icon_id=ICID_NONE, bool hasSubmenu=false, int id=-1, bool enabled=true)
void AddSeparator ()
bool CloseSubmenus ()
bool CloseOtherSubmenus (int id=0)
void CreateSubmenu (int id, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL)
bool CreateSubmenu (int id, int folder, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL)
bool CreateSubmenu (int id, int folder1, int folder2, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL)
void CreateSubmenu (int id, const StartMenuFolders &new_folders, LPCTSTR title, CREATORFUNC_INFO creator=s_def_creator, void *info=NULL)
void ActivateEntry (int id, const ShellEntrySet &entries)
virtual void CloseStartMenu (int id=0)
 close all windows of the start menu popup
bool GetButtonRect (int id, PRECT prect) const
void DrawFloatingButton (HDC hdc)
void GetFloatingButtonRect (LPRECT prect)
void GetArrowButtonRects (LPRECT prect_up, LPRECT prect_down, int icon_size)
void DrawArrows (HDC hdc, int icon_size)
void Paint (PaintCanvas &canvas)
void UpdateIcons ()

Static Protected Member Functions

static BtnWindowClassGetWndClasss ()

Protected Attributes

int _next_id
ShellEntryMap _entries
StartMenuShellDirs _dirs
int _submenu_id
WindowHandle _submenu
int _border_left
int _border_top
int _bottom_max
bool _floating_btn
bool _arrow_btns
POINT _last_pos
enum StartMenu::SCROLL_MODE _scroll_mode
int _scroll_pos
int _invisible_lines
StartMenuCreateInfo _create_info
int _icon_size

Detailed Description

Startmenu window.

To create a start menu call its Create() function.

Definition at line 199 of file startmenu.h.


Member Typedef Documentation


Member Enumeration Documentation

enum StartMenu::SCROLL_MODE [protected]
Enumerator:
SCROLL_NOT 
SCROLL_UP 
SCROLL_DOWN 

Definition at line 245 of file startmenu.h.


Constructor & Destructor Documentation

StartMenu::StartMenu ( HWND  hwnd,
int  icon_size = ICON_SIZE_SMALL 
)

Definition at line 49 of file startmenu.cpp.

References _arrow_btns, _border_left, _border_top, _bottom_max, _floating_btn, _invisible_lines, _last_pos, _next_id, _scroll_mode, _scroll_pos, _submenu_id, IDC_FIRST_MENU, WindowRect::pos(), and SCROLL_NOT.

 :  super(hwnd),
    _icon_size(icon_size)
{
    _next_id = IDC_FIRST_MENU;
    _submenu_id = 0;

    _border_left = 0;
    _border_top = 0;
    _bottom_max = INT_MAX;

    _floating_btn = false;
    _arrow_btns = false;
    _scroll_mode = SCROLL_NOT;
    _scroll_pos = 0;
    _invisible_lines = 0;

    _last_pos = WindowRect(hwnd).pos();
#ifdef _LIGHT_STARTMENU
    _selected_id = -1;
    _last_mouse_pos = 0;
#endif
}

Here is the call graph for this function:

StartMenu::StartMenu ( HWND  hwnd,
const StartMenuCreateInfo create_info,
int  icon_size = ICON_SIZE_SMALL 
)

Definition at line 73 of file startmenu.cpp.

References _arrow_btns, _border_left, StartMenuCreateInfo::_border_top, _border_top, _bottom_max, _dirs, _floating_btn, StartMenuCreateInfo::_folders, WindowHandle::_hwnd, _invisible_lines, _last_pos, _next_id, _scroll_mode, _scroll_pos, _submenu_id, GetDesktopFolder(), IDC_FIRST_MENU, WindowRect::pos(), and SCROLL_NOT.

 :  super(hwnd),
    _create_info(create_info),
    _icon_size(icon_size)
{
    for(StartMenuFolders::const_iterator it=create_info._folders.begin(); it!=create_info._folders.end(); ++it)
        if (*it)
            _dirs.push_back(ShellDirectory(GetDesktopFolder(), *it, _hwnd));

    _next_id = IDC_FIRST_MENU;
    _submenu_id = 0;

    _border_left = 0;
    _border_top = create_info._border_top;
    _bottom_max = INT_MAX;

    _floating_btn = create_info._border_top? true: false;
    _arrow_btns = false;
    _scroll_mode = SCROLL_NOT;
    _scroll_pos = 0;
    _invisible_lines = 0;

    _last_pos = WindowRect(hwnd).pos();
#ifdef _LIGHT_STARTMENU
    _selected_id = -1;
    _last_mouse_pos = 0;
#endif
}

Here is the call graph for this function:

StartMenu::~StartMenu (  )

Definition at line 102 of file startmenu.cpp.

References PM_STARTMENU_CLOSED, and Window::SendParent().

Here is the call graph for this function:


Member Function Documentation

void StartMenu::ActivateEntry ( int  id,
const ShellEntrySet entries 
) [protected]

Todo:
If the user explicitly clicked on a submenu, display this folder as floating start menu.
Todo:
launch in the background; specify correct HWND for error message box titles

Definition at line 1294 of file startmenu.cpp.

References Entry::_data, Entry::_display_name, Entry::_etype, WindowHandle::_hwnd, CloseOtherSubmenus(), CloseStartMenu(), COUNTOF, Entry::create_absolute_pidl(), CreateSubmenu(), display_error(), ET_SHELL, Entry::get_path(), and HWND.

Referenced by Command().

{
    StartMenuFolders new_folders;
    String title;

    for(ShellEntrySet::const_iterator it=entries.begin(); it!=entries.end(); ++it) {
        Entry* entry = const_cast<Entry*>(*it);

        if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {

            ///@todo If the user explicitly clicked on a submenu, display this folder as floating start menu.

            if (entry->_etype == ET_SHELL)
                new_folders.push_back(entry->create_absolute_pidl());
            else {
                TCHAR path[MAX_PATH];

                if (entry->get_path(path, COUNTOF(path)))
                    new_folders.push_back(path);
            }

            if (title.empty())
                title = entry->_display_name;
        } else {
             // The entry is no subdirectory, so there can only be one shell entry.
            assert(entries.size()==1);

            HWND hparent = GetParent(_hwnd);
            ShellPath shell_path = entry->create_absolute_pidl();

             // close start menus when launching the selected entry
            CloseStartMenu(id);

            ///@todo launch in the background; specify correct HWND for error message box titles
            SHELLEXECUTEINFO shexinfo;

            shexinfo.cbSize = sizeof(SHELLEXECUTEINFO);
            shexinfo.fMask = SEE_MASK_IDLIST;   // SEE_MASK_INVOKEIDLIST is also possible.
            shexinfo.hwnd = hparent;
            shexinfo.lpVerb = NULL;
            shexinfo.lpFile = NULL;
            shexinfo.lpParameters = NULL;
            shexinfo.lpDirectory = NULL;
            shexinfo.nShow = SW_SHOWNORMAL;

            shexinfo.lpIDList = &*shell_path;

             // add PIDL to the recent file list
            SHAddToRecentDocs(SHARD_PIDL, shexinfo.lpIDList);

            if (!ShellExecuteEx(&shexinfo))
                display_error(hparent, GetLastError());

             // we may have deleted 'this' - ensure we leave the loop and function
            return;
        }
    }

    if (!new_folders.empty()) {
         // Only open one submenu at a time.
        if (!CloseOtherSubmenus(id))
            return;

        CreateSubmenu(id, new_folders, title);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void StartMenu::AddButton ( LPCTSTR  title,
ICON_ID  icon_id = ICID_NONE,
bool  hasSubmenu = false,
int  id = -1,
bool  enabled = true 
) [protected]

Definition at line 1139 of file startmenu.cpp.

References _border_left, WindowHandle::_hwnd, ExplorerGlobals::_icon_cache, g_Globals, IconCache::get_icon(), GetStartMenuBtnTextWidth(), and STARTMENU_LINE_HEIGHT.

Referenced by FavoritesMenu::AddEntries(), SearchMenu::AddEntries(), BrowseMenu::AddEntries(), SettingsMenu::AddEntries(), StartMenuRoot::AddEntries(), StartMenuRoot::Init(), and Init().

{
#ifdef _LIGHT_STARTMENU
    _buttons.push_back(SMBtnInfo(title, icon_id, id, hasSubmenu, enabled));
#else
    DWORD style = enabled? WS_VISIBLE|WS_CHILD|BS_OWNERDRAW: WS_VISIBLE|WS_CHILD|BS_OWNERDRAW|WS_DISABLED;

    WindowRect rect(_hwnd);
    ClientRect clnt(_hwnd);

     // increase window height to make room for the new button
    rect.top -= STARTMENU_LINE_HEIGHT(icon_size);

     // move down if we are too high now
    if (rect.top < 0) {
        rect.top += STARTMENU_LINE_HEIGHT(icon_size);
        rect.bottom += STARTMENU_LINE_HEIGHT(icon_size);
    }

    WindowCanvas canvas(_hwnd);
    FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));

     // widen window, if it is too small
    int text_width = GetStartMenuBtnTextWidth(canvas, title, _hwnd) + icon_size + 10/*placeholder*/ + 16/*arrow*/;

    int cx = clnt.right - _border_left;
    if (text_width > cx)
        rect.right += text_width-cx;

    MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);

    StartMenuCtrl(_hwnd, _border_left, clnt.bottom, rect.right-rect.left-_border_left,
                    title, id, g_Globals._icon_cache.get_icon(icon_id)._hIcon, hasSubmenu, style);
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented in StartMenuRoot, SettingsMenu, BrowseMenu, SearchMenu, RecentStartMenu, and FavoritesMenu.

Definition at line 211 of file startmenu.cpp.

References StartMenuDirectory::_dir, _dirs, StartMenuDirectory::_ignore, Entry::_scanned, AddShellEntries(), SCAN_DONT_EXTRACT_ICONS, Entry::smart_scan(), and SORT_NAME.

Referenced by FavoritesMenu::AddEntries(), SearchMenu::AddEntries(), BrowseMenu::AddEntries(), SettingsMenu::AddEntries(), StartMenuRoot::AddEntries(), and Init().

{
    for(StartMenuShellDirs::iterator it=_dirs.begin(); it!=_dirs.end(); ++it) {
        StartMenuDirectory& smd = *it;
        ShellDirectory& dir = smd._dir;

        if (!dir._scanned) {
            WaitCursor wait;

#ifdef _LAZY_ICONEXTRACT
            dir.smart_scan(SORT_NAME, SCAN_DONT_EXTRACT_ICONS); // lazy icon extraction, try to read directly from filesystem
#else
            dir.smart_scan(SORT_NAME);
#endif
        }

        AddShellEntries(dir, -1, smd._ignore);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

ShellEntryMap::iterator StartMenu::AddEntry ( const String title,
ICON_ID  icon_id = ICID_NONE,
int  id = -1 
) [protected]

Definition at line 1099 of file startmenu.cpp.

References _entries, StartMenuEntry::_icon_id, _next_id, and StartMenuEntry::_title.

{
    if (id == -1)
        id = ++_next_id;

    StartMenuEntry sme;

    sme._title = title;
    sme._icon_id = icon_id;

    ShellEntryMap::iterator it = _entries.insert(make_pair(id, sme)).first;

    return it;
}
ShellEntryMap::iterator StartMenu::AddEntry ( const String title,
ICON_ID  icon_id,
Entry entry 
) [protected]

Todo:
speed up by using a map indexed by name

Definition at line 1070 of file startmenu.cpp.

References Entry::_data, StartMenuEntry::_entries, _entries, _tcsicmp, and StartMenuEntry::_title.

Referenced by AddEntry(), and AddShellEntries().

{
     // search for an already existing subdirectory entry with the same name
    if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    {
        for(ShellEntryMap::iterator it=_entries.begin(); it!=_entries.end(); ++it) {
            StartMenuEntry& sme = it->second;

            if (!_tcsicmp(sme._title, title))   ///@todo speed up by using a map indexed by name
            {
                for(ShellEntrySet::iterator it2=sme._entries.begin(); it2!=sme._entries.end(); ++it2) {
                    if ((*it2)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
                         // merge the new shell entry with the existing of the same name
                        sme._entries.insert(entry);

                        return it;
                    }
                }
            }
        }
    }

    ShellEntryMap::iterator sme = AddEntry(title, icon_id);

    sme->second._entries.insert(entry);

    return sme;
}

Here is the caller graph for this function:

ShellEntryMap::iterator StartMenu::AddEntry ( const ShellFolder  folder,
ShellEntry entry 
) [protected]

Definition at line 1114 of file startmenu.cpp.

References Entry::_data, Entry::_icon_id, ShellEntry::_pidl, AddEntry(), ShellFolder::get_name(), and ICID_APPS.

{
    ICON_ID icon_id;

    if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        icon_id = ICID_APPS;
    else
        icon_id = (ICON_ID)/*@@*/ entry->_icon_id;

    return AddEntry(folder.get_name(entry->_pidl), icon_id, entry);
}

Here is the call graph for this function:

ShellEntryMap::iterator StartMenu::AddEntry ( const ShellFolder  folder,
Entry entry 
) [protected]

Definition at line 1126 of file startmenu.cpp.

References Entry::_data, Entry::_display_name, Entry::_icon_id, AddEntry(), and ICID_APPS.

{
    ICON_ID icon_id;

    if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        icon_id = ICID_APPS;
    else
        icon_id = (ICON_ID)/*@@*/ entry->_icon_id;

    return AddEntry(entry->_display_name, icon_id, entry);
}

Here is the call graph for this function:

void StartMenu::AddSeparator (  ) [protected]

Definition at line 1175 of file startmenu.cpp.

References _border_left, WindowHandle::_hwnd, ICID_NONE, STARTMENU_LINE_HEIGHT, and STARTMENU_SEP_HEIGHT.

Referenced by StartMenuRoot::Init().

{
#ifdef _LIGHT_STARTMENU
    _buttons.push_back(SMBtnInfo(NULL, ICID_NONE, -1, false));
#else
    WindowRect rect(_hwnd);
    ClientRect clnt(_hwnd);

     // increase window height to make room for the new separator
    rect.top -= STARTMENU_SEP_HEIGHT(icon_size);

     // move down if we are too high now
    if (rect.top < 0) {
        rect.top += STARTMENU_LINE_HEIGHT(icon_size);
        rect.bottom += STARTMENU_LINE_HEIGHT(icon_size);
    }

    MoveWindow(_hwnd, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, TRUE);

    StartMenuSeparator(_hwnd, _border_left, clnt.bottom, rect.right-rect.left-_border_left);
#endif
}

Here is the caller graph for this function:

void StartMenu::AddShellEntries ( const ShellDirectory dir,
int  max = -1,
const String ignore = "" 
) [protected]

Definition at line 245 of file startmenu.cpp.

References _create_info, Entry::_down, StartMenuCreateInfo::_filter, ShellDirectory::_folder, _MAX_EXT, _MAX_FNAME, Entry::_next, _tcsicmp, _tcsstr, _tsplitpath_s, AddEntry(), COUNTOF, ET_SHELL, ShellDirectory::get_path(), and String::toLower().

Referenced by RecentStartMenu::AddEntries(), and AddEntries().

{
    TCHAR ignore_path[MAX_PATH], ignore_dir[MAX_PATH], ignore_name[_MAX_FNAME], ignore_ext[_MAX_EXT];
    TCHAR dir_path[MAX_PATH];

    if (!ignore.empty()) {
        _tsplitpath_s(ignore, ignore_path, COUNTOF(ignore_path), ignore_dir, COUNTOF(ignore_dir), ignore_name, COUNTOF(ignore_name), ignore_ext, COUNTOF(ignore_ext));

        _tcscat(ignore_path, ignore_dir);
        _tcscat(ignore_name, ignore_ext);

        dir.get_path(dir_path, COUNTOF(dir_path));

        if (_tcsicmp(trim_path_slash(dir_path), trim_path_slash(ignore_path)))
            *ignore_name = '\0';
    } else
        *ignore_name = '\0';

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

    int cnt = 0;
    for(Entry*entry=dir._down; entry; entry=entry->_next) {
         // hide files like "desktop.ini"
        if (entry->_shell_attribs & SFGAO_HIDDEN)
        //not appropriate for drive roots: if (entry->_data.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
            continue;

         // hide "Programs" subfolders if requested
        if (*ignore_name && !_tcsicmp(entry->_data.cFileName, ignore_name))
            continue;

         // only 'max' entries shall be added.
        if (++cnt == max)
            break;

         // filter only non-directory entries
        if (!(entry->_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) && !lwr_filter.empty()) {
            String lwr_name = entry->_data.cFileName;
            String lwr_disp = entry->_display_name;

            lwr_name.toLower();
            lwr_disp.toLower();

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

        if (entry->_etype == ET_SHELL)
            AddEntry(dir._folder, static_cast<ShellEntry*>(entry));
        else
            AddEntry(dir._folder, entry);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool StartMenu::CloseOtherSubmenus ( int  id = 0 ) [protected]

Definition at line 1199 of file startmenu.cpp.

References _submenu, and _submenu_id.

Referenced by ActivateEntry(), CloseSubmenus(), FavoritesMenu::Command(), CreateSubmenu(), StartMenuRoot::ProcessKey(), and WndProc().

{
    if (_submenu) {
        if (IsWindow(_submenu)) {
            if (_submenu_id == id)
                return false;
            else {
                _submenu_id = 0;
                DestroyWindow(_submenu);
                // _submenu should be reset automatically by PM_STARTMENU_CLOSED, but safety first...
            }
        }

        _submenu = 0;
    }

    return true;
}

Here is the caller graph for this function:

void StartMenu::CloseStartMenu ( int  id = 0 ) [protected, virtual]

close all windows of the start menu popup

Reimplemented in StartMenuRoot.

Definition at line 1363 of file startmenu.cpp.

References WindowHandle::_hwnd, _submenu, CloseSubmenus(), PM_STARTENTRY_LAUNCHED, and Window::SendParent().

Referenced by ActivateEntry(), FavoritesMenu::Command(), StartMenuHandler::Command(), Command(), and WndProc().

{
    if (!(GetWindowStyle(_hwnd) & WS_CAPTION)) {    // don't automatically close floating menus
        if (!SendParent(PM_STARTENTRY_LAUNCHED, id, (LPARAM)_hwnd))
            DestroyWindow(_hwnd);
    } else if (_submenu)    // instead close submenus of floating parent menus
        CloseSubmenus();
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool StartMenu::CloseSubmenus (  ) [inline, protected]

Definition at line 286 of file startmenu.h.

References CloseOtherSubmenus().

Referenced by StartMenuRoot::CloseStartMenu(), CloseStartMenu(), and WndProc().

{return CloseOtherSubmenus();}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from Window.

Reimplemented in StartMenuHandler, and FavoritesMenu.

Definition at line 1043 of file startmenu.cpp.

References _entries, ActivateEntry(), CloseStartMenu(), and Window::Command().

Referenced by FavoritesMenu::Command(), StartMenuHandler::Command(), and WndProc().

{
#ifndef _LIGHT_STARTMENU
    switch(id) {
      case IDCANCEL:
        CloseStartMenu(id);
        break;

      default: {
#endif
        ShellEntryMap::iterator found = _entries.find(id);

        if (found != _entries.end()) {
            ActivateEntry(id, found->second._entries);
            return 0;
        }

        return super::Command(id, code);
#ifndef _LIGHT_STARTMENU
      }
    }

    return 0;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

HWND StartMenu::Create ( int  x,
int  y,
const StartMenuFolders folders,
HWND  hwndParent,
LPCTSTR  title,
CREATORFUNC_INFO  creator = s_def_creator,
void *  info = NULL,
const String filter = "" 
) [static]

Definition at line 120 of file startmenu.cpp.

References StartMenuCreateInfo::_border_top, StartMenuCreateInfo::_creator, StartMenuCreateInfo::_filter, StartMenuCreateInfo::_folders, StartMenuCreateInfo::_info, StartMenuCreateInfo::_title, GetWndClasss(), HWND, ICON_SIZE_SMALL, MoveVisible(), STARTMENU_LINE_HEIGHT, STARTMENU_TOP_BTN_SPACE, and STARTMENU_WIDTH_MIN.

Referenced by StartMenuHandler::Command(), CreateSubmenu(), and WndProc().

{
    UINT style, ex_style;
    int top_height;

    if (hwndParent) {
        style = WS_POPUP|WS_THICKFRAME|WS_CLIPCHILDREN|WS_VISIBLE;
        ex_style = 0;
        top_height = STARTMENU_TOP_BTN_SPACE;
    } else {
        style = WS_POPUP|WS_CAPTION|WS_SYSMENU|WS_CLIPCHILDREN|WS_VISIBLE;
        ex_style = WS_EX_TOOLWINDOW;
        top_height = 0;
    }

    int icon_size = ICON_SIZE_SMALL;
    RECT rect = {x, y-STARTMENU_LINE_HEIGHT(icon_size)-top_height, x+STARTMENU_WIDTH_MIN, y};

#ifndef _LIGHT_STARTMENU
    rect.top += STARTMENU_LINE_HEIGHT(icon_size);
#endif

    AdjustWindowRectEx(&rect, style, FALSE, ex_style);

    StartMenuCreateInfo create_info;

    create_info._folders = folders;
    create_info._border_top = top_height;
    create_info._creator = creator;
    create_info._info = info;
    create_info._filter = filter;

    if (title)
        create_info._title = title;

    HWND hwnd = Window::Create(creator, &create_info, ex_style, GetWndClasss(), title,
                                style, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, hwndParent);

     // make sure the window is not off the screen
    MoveVisible(hwnd);

    return hwnd;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void StartMenu::CreateSubmenu ( int  id,
LPCTSTR  title,
CREATORFUNC_INFO  creator = s_def_creator,
void *  info = NULL 
) [protected]

Definition at line 1219 of file startmenu.cpp.

Referenced by ActivateEntry(), FavoritesMenu::Command(), StartMenuHandler::Command(), and CreateSubmenu().

{
    CreateSubmenu(id, StartMenuFolders(), title, creator, info);
}

Here is the caller graph for this function:

bool StartMenu::CreateSubmenu ( int  id,
int  folder,
LPCTSTR  title,
CREATORFUNC_INFO  creator = s_def_creator,
void *  info = NULL 
) [protected]

Definition at line 1224 of file startmenu.cpp.

References WindowHandle::_hwnd, CloseOtherSubmenus(), and CreateSubmenu().

{
    try {
        SpecialFolderPath folder(folder_id, _hwnd);

        StartMenuFolders new_folders;
        new_folders.push_back(folder);

        CreateSubmenu(id, new_folders, title, creator, info);

        return true;
    } catch(COMException&) {
        // ignore Exception and don't display anything
        CloseOtherSubmenus(id);
        _buttons[GetSelectionIndex()]._enabled = false; // disable entries for non-existing folders
        return false;
    }
}

Here is the call graph for this function:

void StartMenu::CreateSubmenu ( int  id,
const StartMenuFolders new_folders,
LPCTSTR  title,
CREATORFUNC_INFO  creator = s_def_creator,
void *  info = NULL 
) [protected]

Definition at line 1267 of file startmenu.cpp.

References _border_top, _create_info, StartMenuCreateInfo::_filter, WindowHandle::_hwnd, _icon_size, _submenu, _submenu_id, ClientToScreen(), CloseOtherSubmenus(), Create(), GetButtonRect(), STARTMENU_LINE_HEIGHT, and STARTMENU_TOP_BTN_SPACE.

{
     // Only open one submenu at a time.
    if (!CloseOtherSubmenus(id))
        return;

    RECT rect;
    int x, y;

    if (GetButtonRect(id, &rect)) {
        ClientToScreen(_hwnd, &rect);

        x = rect.right; // Submenus should overlap their parent a bit.
        const int icon_size = _icon_size;
        y = rect.top+STARTMENU_LINE_HEIGHT(icon_size) +_border_top/*own border*/ -STARTMENU_TOP_BTN_SPACE/*border of new submenu*/;
    } else {
        WindowRect pos(_hwnd);

        x = pos.right;
        y = pos.top;
    }

    _submenu_id = id;
    _submenu = StartMenu::Create(x, y, new_folders, _hwnd, title, creator, info, _create_info._filter);
}

Here is the call graph for this function:

bool StartMenu::CreateSubmenu ( int  id,
int  folder1,
int  folder2,
LPCTSTR  title,
CREATORFUNC_INFO  creator = s_def_creator,
void *  info = NULL 
) [protected]

Definition at line 1243 of file startmenu.cpp.

References WindowHandle::_hwnd, CloseOtherSubmenus(), and CreateSubmenu().

{
    StartMenuFolders new_folders;

    try {
        new_folders.push_back(SpecialFolderPath(folder_id1, _hwnd));
    } catch(COMException&) {
    }

    try {
        new_folders.push_back(SpecialFolderPath(folder_id2, _hwnd));
    } catch(COMException&) {
    }

    if (!new_folders.empty()) {
        CreateSubmenu(id, new_folders, title, creator, info);
        return true;
    } else {
        CloseOtherSubmenus(id);
        _buttons[GetSelectionIndex()]._enabled = false; // disable entries for non-existing folders
        return false;
    }
}

Here is the call graph for this function:

void StartMenu::DrawArrows ( HDC  hdc,
int  icon_size 
) [protected]

Definition at line 837 of file startmenu.cpp.

References _floating_btn, WindowHandle::_hwnd, IDI_ARROW_DOWN, and IDI_ARROW_UP.

Referenced by Paint().

{
    int cx = icon_size / 2;
    int cy = icon_size / 4;

    ResIconEx arrowUpIcon(IDI_ARROW_UP, cx, cy);
    ResIconEx arrowDownIcon(IDI_ARROW_DOWN, cx, cy);

    ClientRect clnt(_hwnd);

    DrawIconEx(hdc, clnt.right/2-cx/2, _floating_btn?3:1, arrowUpIcon, cx, cy, 0, 0, DI_NORMAL);
    DrawIconEx(hdc, clnt.right/2-cx/2, clnt.bottom-cy-1, arrowDownIcon, cx, cy, 0, 0, DI_NORMAL);
}

Here is the caller graph for this function:

void StartMenu::DrawFloatingButton ( HDC  hdc ) [protected]

Definition at line 818 of file startmenu.cpp.

References WindowHandle::_hwnd, and IDI_FLOATING.

Referenced by Paint().

{
    static ResIconEx floatingIcon(IDI_FLOATING, 8, 4);

    ClientRect clnt(_hwnd);

    DrawIconEx(hdc, clnt.right-12, 0, floatingIcon, 8, 4, 0, 0, DI_NORMAL);
}

Here is the caller graph for this function:

void StartMenu::GetArrowButtonRects ( LPRECT  prect_up,
LPRECT  prect_down,
int  icon_size 
) [protected]

Definition at line 851 of file startmenu.cpp.

References _floating_btn, and WindowHandle::_hwnd.

Referenced by WndProc().

{
    int cx = icon_size / 2;
    int cy = icon_size / 4;

    GetClientRect(_hwnd, prect_up);
    *prect_down = *prect_up;

//  prect_up->left = prect_up->right/2 - cx/2;
//  prect_up->right = prect_up->left + cy;
    prect_up->right -= cx;
    prect_up->top = _floating_btn? cy-1: 1;
    prect_up->bottom = prect_up->top + cy;

//  prect_down->left = prect_down->right/2 - cx/2;
//  prect_down->right = prect_down->left + cy;
    prect_down->right -= cx;
    prect_down->top = prect_down->bottom - cy - 1;
}

Here is the caller graph for this function:

bool StartMenu::GetButtonRect ( int  id,
PRECT  prect 
) const [protected]

Definition at line 783 of file startmenu.cpp.

References _border_left, _border_top, WindowHandle::_hwnd, _icon_size, _scroll_pos, HWND, ScreenToClient(), STARTMENU_LINE_HEIGHT, and STARTMENU_SEP_HEIGHT.

Referenced by CreateSubmenu(), and UpdateIcons().

{
#ifdef _LIGHT_STARTMENU
    ClientRect clnt(_hwnd);
    const int icon_size = _icon_size;
    RECT rect = {_border_left, _border_top, clnt.right, STARTMENU_LINE_HEIGHT(icon_size)};

    for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos; it!=_buttons.end(); ++it) {
        const SMBtnInfo& info = *it;

        rect.bottom = rect.top + (info._id==-1? STARTMENU_SEP_HEIGHT(icon_size): STARTMENU_LINE_HEIGHT(icon_size));

        if (info._id == id) {
            *prect = rect;
            return true;
        }

        rect.top = rect.bottom;
    }

    return false;
#else
    HWND btn = GetDlgItem(_hwnd, id);

    if (btn) {
        GetWindowRect(btn, prect);
        ScreenToClient(_hwnd, prect);

        return true;
    } else
        return false;
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void StartMenu::GetFloatingButtonRect ( LPRECT  prect ) [protected]

Definition at line 827 of file startmenu.cpp.

References WindowHandle::_hwnd.

Referenced by WndProc().

{
    GetClientRect(_hwnd, prect);

    prect->right -= 4;
    prect->left = prect->right - 8;
    prect->bottom = 4;
}

Here is the caller graph for this function:

BtnWindowClass & StartMenu::GetWndClasss (  ) [static, protected]

Definition at line 110 of file startmenu.cpp.

References CLASSNAME_STARTMENU.

Referenced by StartMenuRoot::Create(), and Create().

{
    static BtnWindowClass s_wcStartMenu(CLASSNAME_STARTMENU);

    return s_wcStartMenu;
}

Here is the caller graph for this function:

LRESULT StartMenu::Init ( LPCREATESTRUCT  pcs ) [protected, virtual]

Reimplemented from Window.

Reimplemented in StartMenuRoot.

Definition at line 166 of file startmenu.cpp.

References StartMenuEntry::_entries, _entries, WindowHandle::_hwnd, StartMenuEntry::_title, AddButton(), AddEntries(), HandleException(), ICID_NONE, IDS_EMPTY, Window::Init(), and PM_UPDATE_ICONS.

Referenced by StartMenuRoot::Init().

{
    try {
        AddEntries();

        if (super::Init(pcs))
            return 1;

         // create buttons for registered entries in _entries
        for(ShellEntryMap::const_iterator it=_entries.begin(); it!=_entries.end(); ++it) {
            const StartMenuEntry& sme = it->second;
            bool hasSubmenu = false;

            for(ShellEntrySet::const_iterator it=sme._entries.begin(); it!=sme._entries.end(); ++it)
                if ((*it)->_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
                    hasSubmenu = true;

#ifdef _LIGHT_STARTMENU
            _buttons.push_back(SMBtnInfo(sme, it->first, hasSubmenu));
#else
            AddButton(sme._title, sme._hIcon, hasSubmenu, it->first);
#endif
        }

#ifdef _LIGHT_STARTMENU
        if (_buttons.empty())
#else
        if (!GetWindow(_hwnd, GW_CHILD))
#endif
            AddButton(ResString(IDS_EMPTY), ICID_NONE, false, 0, false);

#ifdef _LIGHT_STARTMENU
        ResizeToButtons();
#endif

#ifdef _LAZY_ICONEXTRACT
        PostMessage(_hwnd, PM_UPDATE_ICONS, 0, 0);
#endif
    } catch(COMException& e) {
        HandleException(e, pcs->hwndParent);    // destroys the start menu window while switching focus
    }

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void StartMenu::Paint ( PaintCanvas canvas ) [protected]

Reimplemented in StartMenuRoot.

Definition at line 872 of file startmenu.cpp.

References _arrow_btns, _border_left, _border_top, _bottom_max, _floating_btn, WindowHandle::_hwnd, _icon_size, _scroll_pos, DrawArrows(), DrawFloatingButton(), DrawStartMenuButton(), STARTMENU_LINE_HEIGHT, and STARTMENU_SEP_HEIGHT.

Referenced by StartMenuRoot::Paint(), and WndProc().

{
    if (_floating_btn)
        DrawFloatingButton(canvas);

#ifdef _LIGHT_STARTMENU
    if (_arrow_btns)
        DrawArrows(canvas, _icon_size);

    ClientRect clnt(_hwnd);
    const int icon_size = _icon_size;
    RECT rect = {_border_left, _border_top, clnt.right, STARTMENU_LINE_HEIGHT(icon_size)};

    int sep_width = rect.right-rect.left - 4;

    FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
    BkMode bk_mode(canvas, TRANSPARENT);

    for(SMBtnVector::const_iterator it=_buttons.begin()+_scroll_pos; it!=_buttons.end(); ++it) {
        const SMBtnInfo& btn = *it;

        if (rect.top > canvas.rcPaint.bottom)
            break;

        if (btn._id == -1) {    // a separator?
            rect.bottom = rect.top + STARTMENU_SEP_HEIGHT(icon_size);

            if (rect.bottom > _bottom_max)
                break;

            BrushSelection brush_sel(canvas, GetSysColorBrush(COLOR_BTNSHADOW));
            PatBlt(canvas, rect.left+2, rect.top+STARTMENU_SEP_HEIGHT(icon_size)/2-1, sep_width, 1, PATCOPY);

            SelectBrush(canvas, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
            PatBlt(canvas, rect.left+2, rect.top+STARTMENU_SEP_HEIGHT(icon_size)/2, sep_width, 1, PATCOPY);
        } else {
            rect.bottom = rect.top + STARTMENU_LINE_HEIGHT(icon_size);

            if (rect.bottom > _bottom_max)
                break;

            if (rect.top >= canvas.rcPaint.top)
                DrawStartMenuButton(canvas, rect, btn._title, btn, btn._id==_selected_id, false, _icon_size);
        }

        rect.top = rect.bottom;
    }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void StartMenu::ResizeButtons ( int  cx ) [protected]

Definition at line 1021 of file startmenu.cpp.

References WindowHandle::_hwnd, and HWND.

Referenced by WndProc().

{
    HDWP hdwp = BeginDeferWindowPos(10);

    for(HWND ctrl=GetWindow(_hwnd,GW_CHILD); ctrl; ctrl=GetNextWindow(ctrl,GW_HWNDNEXT)) {
        ClientRect rt(ctrl);

        if (rt.right != cx) {
            int height = rt.bottom - rt.top;

             // special handling for separator controls
            if (!height && (GetWindowStyle(ctrl)&SS_TYPEMASK)==SS_ETCHEDHORZ)
                height = 2;

            hdwp = DeferWindowPos(hdwp, ctrl, 0, 0, 0, cx, height, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
        }
    }

    EndDeferWindowPos(hdwp);
}

Here is the caller graph for this function:

void StartMenu::UpdateIcons (  ) [protected]

Definition at line 923 of file startmenu.cpp.

References _bottom_max, _dirs, StartMenuEntry::_entries, _entries, WindowHandle::_hwnd, Entry::_icon_id, _icon_size, _scroll_pos, DrawStartMenuButton(), ShellDirectory::extract_icons(), GetButtonRect(), ICF_FROM_ICON_SIZE, ICID_NONE, ICID_UNKNOWN, and Entry::safe_extract_icon().

Referenced by WndProc().

{
    UpdateWindow(_hwnd);

#ifdef _SINGLE_ICONEXTRACT

    //if (idx >= 0)
    int idx = _scroll_pos;

    for(; idx<(int)_buttons.size(); ++idx) {
        SMBtnInfo& btn = _buttons[idx];

        if (btn._icon_id==ICID_UNKNOWN && btn._id>0) {
            StartMenuEntry& sme = _entries[btn._id];

            btn._icon_id = ICID_NONE;

            for(ShellEntrySet::iterator it=sme._entries.begin(); it!=sme._entries.end(); ++it) {
                Entry* entry = *it;

                if (entry->_icon_id == ICID_UNKNOWN)
                    entry->_icon_id = entry->safe_extract_icon(ICF_FROM_ICON_SIZE(_icon_size));

                if (entry->_icon_id > ICID_NONE) {
                    btn._icon_id = (ICON_ID)/*@@*/ entry->_icon_id;

                    RECT rect;

                    GetButtonRect(btn._id, &rect);

                    if (rect.bottom > _bottom_max)
                        break;

                    WindowCanvas canvas(_hwnd);
                    DrawStartMenuButton(canvas, rect, NULL, btn, btn._id==_selected_id, false, _icon_size);

                    //InvalidateRect(_hwnd, &rect, FALSE);
                    //UpdateWindow(_hwnd);
                    //break;

                    break;
                }
            }
        }
    }

//  if (++idx < (int)_buttons.size())
//      PostMessage(_hwnd, PM_UPDATE_ICONS, idx, 0);

#else

    int icons_extracted = 0;
    int icons_updated = 0;

    for(StartMenuShellDirs::iterator it=_dirs.begin(); it!=_dirs.end(); ++it) {
        ShellDirectory& dir = it->_dir;

        icons_extracted += dir.extract_icons(icon_size);
    }

    if (icons_extracted) {
        for(ShellEntryMap::iterator it1=_entries.begin(); it1!=_entries.end(); ++it1) {
            StartMenuEntry& sme = it1->second;

            if (!sme._hIcon) {
                sme._hIcon = (HICON)-1;

                for(ShellEntrySet::const_iterator it2=sme._entries.begin(); it2!=sme._entries.end(); ++it2) {
                    const Entry* sm_entry = *it2;

                    if (sm_entry->_hIcon) {
                        sme._hIcon = sm_entry->_hIcon;
                        break;
                    }
                }
            }
        }

        for(SMBtnVector::iterator it=_buttons.begin(); it!=_buttons.end(); ++it) {
            SMBtnInfo& info = *it;

            if (info._id>0 && !info._hIcon) {
                info._hIcon = _entries[info._id]._hIcon;
                ++icons_updated;
            }
        }
    }

    if (icons_updated) {
        InvalidateRect(_hwnd, NULL, FALSE);
        UpdateWindow(_hwnd);
    }
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

LRESULT StartMenu::WndProc ( UINT  nmsg,
WPARAM  wparam,
LPARAM  lparam 
) [protected, virtual]

Todo:
do something similar to StartMenuRoot::TrackStartmenu() in order to automatically close submenus when clicking on the desktop background
Todo:
refresh on successfull context menu execution?
Todo:
handle context menu for more than one entry

Reimplemented from ExtContextMenuHandlerT< OwnerDrawParent< DialogWindow > >.

Reimplemented in StartMenuRoot.

Definition at line 301 of file startmenu.cpp.

References _arrow_btns, _border_left, ExtContextMenuHandlerT< OwnerDrawParent< DialogWindow > >::_cm_ifs, _create_info, StartMenuCreateInfo::_creator, StartMenuEntry::_entries, _entries, StartMenuCreateInfo::_folders, WindowHandle::_hwnd, _icon_size, StartMenuCreateInfo::_info, _invisible_lines, _last_pos, _scroll_mode, _scroll_pos, _submenu, StartMenuCreateInfo::_title, CHECKERROR, CloseOtherSubmenus(), CloseStartMenu(), CloseSubmenus(), Command(), Create(), Entry::do_context_menu(), GetArrowButtonRects(), GetFloatingButtonRect(), HWND, Paint(), PM_SELECT_ENTRY, PM_STARTENTRY_FOCUSED, PM_STARTENTRY_LAUNCHED, PM_STARTMENU_CLOSED, PM_UPDATE_ICONS, ResizeButtons(), ScreenToClient(), SCROLL_DOWN, SCROLL_NOT, SCROLL_UP, Window::SendParent(), UpdateIcons(), and ExtContextMenuHandlerT< OwnerDrawParent< DialogWindow > >::WndProc().

Referenced by StartMenuRoot::WndProc().

{
    switch(nmsg) {
      case WM_PAINT: {
        PaintCanvas canvas(_hwnd);
        Paint(canvas);
        break;}

      case WM_SIZE:
        ResizeButtons(LOWORD(lparam)-_border_left);
        break;

      case WM_MOVE: {
        POINTS pos;
        pos.x = LOWORD(lparam);
        pos.y = HIWORD(lparam);

         // move open submenus of floating menus
        if (_submenu) {
            int dx = pos.x - _last_pos.x;
            int dy = pos.y - _last_pos.y;

            if (dx || dy) {
                WindowRect rt(_submenu);
                SetWindowPos(_submenu, 0, rt.left+dx, rt.top+dy, 0, 0, SWP_NOSIZE|SWP_NOACTIVATE);
                //MoveVisible(_submenu);
            }
        }

        _last_pos.x = pos.x;
        _last_pos.y = pos.y;
        goto def;}

      case WM_NCHITTEST: {
        LRESULT res = super::WndProc(nmsg, wparam, lparam);

        if (res>=HTSIZEFIRST && res<=HTSIZELAST)
            return HTCLIENT;    // disable window resizing

        return res;}

      case WM_LBUTTONDOWN: {
        RECT rect;

         // check mouse cursor for coordinates of floating button
        GetFloatingButtonRect(&rect);

        if (PtInRect(&rect, Point(lparam))) {
             // create a floating copy of the current start menu
            WindowRect pos(_hwnd);

            ///@todo do something similar to StartMenuRoot::TrackStartmenu() in order to automatically close submenus when clicking on the desktop background
            StartMenu::Create(pos.left+3, pos.bottom-3, _create_info._folders, 0, _create_info._title, _create_info._creator, _create_info._info);
            CloseStartMenu();
        }

#ifdef _LIGHT_STARTMENU
        int id = ButtonHitTest(Point(lparam));

        if (id)
            Command(id, BN_CLICKED);
#endif
        break;}

      case WM_SYSCOMMAND:
        if ((wparam&0xFFF0) == SC_SIZE)
            return 0;           // disable window resizing
        goto def;

      case WM_ACTIVATEAPP:
         // close start menu when activating another application
        if (!wparam)
            CloseStartMenu();
        break;  // don't call super::WndProc in case "this" has been deleted

      case WM_CANCELMODE:
        CloseStartMenu();

#ifdef _LIGHT_STARTMENU
        if (_scroll_mode != SCROLL_NOT) {
            ReleaseCapture();
            KillTimer(_hwnd, 0);
        }
#endif
        break;

#ifdef _LIGHT_STARTMENU
      case WM_MOUSEMOVE: {
         // automatically set the focus to startmenu entries when moving the mouse over them
        if (lparam != _last_mouse_pos) { // don't process WM_MOUSEMOVE when opening submenus using keyboard navigation
            Point pt(lparam);

            if (_arrow_btns) {
                RECT rect_up, rect_down;

                GetArrowButtonRects(&rect_up, &rect_down, _icon_size);

                SCROLL_MODE scroll_mode = SCROLL_NOT;

                if (PtInRect(&rect_up, pt))
                    scroll_mode = SCROLL_UP;
                else if (PtInRect(&rect_down, pt))
                    scroll_mode = SCROLL_DOWN;

                if (scroll_mode != _scroll_mode) {
                    if (scroll_mode == SCROLL_NOT) {
                        ReleaseCapture();
                        KillTimer(_hwnd, 0);
                    } else {
                        CloseSubmenus();
                        SetTimer(_hwnd, 0, 150, NULL);  // 150 ms scroll interval
                        SetCapture(_hwnd);
                    }

                    _scroll_mode = scroll_mode;
                }
            }

            int new_id = ButtonHitTest(pt);

            if (new_id>0 && new_id!=_selected_id)
                SelectButton(new_id);

            _last_mouse_pos = lparam;
        }
        break;}

      case WM_TIMER:
        if (_scroll_mode == SCROLL_UP) {
            if (_scroll_pos > 0) {
                --_scroll_pos;
                InvalidateRect(_hwnd, NULL, TRUE);
            }
        } else {
            if (_scroll_pos <= _invisible_lines) {
                ++_scroll_pos;
                InvalidateRect(_hwnd, NULL, TRUE);
            }
        }
        break;

      case WM_KEYDOWN:
        ProcessKey(wparam);
        break;
#else
      case PM_STARTENTRY_FOCUSED: { ///@todo use TrackMouseEvent() and WM_MOUSEHOVER to wait a bit before opening submenus
        BOOL hasSubmenu = wparam;
        HWND hctrl = (HWND)lparam;

         // automatically open submenus
        if (hasSubmenu) {
            UpdateWindow(_hwnd);    // draw focused button before waiting on submenu creation
            //SendMessage(_hwnd, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hctrl),BN_CLICKED), (LPARAM)hctrl);
            Command(GetDlgCtrlID(hctrl), BN_CLICKED);
        } else {
             // close any open submenu
            CloseOtherSubmenus();
        }
        break;}
#endif

#ifdef _LAZY_ICONEXTRACT
      case PM_UPDATE_ICONS:
        UpdateIcons(/*wparam*/);
        break;
#endif

      case PM_STARTENTRY_LAUNCHED:
        if (GetWindowStyle(_hwnd) & WS_CAPTION) // don't automatically close floating menus
            return 0;

         // route message to the parent menu and close menus after launching an entry
        if (!SendParent(nmsg, wparam, lparam))
            CloseStartMenu();
        return 1;   // signal that we have received and processed the message

      case PM_STARTMENU_CLOSED:
        _submenu = 0;
        break;

      case PM_SELECT_ENTRY:
        SelectButtonIndex(0, wparam!=0);
        break;

#ifdef _LIGHT_STARTMENU
      case WM_CONTEXTMENU: {
        Point screen_pt(lparam), clnt_pt=screen_pt;
        ScreenToClient(_hwnd, &clnt_pt);

        int id = ButtonHitTest(clnt_pt);

        if (id) {
            StartMenuEntry& sme = _entries[id];

            for(ShellEntrySet::iterator it=sme._entries.begin(); it!=sme._entries.end(); ++it) {
                Entry* entry = *it;

                if (entry) {
                    CHECKERROR(entry->do_context_menu(_hwnd, screen_pt, _cm_ifs));  // may close start menu because of focus loss
                    ///@todo refresh on successfull context menu execution?
                    break;  ///@todo handle context menu for more than one entry
                }
            }
        }
        break;}
#endif

      default: def:
        return super::WndProc(nmsg, wparam, lparam);
    }

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool StartMenu::_arrow_btns [protected]

Definition at line 242 of file startmenu.h.

Referenced by Paint(), StartMenu(), and WndProc().

int StartMenu::_border_left [protected]
int StartMenu::_border_top [protected]

Definition at line 238 of file startmenu.h.

Referenced by CreateSubmenu(), GetButtonRect(), Paint(), and StartMenu().

int StartMenu::_bottom_max [protected]

Definition at line 239 of file startmenu.h.

Referenced by Paint(), StartMenu(), and UpdateIcons().

Definition at line 249 of file startmenu.h.

Referenced by FavoritesMenu::AddEntries(), AddShellEntries(), CreateSubmenu(), and WndProc().

Reimplemented in FavoritesMenu.

Definition at line 231 of file startmenu.h.

Referenced by AddEntry(), Command(), Init(), UpdateIcons(), and WndProc().

bool StartMenu::_floating_btn [protected]

Definition at line 241 of file startmenu.h.

Referenced by DrawArrows(), GetArrowButtonRects(), Paint(), and StartMenu().

int StartMenu::_icon_size [protected]
int StartMenu::_invisible_lines [protected]

Definition at line 247 of file startmenu.h.

Referenced by StartMenu(), and WndProc().

POINT StartMenu::_last_pos [protected]

Definition at line 244 of file startmenu.h.

Referenced by StartMenu(), and WndProc().

int StartMenu::_next_id [protected]

Definition at line 230 of file startmenu.h.

Referenced by FavoritesMenu::AddEntries(), AddEntry(), and StartMenu().

Referenced by StartMenu(), and WndProc().

int StartMenu::_scroll_pos [protected]

Definition at line 246 of file startmenu.h.

Referenced by GetButtonRect(), Paint(), StartMenu(), UpdateIcons(), and WndProc().

int StartMenu::_submenu_id [protected]

Definition at line 234 of file startmenu.h.

Referenced by CloseOtherSubmenus(), CreateSubmenu(), and StartMenu().

Definition at line 218 of file startmenu.h.


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