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

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