logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

menu.cpp

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 
00008 
00009 #include "menu.h"
00010 
00011 namespace GUIToolkit {
00012 
00013 popupMenu::popupMenu(HWND hw) {
00014         //ItemCounter = 0;      
00015         hMenu = CreatePopupMenu(); hostHWND = hw; myEventHandler = 0;
00016 };
00017 popupMenu::~popupMenu() {DestroyMenu(hMenu);};
00018 
00019 
00020 void popupMenu::add(menuItem * item)
00021 {       
00022                 //item->ID = ++ItemCounter;
00023                 if (myEventHandler !=0) item->setEventHandler(myEventHandler);
00024                 AppendMenu(hMenu, MF_STRING, item->ID, item->Label.c_str());            
00025 }
00026 
00027 void popupMenu::showMenu()
00028 {
00029                         POINT pt;
00030                         GetCursorPos(&pt);
00031                         TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_TOPALIGN,pt.x,pt.y,0,hostHWND,NULL);
00032 }
00033 
00034 
00035 }; // end of namespace
00036 
00037   

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen