OpendTect-6_4  6.4
uimenu.h
Go to the documentation of this file.
1 #ifndef uimenu_h
2 #define uimenu_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Lammertink
9  Date: 26/04/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uiaction.h"
17 #include "uibaseobject.h"
18 #include "separstr.h"
19 
20 class uiParent;
21 class uiPixmap;
22 
23 mFDQtclass(QAction)
24 mFDQtclass(QMenu)
25 mFDQtclass(QMenuBar)
26 
27 
28 
29 mExpClass(uiBase) uiMenuBar : public uiActionContainer, public uiBaseObject
30 {
31  friend class uiMainWinBody;
32  friend class uiDialogBody;
33 
34 public:
35 
36  void setSensitive(bool yn);
38  bool isSensitive() const;
39 
40  mQtclass(QWidget*) getWidget();
41  void clear() { removeAllActions(); }
42 
43 protected:
44  uiMenuBar(uiParent*,const char* nm);
45  uiMenuBar(uiParent*,const char* nm,
46  mQtclass(QMenuBar)*);
47  ~uiMenuBar();
48 
49  void doInsertMenu(mQtclass(QMenu)*,
50  mQtclass(QAction)* before);
51  void doInsertAction(mQtclass(QAction)*,
52  mQtclass(QAction)* before);
53  void doRemoveAction(mQtclass(QAction)*);
54  void doInsertSeparator(mQtclass(QAction)* before);
55  void doClear();
56 
57  mQtclass(QMenuBar)* qmenubar_;
58 };
59 
60 
65 mExpClass(uiBase) uiMenu : public uiActionContainer, public uiBaseObject
67 
68 public:
70  const char* iconnm=0);
71  uiMenu(const MenuItem&);
72  ~uiMenu();
73 
74  void addItems(const ObjectSet<MenuItem>&);
75  bool isStandAlone() const { return !submenuaction_; }
80  bool isCheckable() const;
81  void setCheckable(bool);
82 
83  bool isEnabled() const;
84  void setEnabled(bool);
85 
86  bool isChecked() const;
87  void setChecked(bool);
88 
96  int exec();
97 
98  void setText(const uiString&);
99  const uiString& text() const;
100  void clear() { removeAllActions(); }
101 
102  void setIcon(const uiIcon&);
103  void setIcon(const char* iconnm);
104  const char* getIconName() const;
105 
106  mQtclass(QMenu)* getQMenu() { return qmenu_; }
107  mQtclass(QWidget*) getWidget();
108 
109 private:
110  friend class uiAction;
111 
112  void setAction(uiAction*);
113 
116 
117  mQtclass(QMenu)* qmenu_;
118  uiAction* submenuaction_;
119  uiAction* interceptaction_;
121 
122  void doInsertMenu(mQtclass(QMenu)*,
123  mQtclass(QAction)* before);
124  void doInsertAction(mQtclass(QAction)*,
125  mQtclass(QAction)* before);
126  void doInsertSeparator(mQtclass(QAction)* before);
127  void doRemoveAction(mQtclass(QAction)*);
128  void doClear();
129  void useStyleSheet();
130 
131 public:
133  static void addInterceptor(const CallBack&);
134  static void removeInterceptor(const CallBack&);
135  void doIntercept(bool yn,uiAction* activateitm = 0);
136 
137  uiMenu(uiParent*,
138  const uiString& txt=uiString::emptyString(),
139  const char* iconfilenm=0);
140 };
141 
142 #endif
mQtclass(QMenu)*getQMenu()
Definition: uimenu.h:106
#define mExpClass(module)
Definition: commondefs.h:160
#define mQtclass(cls)
Definition: commondefs.h:229
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
void clear(std::ios &)
static const uiString & emptyString()
Definition: uistring.h:109
Definition: uistring.h:89
Definition: uiparent.h:26
uiString text_
Definition: uimenu.h:114
Definition: menuhandler.h:76
bool dointercept_
Definition: uimenu.h:120
BufferString iconnm_
Definition: uimenu.h:115
#define mFDQtclass(cls)
Definition: commondefs.h:228
Definition: uimenu.h:65
Off-screen pixel-based paint device.
Definition: uipixmap.h:34
uiAction * submenuaction_
Definition: uimenu.h:118
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
uiAction * interceptaction_
Definition: uimenu.h:119
void clear()
Definition: uimenu.h:100
bool isStandAlone() const
Definition: uimenu.h:75
CallBacks object-oriented (object + method).
Definition: callback.h:57
Definition: uiaction.h:152

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019