OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scenetoolmode.hpp
Go to the documentation of this file.
1 #ifndef CSV_WIDGET_SCENETOOL_MODE_H
2 #define CSV_WIDGET_SCENETOOL_MODE_H
3 
4 #include "scenetool.hpp"
5 
6 #include <map>
7 
8 class QHBoxLayout;
9 class QMenu;
10 class QEvent;
11 
12 namespace CSVWidget
13 {
14  class SceneToolbar;
15  class ModeButton;
16 
18  class SceneToolMode : public SceneTool
19  {
20  Q_OBJECT
21 
23  QHBoxLayout *mLayout;
24  std::map<ModeButton *, std::string> mButtons; // widget, id
26  int mIconSize;
27  QString mToolTip;
31 
32  void adjustToolTip (const ModeButton *activeMode);
33 
34  virtual void contextMenuEvent (QContextMenuEvent *event);
35 
43  virtual bool createContextMenu (QMenu *menu);
44 
45  void setButton (std::map<ModeButton *, std::string>::iterator iter);
46 
47  protected:
48 
49  bool event(QEvent* event);
50 
51  public:
52 
53  SceneToolMode (SceneToolbar *parent, const QString& toolTip);
54 
55  virtual void showPanel (const QPoint& position);
56 
57  void addButton (const std::string& icon, const std::string& id,
58  const QString& tooltip = "");
59 
61  void addButton (ModeButton *button, const std::string& id);
62 
65 
67  std::string getCurrentId() const;
68 
70  void setButton (const std::string& id);
71 
72  signals:
73 
74  void modeChanged (const std::string& id);
75 
76  private slots:
77 
78  void selected();
79  };
80 }
81 
82 #endif
static const struct @2 signals[]
QString mToolTip
Definition: scenetoolmode.hpp:27
virtual void showPanel(const QPoint &position)
Definition: scenetoolmode.cpp:76
ModeButton * mCurrent
Definition: scenetoolmode.hpp:29
Mode selector tool.
Definition: scenetoolmode.hpp:18
int mIconSize
Definition: scenetoolmode.hpp:26
virtual void contextMenuEvent(QContextMenuEvent *event)
Definition: scenetoolmode.cpp:13
QWidget * mPanel
Definition: scenetoolmode.hpp:22
SceneToolMode(SceneToolbar *parent, const QString &toolTip)
Definition: scenetoolmode.cpp:63
Definition: pushbutton.hpp:13
SceneToolbar * mToolbar
Definition: scenetoolmode.hpp:30
Specialist PushButton of Type_Mode for use in SceneToolMode.
Definition: modebutton.hpp:13
void adjustToolTip(const ModeButton *activeMode)
Definition: scenetoolmode.cpp:28
bool event(QEvent *event)
Definition: scenetoolmode.cpp:137
void addButton(const std::string &icon, const std::string &id, const QString &tooltip="")
Definition: scenetoolmode.cpp:85
void setButton(std::map< ModeButton *, std::string >::iterator iter)
Definition: scenetoolmode.cpp:42
ModeButton * getCurrent()
Will return a 0-pointer only if the mode does not have any buttons yet.
Definition: scenetoolmode.cpp:116
int mButtonSize
Definition: scenetoolmode.hpp:25
Tool base class.
Definition: scenetool.hpp:11
std::string getCurrentId() const
Must not be called if there aren't any buttons yet.
Definition: scenetoolmode.cpp:121
virtual bool createContextMenu(QMenu *menu)
Definition: scenetoolmode.cpp:20
void modeChanged(const std::string &id)
Definition: scenetoolbar.hpp:12
PushButton * mFirst
Definition: scenetoolmode.hpp:28
void selected()
Definition: scenetoolmode.cpp:147
QHBoxLayout * mLayout
Definition: scenetoolmode.hpp:23
std::map< ModeButton *, std::string > mButtons
Definition: scenetoolmode.hpp:24