OpendTect-6_4  6.4
uitoolbutton.h
Go to the documentation of this file.
1 #ifndef uitoolbutton_h
2 #define uitoolbutton_h
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: Nov 2010
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "uibasemod.h"
15 #include "uibutton.h"
16 #include "uistrings.h"
17 
18 class uiToolButtonBody;
19 class uiToolButtonSetup;
20 
21 
22 mExpClass(uiBase) uiToolButton : public uiButton
23 {
24 public:
25 
27  UpArrow, DownArrow, LeftArrow, RightArrow };
28  enum PopupMode { DelayedPopup, MenuButtonPopup, InstantPopup };
29 
31  const uiToolButtonSetup&);
32  uiToolButton(uiParent*,const char* filenm,
33  const uiString& tooltip,
34  const CallBack&);
36  const uiString& tooltip,
37  const CallBack&);
38  ~uiToolButton();
39 
40  static uiToolButton* getStd(uiParent*,OD::StdActionType,
41  const CallBack&,const uiString& ttip);
42 
43  bool isOn() const;
44  void setOn(bool yn=true);
45 
46  void setToggleButton(bool yn=true);
47  bool isToggleButton() const;
48 
49  void setArrowType(ArrowType);
50 
51  void setShortcut(const char*);
52  void setMenu(uiMenu*,PopupMode=MenuButtonPopup);
54 
55  const uiMenu* menu() const { return uimenu_; }
56 
57  void setID( int i ) { id_ = i; }
58  int id() const { return id_; }
59 
60  void click();
61 
62 private:
63 
64  uiToolButtonBody* tbbody_;
65  uiToolButtonBody& mkbody(uiParent*,const char* icon_identifier,
66  const uiString&);
67 
68  int id_; // Used by toolbar
69 
71 };
72 
73 
74 #define mDefuiTBSUMemb(typ,memb) mDefSetupClssMemb(uiToolButtonSetup,typ,memb)
75 
77 {
78 public:
79  uiToolButtonSetup( const char* ic, const uiString& tt,
80  const CallBack& c , const uiString&
82  : icid_(ic)
83  , cb_(c)
84  , tooltip_(tt)
85  , istoggle_(false)
86  , ison_(false)
87  , isimmediate_(false)
88  , arrowtype_(uiToolButton::NoArrow)
89  , name_(!nm.isEmpty() ? nm : tt){}
90 
92  mDefuiTBSUMemb(uiString,tooltip);
94 
95  mDefuiTBSUMemb(bool,istoggle);
96  mDefuiTBSUMemb(bool,ison);
97  mDefuiTBSUMemb(bool,isimmediate);
99  mDefuiTBSUMemb(BufferString,shortcut);
100  mDefuiTBSUMemb(uiString,name);
101 
102  uiButton* getButton(uiParent*,bool forcetoolbutton=false) const;
105  uiPushButton* getPushButton(uiParent*,bool withicon=true) const;
106 
107 };
108 
109 #endif
#define mExpClass(module)
Definition: commondefs.h:160
uiPushButton * getPushButton(uiParent *, bool withicon=true) const
PopupMode
Definition: uitoolbutton.h:28
uiButton * getButton(uiParent *, bool forcetoolbutton=false) const
pushbutton if name_ != tooltip_ and !istoggle_
is the base class for all buttons.
Definition: uibutton.h:83
Definition: uitoolbutton.h:26
Definition: uistring.h:89
Definition: uiparent.h:26
uiToolButtonBody * tbbody_
Definition: uitoolbutton.h:64
ArrowType
Definition: uitoolbutton.h:26
const uiMenu * menu() const
Definition: uitoolbutton.h:55
Definition: uitoolbutton.h:76
uiToolButtonSetup(const char *ic, const uiString &tt, const CallBack &c, const uiString &nm=uiStrings::sEmptyString())
Definition: uitoolbutton.h:79
bool isOn(int flag=0xffff)
int id() const
Definition: uitoolbutton.h:58
StdActionType
Definition: oduicommon.h:61
Definition: uimenu.h:65
uiMenu * uimenu_
Definition: uitoolbutton.h:70
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
int id_
Definition: uitoolbutton.h:68
void setID(int i)
Definition: uitoolbutton.h:57
Definition: uitoolbutton.h:22
Definition: uitoolbutton.h:27
static uiString sEmptyString()
Definition: uistrings.h:286
bool isEmpty(const NLAModel *mdl)
uiToolButton * getToolButton(uiParent *) const
CallBacks object-oriented (object + method).
Definition: callback.h:57
#define mDefuiTBSUMemb(typ, memb)
Definition: uitoolbutton.h:74

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