OpendTect-6_4  6.4
uispinbox.h
Go to the documentation of this file.
1 #ifndef uispinbox_h
2 #define uispinbox_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: 01/02/2001
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uiobj.h"
17 #include "uigroup.h"
18 #include "ranges.h"
19 
20 class uiSpinBoxBody;
21 class uiLabel;
22 
23 
24 mExpClass(uiBase) uiSpinBox : public uiObject
26 friend class uiSpinBoxBody;
27 
28 public:
29  uiSpinBox(uiParent*,int nrdecimals=0,
30  const char* nm="SpinBox");
31  ~uiSpinBox();
32 
33  void setNrDecimals(int);
34  void setAlpha(bool);
35  bool isAlpha() const;
36 
37  void setSpecialValueText(const char*); // First entry
38 
39  void setValue(int);
40  void setValue(float);
41  void setValue(double);
42  void setValue(const char*);
43 
44  int getIntValue() const;
45  double getDValue() const;
46  float getFValue() const;
47  bool getBoolValue() const;
48  const char* text() const;
49 
50  void setInterval( int start, int stop, int s=1 )
51  { setInterval( StepInterval<int>(start,stop,s) ); }
52  void setInterval( const Interval<int>& i, int s=1 )
53  { setInterval( StepInterval<int>(i.start,i.stop,s) ); }
54  void setInterval(const StepInterval<int>&);
55  StepInterval<int> getInterval() const;
56 
57  void setInterval( float start, float stop, float s=1 )
58  { setInterval(StepInterval<float>(start,stop,s)); }
59  void setInterval(const StepInterval<float>&);
60  StepInterval<float> getFInterval() const;
61 
62  void setInterval( double start, double stop, double s=1 )
63  { setInterval(StepInterval<double>(start,stop,s)); }
64  void setInterval(const StepInterval<double>&);
65 
66  void setMinValue(int);
67  void setMinValue(float);
68  void setMinValue( double d ) { setMinValue( (float)d ); }
69  int minValue() const;
70  float minFValue() const;
71 
72  void setMaxValue(int);
73  void setMaxValue(float);
74  void setMaxValue(double);
75  int maxValue() const;
76  float maxFValue() const;
77 
78  void setStep(int,bool snap_cur_value=false);
79  void setStep(float,bool snap_cur_value=false);
80  void setStep(double d,bool snap_cur_value=false );
81  float fstep() const;
82  int step() const;
83 
84  void stepBy( int nrsteps );
85 
86  uiString prefix() const;
87  void setPrefix(const uiString&);
88  uiString suffix() const;
89  void setSuffix(const uiString&);
90  void doSnap( bool yn ) { dosnap_ = yn; }
91 
92  void setKeyboardTracking(bool);
93  bool keyboardTracking() const;
94  void setFocusChangeTrigger(bool);
95  bool focusChangeTrigger() const;
96 
97  bool handleLongTabletPress();
98  void popupVirtualKeyboard(int globalx=-1,int globaly=-1);
99 
102 
103  void notifyHandler(bool editingfinished);
104 
105  void translateText();
106 private:
107 
108  float oldvalue_;
109 
112  uiSpinBoxBody* body_;
113  uiSpinBoxBody& mkbody(uiParent*, const char*);
114 
115  bool dosnap_;
118  void snapToStep(CallBacker*);
119 
120 public:
121 // deprecated, do not use
122  /*mDeprecated*/ int getValue() const { return getIntValue(); }
123  /*mDeprecated*/ float getfValue() const { return getFValue(); }
124  /*mDeprecated*/ double getdValue() const { return getDValue(); }
125 };
126 
127 
130 public:
132  int nrdecimals=0,const char* nm=0);
133 
134  uiSpinBox* box() { return sb_; }
135  const uiSpinBox* box() const { return sb_; }
136  uiLabel* label() { return lbl_; }
137 
138 protected:
139 
142 };
143 
144 #endif
Definition: uigroup.h:54
#define mExpClass(module)
Definition: commondefs.h:160
float getfValue() const
Definition: uispinbox.h:123
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
uiLabel * label()
Definition: uispinbox.h:136
const uiSpinBox * box() const
Definition: uispinbox.h:135
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
void setInterval(int start, int stop, int s=1)
Definition: uispinbox.h:50
void setInterval(float start, float stop, float s=1)
Definition: uispinbox.h:57
int getValue() const
Definition: uispinbox.h:122
mODTextTranslationClass(uiLabeledSpinBox) public uiSpinBox * box()
Definition: uispinbox.h:134
The base class for most UI elements.
Definition: uiobj.h:38
double getdValue() const
Definition: uispinbox.h:124
void setMinValue(double d)
Definition: uispinbox.h:68
Definition: uistring.h:89
Definition: uiparent.h:26
uiString suffix_
Definition: uispinbox.h:111
uiLabel * lbl_
Definition: uispinbox.h:141
Definition: uispinbox.h:128
void setInterval(const Interval< int > &i, int s=1)
Definition: uispinbox.h:52
bool focuschgtrigger_
Definition: uispinbox.h:117
Definition: uispinbox.h:24
void setInterval(double start, double stop, double s=1)
Definition: uispinbox.h:62
uiSpinBox * sb_
Definition: uispinbox.h:140
T stop
Definition: ranges.h:93
uiSpinBoxBody * body_
Definition: uispinbox.h:112
Definition: uilabel.h:24
float oldvalue_
Definition: uispinbox.h:108
Notifier< uiSpinBox > valueChanging
Definition: uispinbox.h:101
T start
Definition: ranges.h:92
uiString prefix_
Definition: uispinbox.h:110
void doSnap(bool yn)
Definition: uispinbox.h:90
bool dosnap_
Definition: uispinbox.h:115
Notifier< uiSpinBox > valueChanged
Definition: uispinbox.h:100

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