- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

umenumanager.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/umenumanager.hpp 00008 begin : Sun Dec 14 2003 00009 $Id: umenumanager.hpp,v 1.6 2005/06/21 09:27:03 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 #ifndef UMENUMANAGER_HPP 00029 #define UMENUMANAGER_HPP 00030 00031 #include "uobject.hpp" 00032 00033 #include <vector> 00034 00035 namespace ufo { 00036 00037 class UMenuItem; 00038 class UMenu; 00039 class UEvent; 00040 00041 class UKeyEvent; 00042 class UMouseEvent; 00043 00049 class UFO_EXPORT UMenuManager : public UObject { 00050 UFO_DECLARE_DYNAMIC_CLASS(UMenuManager) 00051 public: 00052 UMenuManager(); 00053 00054 virtual void highlightItem(UMenuItem * item); 00055 virtual void activateItem(UMenuItem * item); 00056 00057 virtual void clearPath(); 00058 00059 virtual void processKeyEvent(UKeyEvent * e); 00060 virtual void processMouseEvent(UMouseEvent * e); 00061 00062 public: // Public static methods 00063 static void setMenuManager(UMenuManager * manager); 00064 static UMenuManager * getMenuManager(); 00065 00066 protected: // Private slots 00070 std::vector<UMenu*>::iterator getIteratorOfSameHierarchy(UMenuItem * item); 00072 void clearPathFrom(const std::vector<UMenu*>::iterator & iter); 00074 void closeMenuPopups(UEvent * e); 00075 00076 void openMenu(UMenu * menu); 00077 00078 void recalcPathWithLeaf(UMenuItem * item); 00079 00080 void highlightNextSibling(UMenuItem * item); 00081 void highlightPreviousSibling(UMenuItem * item); 00082 void highlightNextTopLevel(UMenuItem * item); 00083 void highlightPreviousTopLevel(UMenuItem * item); 00084 00085 private: 00086 std::vector<UMenu*> m_menuPath; 00087 UMenuItem * m_currentItem; 00088 00089 private: // Private static attributes 00090 static UMenuManager * sm_menuManager; 00091 }; 00092 00093 // 00094 // inline implementation 00095 // 00096 00097 inline UMenuManager * 00098 UMenuManager::getMenuManager() { 00099 return sm_menuManager; 00100 } 00101 00102 } // namespace ufo 00103 00104 #endif // UMENUMANAGER_HPP

The libUFO Project - written by Johannes Schmidt