OpendTect-6_4  6.4
uislider.h
Go to the documentation of this file.
1 #ifndef uislider_h
2 #define uislider_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 "uigroup.h"
17 #include "uiobj.h"
18 #include "uistring.h"
19 
20 class LinScaler;
21 
22 class uiLabel;
23 class uiLineEdit;
24 class uiSliderBody;
25 class uiSpinBox;
26 
27 
28 mExpClass(uiBase) uiSliderObj : public uiObject
29 {
30 public:
31  uiSliderObj(uiParent*,const char* nm);
32  ~uiSliderObj();
33 
34  uiSliderBody& body() { return *body_; }
35 
36 private:
37  uiSliderBody* body_;
38  uiSliderBody& mkbody(uiParent*,const char*);
39 };
40 
41 
42 mExpClass(uiBase) uiSlider : public uiGroup
43 {
44 public:
45  mExpClass(uiBase) Setup
46  {
47  public:
49  : lbl_(l)
50  , withedit_(false)
51  , nrdec_(0)
52  , logscale_(false)
53  , isvertical_(false)
54  , sldrsize_(200)
55  , isinverted_(false)
56  {}
57 
58  mDefSetupMemb(bool,withedit)
59  mDefSetupMemb(bool,logscale)
60  mDefSetupMemb(bool,isvertical)
61  mDefSetupMemb(int,nrdec)
62  mDefSetupMemb(int,sldrsize)
63  mDefSetupMemb(bool,isinverted)
65  };
66 
67  uiSlider(uiParent*,const Setup&,const char* nm=0);
68  ~uiSlider();
69 
70  enum TickPosition { NoMarks=0, Above=1, Left=Above, Below=2,
71  Right=Below, Both=3 };
72 
73  void processInput();
74  void setToolTip(const uiString&);
75  void setText(const char*);
76  const char* text() const;
77 
78  void setValue(int);
79  void setValue(float);
80  int getIntValue() const;
81  float getFValue() const;
82  float editValue() const;
83 
84  void setMinValue(float);
85  float minValue() const;
86  void setMaxValue(float);
87  float maxValue() const;
88  void setStep(float);
89  void setScale(float fact,float constant);
90  float step() const;
91 
92  void setInterval(const StepInterval<int>&);
93  void setInterval(int start,int stop,int step=1);
94  void setInterval(const StepInterval<float>&);
95  void setInterval(float start,float stop,float step);
96  void getInterval(StepInterval<float>&) const;
97  void setLinearScale(double,double);
98 
99  void setTickMarks(TickPosition);
100  TickPosition tickMarks() const;
101  void setTickStep(int);
102  int tickStep() const;
103  void setOrientation(OD::Orientation);
104  OD::Orientation getOrientation() const;
105 
106  void setInverted(bool);
107  bool isInverted() const;
108  void setInvertedControls(bool);
109  bool hasInvertedControls() const;
110 
111  bool isLogScale() { return logscale_; }
112 
117 
118  float getLinearFraction() const;
119  void setLinearFraction(float fraction);
120 
121  const uiLabel* label() const { return lbl_; }
122  uiLabel* label() { return lbl_; }
123 
124  uiSliderObj* slider() { return slider_; }
125 
126 private:
127 
132 
135  bool logscale_;
136 
137  void init(const Setup&,const char*);
138 
139  void sliderMove(CallBacker*);
140  void editRetPress(CallBacker*);
141 
142  float userValue(int) const;
143  int sliderValue(float) const;
144 
145 public:
146  /*mDeprecated*/ float getValue() const { return getFValue(); }
147 };
148 
149 #endif
Definition: uigroup.h:54
#define mExpClass(module)
Definition: commondefs.h:160
uiSliderObj * slider_
Definition: uislider.h:128
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
uiLabel * label()
Definition: uislider.h:122
int maxValue() const
Definition: uislider.h:42
BufferString result_
Definition: uislider.h:133
uiSliderObj * slider()
Definition: uislider.h:124
void setToolTip(const uiString &)
void setInterval(int start, int stop, int s=1)
Definition: uispinbox.h:50
void setMinValue(int)
void setMaxValue(int)
bool logscale_
Definition: uislider.h:135
bool init()
void setValue(int)
TickPosition
Definition: uislider.h:70
int step() const
static const uiString & emptyString()
Definition: uistring.h:109
Setup(const uiString &l=uiString::emptyString())
Definition: uislider.h:48
uiSliderBody & body()
Definition: uislider.h:34
The base class for most UI elements.
Definition: uiobj.h:38
Definition: uistring.h:89
int minValue() const
Definition: uiparent.h:26
Notifier< uiSlider > sliderPressed
Definition: uislider.h:115
int getIntValue() const
Notifier< uiSlider > sliderReleased
Definition: uislider.h:116
float getFValue() const
Notifier< uiSlider > sliderMoved
Definition: uislider.h:114
Definition: uislider.h:28
bool isLogScale()
Definition: uislider.h:111
Definition: uislider.h:45
uiSpinBox * inteditfld_
Definition: uislider.h:131
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
StepInterval< int > getInterval() const
uiLabel * lbl_
Definition: uislider.h:129
Definition: uispinbox.h:24
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
uiSpinBoxBody * body_
Definition: uispinbox.h:112
uiLineEdit * editfld_
Definition: uislider.h:130
Definition: uilabel.h:24
uiSpinBoxBody & mkbody(uiParent *, const char *)
Notifier< uiSlider > valueChanged
Definition: uislider.h:113
float getValue() const
Definition: uislider.h:146
Definition: uilineedit.h:51
const char * text() const
uiSliderBody * body_
Definition: uislider.h:37
Linear scaling.
Definition: scaler.h:55
LinScaler * scaler_
Definition: uislider.h:134
void setStep(int, bool snap_cur_value=false)
const uiLabel * label() const
Definition: uislider.h:121
Orientation
Fundamental orientation in 2D UIs.
Definition: oduicommon.h:23

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