OpendTect-6_4  6.4
uicombobox.h
Go to the documentation of this file.
1 #ifndef uicombobox_h
2 #define uicombobox_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: 25/05/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 #include "uibasemod.h"
15 #include "uigroup.h"
16 #include "userinputobj.h"
17 #include "enums.h"
18 
19 class uiLabel;
20 class uiComboBoxBody;
21 class BufferStringSet;
22 
32 mExpClass(uiBase) uiComboBox : public uiObject, public UserInputObjImpl<int>
33 {
34 public:
35 
36  uiComboBox(uiParent*,const char* nm);
38  const char* nm);
40  const char* nm);
41  uiComboBox(uiParent*,const char**,const char* nm);
42  uiComboBox(uiParent*,const uiString*,const char* nm);
45  uiComboBox(uiParent*,const EnumDef&,const char* nm);
47  virtual ~uiComboBox();
48 
49  virtual void setReadOnly(bool yn=true);
50  virtual bool isReadOnly() const;
51  void setEditable(bool yn);
52  bool isEditable() const;
53 
54  int size() const;
55  inline bool isEmpty() const { return size() == 0; }
56  void setEmpty();
57  bool isPresent(const char*) const;
58  int indexOf(const char*) const;
59 
60  const char* text() const;
61  void setText(const char*);
62  int currentItem() const;
63  void setCurrentItem(int);
64  void setCurrentItem(const char*);
65  void setCurrentItem( const FixedString& fs )
66  { setCurrentItem( fs.str() ); }
67  virtual void addItem(const uiString&);
68  void addItem(const uiString&,int id);
69  void addItems(const BufferStringSet&);
70  void addItems(const uiStringSet&);
71  void addSeparator();
72  void insertItem(const uiString&,int index=-1,int id=-1);
73  void insertItem(const uiPixmap&,const uiString&,
74  int index=-1,int id=-1);
75 
76  const char* textOfItem(int) const;
77  void getItems(BufferStringSet&) const;
78 
79  void setItemText(int,const uiString&);
80  void setPixmap(int index,const uiPixmap&);
81  void setIcon(int index,const char* icon_identifier);
82 
83  void setItemID(int index,int id);
84  int currentItemID() const;
85  int getItemID(int index) const;
86  int getItemIndex(int id) const;
87 
90 
91 protected:
92 
93  virtual void setvalue_( int i ) { setCurrentItem(i); }
94  virtual int getvalue_() const { return currentItem(); }
95 
96  virtual bool notifyUpdateRequested_(const CallBack&) {return false;}
97  virtual bool notifyValueChanging_(const CallBack&) {return false;}
98  virtual bool notifyValueChanged_( const CallBack& cb )
99  { selectionChanged.notify(cb); return true; }
100  void translateText();
101 private:
102 
107 
109 
110  uiComboBoxBody* body_;
111  uiComboBoxBody& mkbody(uiParent*,const char*);
112  void adjustWidth(const uiString&);
115 
116 public:
117 
118  void setToolTip( const uiString& tt )
119  { uiObject::setToolTip(tt); }
120 
121  virtual bool update_( const DataInpSpec& spec );
122  void getItemSize(int,int& h,int& w) const;
123 
124  void notifyHandler(bool selectionchanged);
125 
126  bool handleLongTabletPress();
127  void popupVirtualKeyboard(int globalx=-1,int globaly=-1);
128 
129 };
130 
131 
132 
134 {
135 public:
136  uiLabeledComboBox(uiParent*,const uiString& lbl,
137  const char* nm=0);
139  const uiString& lbl,const char* nm=0);
140  uiLabeledComboBox(uiParent*,const char**,
141  const uiString& lbl,const char* nm=0);
143  const uiString& lbl,const char* nm=0);
145  const uiString& lbl,const char* nm=0);
146 
147  uiComboBox* box() { return cb_; }
148  uiLabel* label() { return labl_; }
149 
150 
151 protected:
152 
155 
156 };
157 
158 #endif
Definition: uigroup.h:54
#define mExpClass(module)
Definition: commondefs.h:160
const char * str() const
Definition: odstring.h:48
bool isPresent(const BufferString *b) const
Definition: bufstringset.h:42
uiComboBox * box()
Definition: uicombobox.h:147
void setToolTip(const uiString &)
OD::String that holds an existing text string.
Definition: fixedstring.h:29
int oldnritems_
Definition: uicombobox.h:103
The base class for most UI elements.
Definition: uiobj.h:38
bool isEmpty() const
Definition: uicombobox.h:55
Combo box.
Definition: uicombobox.h:32
Definition: uistring.h:89
Definition: uiparent.h:26
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
uiLabel * labl_
Definition: uicombobox.h:154
TypeSet< int > itemids_
Definition: uicombobox.h:105
size_type size() const
Definition: objectset.h:50
int oldcuritem_
Definition: uicombobox.h:104
void setToolTip(const uiString &tt)
Definition: uicombobox.h:118
Specification of input characteristics.
Definition: datainpspec.h:89
BufferString rettxt_
Definition: uicombobox.h:108
void setCurrentItem(const FixedString &fs)
Definition: uicombobox.h:65
virtual bool notifyValueChanged_(const CallBack &cb)
return false if not available
Definition: uicombobox.h:98
void setEmpty()
Definition: odset.h:46
virtual int getvalue_() const
Definition: uicombobox.h:94
void notify(const CallBack &, bool first=false)
const EnumDef * enumdef_
Definition: uicombobox.h:114
virtual void setvalue_(int i)
Definition: uicombobox.h:93
Off-screen pixel-based paint device.
Definition: uipixmap.h:34
Definition: uicombobox.h:133
int curwidth_
Definition: uicombobox.h:113
uiLabel * label()
Definition: uicombobox.h:148
uiComboBoxBody * body_
Definition: uicombobox.h:110
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: uilabel.h:24
Notifier< uiComboBox > editTextChanged
Definition: uicombobox.h:88
virtual bool notifyValueChanging_(const CallBack &)
return false if not available
Definition: uicombobox.h:97
uiStringSet itemstrings_
Definition: uicombobox.h:106
Definition: uistring.h:218
Notifier< uiComboBox > selectionChanged
Definition: uicombobox.h:89
CallBacks object-oriented (object + method).
Definition: callback.h:57
Holds data pertinent to a certain enum. It does not know the enum values themselves, but treat them as integers.
Definition: enums.h:45
virtual bool notifyUpdateRequested_(const CallBack &)
Definition: uicombobox.h:96
Definition: userinputobj.h:83
uiComboBox * cb_
Definition: uicombobox.h:153

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