OpendTect-6_4  6.4
uiobj.h
Go to the documentation of this file.
1 #ifndef uiobj_h
2 #define uiobj_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/08/1999
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uibaseobject.h"
17 #include "uigeom.h"
18 #include "uilayout.h"
19 #include "uistring.h"
20 #include "color.h"
21 
22 mFDQtclass(QWidget)
23 mFDQtclass(QString)
24 class MouseCursor;
25 class uiFont;
26 class uiObjectBody;
27 class uiParent;
28 class uiMainWin;
29 class i_LayoutItem;
30 class uiPixmap;
31 class uiObjEventFilter;
32 
33 
38 mExpClass(uiBase) uiObject : public uiBaseObject
39 {
40  friend class uiObjectBody;
41  friend class i_LayoutItem;
42 
43 public:
44  uiObject(uiParent*,const char* nm);
45  uiObject(uiParent*,const char* nm,uiObjectBody&);
46  ~uiObject();
47 
58  enum SzPolicy{ Undef, Small, Medium, Wide,
59  SmallVar, MedVar, WideVar,
60  SmallMax, MedMax, WideMax };
61 
62  void setHSzPol(SzPolicy);
63  void setVSzPol(SzPolicy);
64  SzPolicy szPol( bool hor=true) const;
65 
66  virtual int width() const;
67  virtual int height() const;
68 
69  virtual void setName(const char*);
70 
71  void setToolTip(const uiString&);
72  const uiString& toolTip() const;
73  static void updateToolTips();
74 
75  void translateText();
76 
77  void display(bool yn,bool shrink=false,bool maximized=false);
78  void setFocus();
79  bool hasFocus() const;
80  void disabFocus();
81 
82  virtual void setCursor(const MouseCursor&);
83  bool isCursorInside() const;
84 
85  virtual void setStyleSheet(const char*);
86  virtual Color backgroundColor() const;
87  Color roBackgroundColor() const;
88  virtual void setBackgroundColor(const Color&);
89  virtual void setBackgroundPixmap(const uiPixmap&);
90  virtual void setTextColor(const Color&);
91  void setSensitive(bool yn=true);
92  bool sensitive() const;
93  bool visible() const;
94  bool isDisplayed() const;
95 
96  int prefHNrPics() const;
97  virtual void setPrefWidth(int);
98  void setPrefWidthInChar(int);
99  void setPrefWidthInChar(float);
100  void setMinimumWidth(int);
101  void setMaximumWidth(int);
102  int prefVNrPics() const;
103  virtual void setPrefHeight(int);
104  void setPrefHeightInChar(int);
105  void setPrefHeightInChar(float);
106  void setMinimumHeight(int);
107  void setMaximumHeight(int);
108 
112  void setStretch(int hor,int ver);
113 
114 
121  void attach(constraintType,int margin=-1);
122  void attach(constraintType,uiObject*,int margin=-1,
123  bool reciprocal=true);
124  void attach(constraintType,uiParent*,int margin=-1,
125  bool reciprocal=true);
126 
127  static void setTabOrder(uiObject* first, uiObject* second);
128 
129  void setFont(const uiFont&);
130  const uiFont* font() const;
131  void setCaption(const uiString&);
132 
133 
134  void shallowRedraw(CallBacker* =0) { reDraw( false ); }
135  void deepRedraw(CallBacker* =0) { reDraw( true ); }
136  void reDraw(bool deep);
137 
138  uiSize actualsize(bool include_border=true) const;
139 
140  uiParent* parent() { return parent_; }
141  const uiParent* parent() const
142  { return const_cast<uiObject*>(this)->parent(); }
143  void reParent(uiParent*);
144 
145  uiMainWin* mainwin();
146 
147  mQtclass(QWidget*) getWidget() { return qwidget(); }
148  mQtclass(QWidget*) qwidget();
149  const mQtclass(QWidget*) qwidget() const
150  { return const_cast<uiObject*>(this)->qwidget(); }
151 
152  virtual bool handleLongTabletPress();
153 
154  virtual const ObjectSet<uiBaseObject>* childList() const { return 0; }
155 
158  void close();
159 
160 
167 
168  static int baseFldSize();
169  static int iconSize();
170 
171 protected:
173  virtual bool closeOK() { closed.trigger(); return true; }
174 
176  void triggerSetGeometry(const i_LayoutItem*, uiRect&);
177 
178  void updateToolTip(CallBacker* = 0);
179 
181 
182  uiObjEventFilter* uiobjeventfilter_;
183 
184 private:
185 
186  uiParent* parent_;
187 };
188 
189 
190 #define mTemplTypeDef(fromclass,templ_arg,toclass) \
191  typedef fromclass<templ_arg> toclass;
192 #define mTemplTypeDefT(fromclass,templ_arg,toclass) \
193  mTemplTypeDef(fromclass,templ_arg,toclass)
194 
195 
196 #define mUsrEvGuiThread mQtclass(QEvent)::Type( mQtclass(QEvent)::User + 0 )
197 #define mUsrEvPopUpReady mQtclass(QEvent)::Type( mQtclass(QEvent)::User + 1 )
198 #define mUsrEvLongTabletPress mQtclass(QEvent)::Type(mQtclass(QEvent)::User+2)
199 
200 #endif
#define mExpClass(module)
Definition: commondefs.h:160
User interface main window.
Definition: uimainwin.h:36
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
Definition: uigeom.h:42
uiParent * parent()
Definition: uiobj.h:140
Definition of a mouse cursor, can be either a predefined shape (from the enum, or a file...
Definition: mousecursor.h:26
#define mQtclass(cls)
Definition: commondefs.h:229
FixedString Undef()
Definition: keystrs.h:142
void shallowRedraw(CallBacker *=0)
Definition: uiobj.h:134
virtual bool closeOK()
hook. Accepts/denies closing of window.
Definition: uiobj.h:173
Definition: uifont.h:39
Definition: uiobj.h:59
The base class for most UI elements.
Definition: uiobj.h:38
Definition: uistring.h:89
Definition: uiparent.h:26
uiParent * parent_
Definition: uiobj.h:186
CNotifier< uiObject, uiRect & > setGeometry
triggered when getting a new geometry A reference to the new geometry is passed which can be manipula...
Definition: uiobj.h:166
Definition: uigeom.h:25
SzPolicy
How should the object&#39;s size behave? Undef : use default. Small : 1 base sz. Medium : 2* base sz + 1...
Definition: uiobj.h:58
void trigger(T &t)
Definition: callback.h:258
virtual const ObjectSet< uiBaseObject > * childList() const
Definition: uiobj.h:154
Off-screen pixel-based paint device.
Definition: uipixmap.h:34
uiString tooltip_
Definition: uiobj.h:180
Notifier< uiObject > closed
Triggered when object closes.
Definition: uiobj.h:156
void deepRedraw(CallBacker *=0)
Definition: uiobj.h:135
mQtclass(QWidget *) getWidget()
Definition: uiobj.h:147
const uiParent * parent() const
Definition: uiobj.h:141
virtual void setFont(const QFont &)
override Qt
Definition: i_uiobjqtbody.h:32
mFDQtclass(QWidget) mFDQtclass(QString) class MouseCursor
Definition: uibody.h:18
Definition: uiobj.h:58
constraintType
Definition: uilayout.h:19
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
uiObjEventFilter * uiobjeventfilter_
Definition: uiobj.h:182
const mQtclass(QWidget *) qwidget() const
Definition: uiobj.h:149

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