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

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