Google
Web alhem.net
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

MenuHandler Class Reference

#include <MenuHandler.h>

Inheritance diagram for MenuHandler:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 MenuHandler ()
virtual ~MenuHandler ()
void Add (Menu *)
void Remove (Menu *)
void OnInitMenu (HMENU)
void OnInitPopupMenu (HMENU, int relpos, bool winmenu)
void OnMenuSelect (HMENU, int index, int flags)
bool OnCommand (int id)
int get_next_id (Menu *)
bool Valid (Menu *)

Private Attributes

menu_v m_menulist
intmenu_m m_id

Static Private Attributes

 m_next_id = 0

Constructor & Destructor Documentation

MenuHandler::MenuHandler  ) 
 

Definition at line 48 of file MenuHandler.cpp.

00049 { 00050 }

MenuHandler::~MenuHandler  )  [virtual]
 

Definition at line 53 of file MenuHandler.cpp.

00054 { 00055 }


Member Function Documentation

void MenuHandler::Add Menu  ) 
 

Definition at line 58 of file MenuHandler.cpp.

References Add(), and m_menulist.

Referenced by Add(), and Menu::Menu().

00059 { 00060 m_menulist.push_back(p); 00061 }

int MenuHandler::get_next_id Menu  ) 
 

Definition at line 120 of file MenuHandler.cpp.

References D2, get_next_id(), ID_SPAN, ID_START, m_id, and m_next_id.

Referenced by Menu::AddMenuitem(), and get_next_id().

00121 { 00122 // %! lock 00123 int id = ID_START + (++m_next_id % ID_SPAN); 00124 m_id[id] = p; 00125 D2(fprintf(fil,"new menu id: %d ptr: %08lx\n",id,(unsigned long)p);) 00126 return id; 00127 }

bool MenuHandler::OnCommand int  id  ) 
 

Definition at line 145 of file MenuHandler.cpp.

References D2, m_id, OnCommand(), and Valid().

Referenced by MyDlgProc(), and OnCommand().

00146 { 00147 Menu *p = m_id[id]; 00148 if (p && Valid(p)) 00149 { 00150 D2(fprintf(fil,"OnCommand(%d) for menu %08lx\n",id,(unsigned long)p);) 00151 p->OnCommand( id ); 00152 return true; // %! not exactly true 00153 } 00154 return false; 00155 }

void MenuHandler::OnInitMenu HMENU   ) 
 

Definition at line 78 of file MenuHandler.cpp.

References Menu::Handle(), m_menulist, Menu::OnInitMenu(), and OnInitMenu().

Referenced by MyDlgProc(), and OnInitMenu().

00079 { 00080 for (menu_v::iterator it = m_menulist.begin(); it != m_menulist.end(); it++) 00081 { 00082 Menu *p0 = *it; 00083 if (p0->Handle() == h) 00084 { 00085 p0->OnInitMenu(); 00086 break; 00087 } 00088 } 00089 }

void MenuHandler::OnInitPopupMenu HMENU  ,
int  relpos,
bool  winmenu
 

Definition at line 92 of file MenuHandler.cpp.

References Menu::Handle(), m_menulist, Menu::OnInitPopupMenu(), and OnInitPopupMenu().

Referenced by MyDlgProc(), and OnInitPopupMenu().

00093 { 00094 for (menu_v::iterator it = m_menulist.begin(); it != m_menulist.end(); it++) 00095 { 00096 Menu *p0 = *it; 00097 if (p0->Handle() == h) 00098 { 00099 p0->OnInitPopupMenu(relpos, winmenu); 00100 break; 00101 } 00102 } 00103 }

void MenuHandler::OnMenuSelect HMENU  ,
int  index,
int  flags
 

Definition at line 106 of file MenuHandler.cpp.

References Menu::Handle(), m_menulist, Menu::OnMenuSelect(), and OnMenuSelect().

Referenced by MyDlgProc(), and OnMenuSelect().

00107 { 00108 for (menu_v::iterator it = m_menulist.begin(); it != m_menulist.end(); it++) 00109 { 00110 Menu *p0 = *it; 00111 if (p0->Handle() == h) 00112 { 00113 p0->OnMenuSelect(index, flags); 00114 break; 00115 } 00116 } 00117 }

void MenuHandler::Remove Menu  ) 
 

Definition at line 64 of file MenuHandler.cpp.

References m_menulist, and Remove().

Referenced by Remove(), and Menu::~Menu().

00065 { 00066 for (menu_v::iterator it = m_menulist.begin(); it != m_menulist.end(); it++) 00067 { 00068 Menu *p0 = *it; 00069 if (p0 == p) 00070 { 00071 m_menulist.erase(it); 00072 break; 00073 } 00074 } 00075 }

bool MenuHandler::Valid Menu  ) 
 

Definition at line 130 of file MenuHandler.cpp.

References D2, m_menulist, and Valid().

Referenced by OnCommand(), and Valid().

00131 { 00132 for (menu_v::iterator it = m_menulist.begin(); it != m_menulist.end(); it++) 00133 { 00134 Menu *p0 = *it; 00135 if (p0 == p) 00136 { 00137 return true; 00138 } 00139 } 00140 D2(fprintf(fil,"ptr %08lx is not valid\n",(unsigned long)p);) 00141 return false; 00142 }


Member Data Documentation

intmenu_m MenuHandler::m_id [private]
 

Definition at line 52 of file MenuHandler.h.

Referenced by get_next_id(), and OnCommand().

menu_v MenuHandler::m_menulist [private]
 

Definition at line 51 of file MenuHandler.h.

Referenced by Add(), OnInitMenu(), OnInitPopupMenu(), OnMenuSelect(), Remove(), and Valid().

int MenuHandler::m_next_id = 0 [static, private]
 

Definition at line 45 of file MenuHandler.cpp.

Referenced by get_next_id().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 22:42:40 2005 for Distributed URL Classification Tool by doxygen 1.3.7