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

upopupmenu.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/widgets/upopupmenu.hpp 00008 begin : Wed May 30 2001 00009 $Id: upopupmenu.hpp,v 1.12 2005/05/21 15:19:47 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 UPOPUPMENU_HPP 00029 #define UPOPUPMENU_HPP 00030 00031 #include "uwidget.hpp" 00032 00033 namespace ufo { 00034 00035 class UMenuItem; 00036 class UPopup; 00037 00044 class UFO_EXPORT UPopupMenu : public UWidget { 00045 UFO_DECLARE_DYNAMIC_CLASS(UPopupMenu) 00046 UFO_UI_CLASS(UPopupMenuUI) 00047 public: 00048 UPopupMenu(); 00049 UPopupMenu(UWidget * invoker); 00050 00051 public: // hides | overrides UWidget 00055 virtual void setVisible(bool v); 00056 00057 public: // Public methods 00058 00060 void addSeparator(); 00061 00066 void setPopupLocation(const UPoint & pos); 00067 UPoint getPopupLocation() const; 00068 00070 virtual void setInvoker(UWidget * invoker); 00071 virtual UWidget * getInvoker() const; 00072 00073 public: // Public signals 00074 typedef USignal1<UPopupMenu*> MenuSignal; 00075 typedef USignal2<UPopupMenu*, UMenuItem*> MenuItemSignal; 00076 00078 MenuSignal & sigMenuAboutToOpen(); 00080 MenuSignal & sigMenuAboutToClose(); 00082 MenuItemSignal & sigMenuItemHighlight(); 00083 00084 protected: // Protected methods 00088 //void popupCloseSlot(UEvent * e); 00089 void popupCloseSlot(UPopup * popup); 00090 00091 private: 00092 UWidget * m_invoker; 00093 UPoint m_popupLocation; 00094 00098 USlot1<UPopup*> m_closeSlot; 00099 class UPopup * m_popup; 00100 private: // Private signals 00101 MenuSignal m_sigMenuAboutToOpen; 00102 MenuSignal m_sigMenuAboutToClose; 00103 MenuItemSignal m_sigMenuItemHighlight; 00104 }; 00105 00106 // 00107 // inline implementation 00108 // 00109 00110 inline UPopupMenu::MenuSignal & 00111 UPopupMenu::sigMenuAboutToOpen() { 00112 return m_sigMenuAboutToOpen; 00113 } 00114 00115 inline UPopupMenu::MenuSignal & 00116 UPopupMenu::sigMenuAboutToClose() { 00117 return m_sigMenuAboutToClose; 00118 } 00119 00120 inline UPopupMenu::MenuItemSignal & 00121 UPopupMenu::sigMenuItemHighlight() { 00122 return m_sigMenuItemHighlight; 00123 } 00124 00125 inline void 00126 UPopupMenu::setPopupLocation(const UPoint & pos) { 00127 m_popupLocation = pos; 00128 } 00129 00130 inline UPoint 00131 UPopupMenu::getPopupLocation() const { 00132 return m_popupLocation; 00133 } 00134 00135 00136 } // namespace ufo 00137 00138 #endif // UPOPUPMENU_HPP

The libUFO Project - written by Johannes Schmidt