OpendTect-6_4  6.4
uiunitsel.h
Go to the documentation of this file.
1 #ifndef uiunitsel_h
2 #define uiunitsel_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Raman K Singh
9  Date: Feb 2010
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 
16 #include "uitoolsmod.h"
17 #include "uigroup.h"
18 #include "uistrings.h"
19 #include "propertyref.h"
20 
21 class uiComboBox;
22 class UnitOfMeasure;
23 
24 
38 mExpClass(uiTools) uiUnitSel : public uiGroup
39 {
40 public:
41 
42  mExpClass(uiTools) Setup
43  {
44  public:
45 
46  enum Mode { SymbolsOnly, NamesOnly, Full };
47 
49  const uiString labeltxt=
51  : ptype_(st)
52  , lbltxt_(mToUiStringTodo(labeltxt))
53  , mode_(Full)
54  , selproptype_(false)
55  , withnone_(false) {}
56 
58  mDefSetupMemb(uiString,lbltxt)
59  mDefSetupMemb(Mode,mode)
60  mDefSetupMemb(bool,selproptype)
61  mDefSetupMemb(bool,withnone)
62  };
63 
64  uiUnitSel(uiParent*,const Setup&);
66  uiUnitSel(uiParent*,const char* lbltxt=0);
68 
69  void setUnit(const UnitOfMeasure* uom=0);
70  void setUnit(const char*);
71  const UnitOfMeasure* getUnit() const;
72  const char* getUnitName() const;
73 
74  float getUserValue(float internalval) const;
75  double getUserValue(double internalval) const;
76  float getInternalValue(float uservalue) const;
77  double getInternalValue(double uservalue) const;
78 
79 
80  PropertyRef::StdType propType() const { return setup_.ptype_;}
82 
83  uiComboBox* inpFld() const { return inpfld_; }
84 
87 
88  void fillPar(IOPar&,const char* altkey=0) const;
89  bool usePar(const IOPar&,const char* altkey=0);
90 
91  const char* tblKey() const;
94  void setFallbackKey(const char*);
95  static IOPar& lastUsed();
97 
98 protected:
99 
100  Setup setup_;
103 
106 
107  void selChg( CallBacker* ) { selChange.trigger(); }
108  void propSelChg(CallBacker*);
109  void setPropFld(PropertyRef::StdType);
110  void setUnFld(const UnitOfMeasure*);
111  void update();
112  uiString getSelTxt(const UnitOfMeasure*) const;
113  const UnitOfMeasure* gtUnit() const;
114 
115 private:
116 
117  void init();
118 
119 };
120 
121 
122 #endif
Definition: uigroup.h:54
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
ObjectSet< const UnitOfMeasure > units_
Definition: uiunitsel.h:101
Selector for UnitOfMeasure&#39;s.
Definition: uiunitsel.h:38
Notifier< uiUnitSel > selChange
Definition: uiunitsel.h:85
void selChg(CallBacker *)
Definition: uiunitsel.h:107
PropertyRef::StdType propType() const
Definition: uiunitsel.h:80
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
uiComboBox * propfld_
Definition: uiunitsel.h:105
bool init()
uiComboBox * inpFld() const
Definition: uiunitsel.h:83
Combo box.
Definition: uicombobox.h:32
Definition: uistring.h:89
Definition: uiparent.h:26
Notifier< uiUnitSel > propSelChange
Definition: uiunitsel.h:86
uiComboBox * inpfld_
Definition: uiunitsel.h:104
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Definition: uiunitsel.h:42
Setup setup_
Definition: uiunitsel.h:100
void trigger(T &t)
Definition: callback.h:258
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
Setup(PropertyRef::StdType st, const uiString labeltxt=uiStrings::sEmptyString())
Definition: uiunitsel.h:48
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: uiunitsel.h:46
BufferString tblkey_
Definition: uiunitsel.h:102
Mode
Definition: uiunitsel.h:46
StdType
Definition: propertyref.h:46
static uiString sEmptyString()
Definition: uistrings.h:286
#define mToUiStringTodo(i)
Definition: uistring.h:303
void setPropType(PropertyRef::StdType t)
Definition: unitofmeasure.h:60
Unit of Measure.
Definition: unitofmeasure.h:35

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