00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
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:
00055
virtual void setVisible(
bool v);
00056
00057
public:
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:
00074
typedef USignal1<UPopupMenu*> MenuSignal;
00075
typedef USignal2<UPopupMenu*, UMenuItem*> MenuItemSignal;
00076
00078 MenuSignal & sigMenuAboutToOpen();
00080 MenuSignal & sigMenuAboutToClose();
00082 MenuItemSignal & sigMenuItemHighlight();
00083
00084
protected:
00088
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:
00101 MenuSignal m_sigMenuAboutToOpen;
00102 MenuSignal m_sigMenuAboutToClose;
00103 MenuItemSignal m_sigMenuItemHighlight;
00104 };
00105
00106
00107
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 }
00137
00138
#endif // UPOPUPMENU_HPP