OpendTect-6_4  6.4
uilineedit.h
Go to the documentation of this file.
1 #ifndef uilineedit_h
2 #define uilineedit_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: 21/9/2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uiobj.h"
17 #include "userinputobj.h"
18 
19 class uiLineEditBody;
20 
22 {
23 public:
25  : bottom_(-mUdf(int)), top_(mUdf(int)) {}
26  uiIntValidator( int bot, int top )
27  : bottom_(bot), top_(top) {}
28 
29  int bottom_;
30  int top_;
31 };
32 
33 
35 {
36 public:
38  : bottom_(-mUdf(float)), top_(mUdf(float))
39  , nrdecimals_(1000), scnotation_(true) {}
40  uiFloatValidator( float bot, float top )
41  : bottom_(bot), top_(top)
42  , nrdecimals_(1000), scnotation_(true) {}
43 
44  float bottom_;
45  float top_;
47  bool scnotation_; // If true, ScientificNotation is used
48 };
49 
50 
51 mExpClass(uiBase) uiLineEdit : public UserInputObjImpl<const char*>,
52  public uiObject
53 {
54 public:
56  // insted of undefined value, when line edit is empty.
57  uiLineEdit(uiParent*,const char* nm);
58  uiLineEdit(uiParent*,const DataInpSpec&,const char* nm);
59 
60  void setEdited(bool=true);
61  bool isEdited() const;
62 
63  void setCompleter(const BufferStringSet& bs,
64  bool casesensitive=false);
65  void setPlaceholderText(const uiString&);
66 
67  virtual void setReadOnly(bool=true);
68  virtual bool isReadOnly() const;
69  virtual bool update_(const DataInpSpec&);
70 
71  void setPasswordMode();
72  void setValidator(const uiIntValidator&);
73  void setValidator(const uiFloatValidator&);
74 
75  void setMaxLength(int);
76  int maxLength() const;
77  void setNrDecimals( int nrdec ) { nrdecimals_ = nrdec; }
78 
80  void home();
82  void end();
83 
84  void backspace();
85  void del();
86  void cursorBackward(bool mark,int steps=1);
87  void cursorForward(bool mark,int steps=1);
88  int cursorPosition() const;
89  void insert( const char* );
90 
91  int selectionStart() const;
92  const char* selectedText() const;
93  void setSelection(int start,int length);
94 
95  bool handleLongTabletPress();
96  void popupVirtualKeyboard(int globalx=-1,int globaly=-1);
97 
102 
103 
104  virtual const char* getvalue_() const;
105  virtual void setvalue_( const char* );
106 
107  void setToolTip( const uiString& tt )
108  { uiObject::setToolTip(tt); }
109 
110 protected:
111 
112  virtual bool notifyValueChanging_( const CallBack& cb )
113  { textChanged.notify( cb ); return true;}
114  virtual bool notifyValueChanged_( const CallBack& cb )
115  { editingFinished.notify( cb ); return true;}
116  virtual bool notifyUpdateRequested_( const CallBack& cb )
117  { returnPressed.notify( cb ); return true; }
118 
119 private:
120 
121  uiLineEditBody* body_;
122  uiLineEditBody& mkbody(uiParent*, const char*);
123 
126 
127 };
128 
129 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Definition: uilineedit.h:21
Notifier< uiLineEdit > returnPressed
Definition: uilineedit.h:99
float top_
Definition: uilineedit.h:45
void setToolTip(const uiString &)
int nrdecimals_
Definition: uilineedit.h:46
The base class for most UI elements.
Definition: uiobj.h:38
Definition: uistring.h:89
Definition: uiparent.h:26
Set of BufferString objects.
Definition: bufstringset.h:28
uiFloatValidator(float bot, float top)
Definition: uilineedit.h:40
virtual bool notifyValueChanged_(const CallBack &cb)
return false if not available
Definition: uilineedit.h:114
Specification of input characteristics.
Definition: datainpspec.h:89
int top_
Definition: uilineedit.h:30
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
float bottom_
Definition: uilineedit.h:44
virtual bool notifyUpdateRequested_(const CallBack &cb)
Definition: uilineedit.h:116
void notify(const CallBack &, bool first=false)
void setNrDecimals(int nrdec)
Definition: uilineedit.h:77
bool scnotation_
Definition: uilineedit.h:47
void setToolTip(const uiString &tt)
Definition: uilineedit.h:107
BufferString result_
Definition: uilineedit.h:124
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Notifier< uiLineEdit > selectionChanged
Definition: uilineedit.h:101
Definition: uilineedit.h:34
uiIntValidator(int bot, int top)
Definition: uilineedit.h:26
Notifier< uiLineEdit > editingFinished
Definition: uilineedit.h:98
Definition: uilineedit.h:51
int bottom_
Definition: uilineedit.h:29
uiIntValidator()
Definition: uilineedit.h:24
int nrdecimals_
Definition: uilineedit.h:125
uiFloatValidator()
Definition: uilineedit.h:37
CallBacks object-oriented (object + method).
Definition: callback.h:57
uiLineEditBody * body_
Definition: uilineedit.h:121
virtual bool notifyValueChanging_(const CallBack &cb)
return false if not available
Definition: uilineedit.h:112
Notifier< uiLineEdit > textChanged
Definition: uilineedit.h:100
Definition: userinputobj.h:83

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