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

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