OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scenetooltoggle.hpp
Go to the documentation of this file.
1 #ifndef CSV_WIDGET_SCENETOOL_TOGGLE_H
2 #define CSV_WIDGET_SCENETOOL_TOGGLE_H
3 
4 #include "scenetool.hpp"
5 
6 #include <map>
7 
8 class QHBoxLayout;
9 class QRect;
10 
11 namespace CSVWidget
12 {
13  class SceneToolbar;
14  class PushButton;
15 
17  class SceneToolToggle : public SceneTool
18  {
19  Q_OBJECT
20 
21  struct ButtonDesc
22  {
23  unsigned int mMask;
24  std::string mSmallIcon;
25  QString mName;
26  int mIndex;
27  };
28 
29  std::string mEmptyIcon;
31  QHBoxLayout *mLayout;
32  std::map<PushButton *, ButtonDesc> mButtons; // widget, id
34  int mIconSize;
35  QString mToolTip;
37 
38  void adjustToolTip();
39 
40  void adjustIcon();
41 
42  QRect getIconBox (int index) const;
43 
44  public:
45 
46  SceneToolToggle (SceneToolbar *parent, const QString& toolTip,
47  const std::string& emptyIcon);
48 
49  virtual void showPanel (const QPoint& position);
50 
57  void addButton (const std::string& icon, unsigned int mask,
58  const std::string& smallIcon, const QString& name, const QString& tooltip = "");
59 
60  unsigned int getSelectionMask() const;
61 
63  void setSelectionMask (unsigned int selection);
64 
65  signals:
66 
67  void selectionChanged();
68 
69  private slots:
70 
71  void selected();
72  };
73 }
74 
75 #endif
void addButton(const std::string &icon, unsigned int mask, const std::string &smallIcon, const QString &name, const QString &tooltip="")
Definition: scenetooltoggle.cpp:138
QString mName
Definition: scenetooltoggle.hpp:25
static const struct @2 signals[]
QHBoxLayout * mLayout
Definition: scenetooltoggle.hpp:31
std::map< PushButton *, ButtonDesc > mButtons
Definition: scenetooltoggle.hpp:32
std::string mSmallIcon
Definition: scenetooltoggle.hpp:24
unsigned int getSelectionMask() const
Definition: scenetooltoggle.cpp:167
Definition: pushbutton.hpp:13
void selected()
Definition: scenetooltoggle.cpp:189
QString mToolTip
Definition: scenetooltoggle.hpp:35
QWidget * mPanel
Definition: scenetooltoggle.hpp:30
void adjustIcon()
Definition: scenetooltoggle.cpp:41
void setSelectionMask(unsigned int selection)
Definition: scenetooltoggle.cpp:179
Definition: scenetooltoggle.hpp:21
std::string mEmptyIcon
Definition: scenetooltoggle.hpp:29
PushButton * mFirst
Definition: scenetooltoggle.hpp:36
Tool base class.
Definition: scenetool.hpp:11
int mIconSize
Definition: scenetooltoggle.hpp:34
int mIndex
Definition: scenetooltoggle.hpp:26
virtual void showPanel(const QPoint &position)
Definition: scenetooltoggle.cpp:129
unsigned int mMask
Definition: scenetooltoggle.hpp:23
QRect getIconBox(int index) const
Definition: scenetooltoggle.cpp:67
void adjustToolTip()
Definition: scenetooltoggle.cpp:13
Definition: scenetoolbar.hpp:12
int mButtonSize
Definition: scenetooltoggle.hpp:33
Multi-Toggle tool.
Definition: scenetooltoggle.hpp:17
SceneToolToggle(SceneToolbar *parent, const QString &toolTip, const std::string &emptyIcon)
Definition: scenetooltoggle.cpp:115
const char * name
Definition: crashcatcher.cpp:59