OpendTect-6_4  6.4
uiparent.h
Go to the documentation of this file.
1 #ifndef uiparent_h
2 #define uiparent_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: 16/05/2001
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uiobj.h"
17 #include "uilayout.h"
18 
19 class MouseCursor;
20 class uiObjectBody;
21 class uiObject;
22 class uiMainWin;
23 class uiParentBody;
24 
25 
26 mExpClass(uiBase) uiParent : public uiBaseObject
27 {
28 friend class uiParentBody;
29 friend class uiObjectBody;
30 public:
31  uiParent(const char* nm,uiParentBody*);
32 
33  void addChild(uiBaseObject&);
34  void manageChld(uiBaseObject&,uiObjectBody&);
35  void attachChild(constraintType tp,uiObject* child,
36  uiObject* other,int margin,
37  bool reciprocal);
38 
39  const ObjectSet<uiBaseObject>* childList() const;
40 
41  virtual uiMainWin* mainwin() { return 0; }
42 
43  uiObject* mainObject() { return mainobject(); }
44  const uiObject* mainObject() const
45  { return const_cast<uiParent*>(this)->mainobject();}
46 
47  uiParentBody* pbody();
48  const uiParentBody* pbody() const
49  { return const_cast<uiParent*>(this)->pbody(); }
50 
51 
52 #define mIfMO() if ( mainObject() ) mainObject()
53 #define mRetMO(fn,val) return mainObject() ? mainObject()->fn() : val;
54 
55  void attach( constraintType t, int margin=-1 )
56  { mIfMO()->attach(t,margin); }
57  void attach( constraintType t, uiParent* oth, int margin=-1,
58  bool reciprocal=true)
59  { attach(t,oth->mainObject(),margin,reciprocal); }
60  void attach( constraintType t, uiObject* oth, int margin=-1,
61  bool reciprocal=true)
62  { attach_(t,oth,margin,reciprocal); }
63 
64 
65  virtual void display( bool yn, bool shrk=false,
66  bool maximize=false )
67  { finalise(); mIfMO()->display(yn,shrk,maximize); }
68  bool isDisplayed() const { mRetMO(isDisplayed,false); }
69 
70  void setFocus() { mIfMO()->setFocus(); }
71  bool hasFocus() const { mRetMO(hasFocus,false); }
72 
73  void setSensitive(bool yn=true){ mIfMO()->setSensitive(yn); }
74  bool sensitive() const { mRetMO(sensitive,false); }
75 
76  const uiFont* font() const { mRetMO(font,0); }
77  void setFont( const uiFont& f) { mIfMO()->setFont(f); }
78  void setCaption(const uiString& c) { mIfMO()->setCaption(c);}
79  void setCursor(const MouseCursor& c) {mIfMO()->setCursor(c);}
80 
81  uiSize actualsize( bool include_border) const
82  {
83  if ( mainObject() )
84  return mainObject()->actualsize(include_border);
85  return uiSize();
86  }
87 
88  int prefHNrPics() const { mRetMO(prefHNrPics, -1 ); }
89  int prefVNrPics() const { mRetMO(prefVNrPics,-1); }
90  void setPrefHeight( int h ) { mIfMO()->setPrefHeight(h); }
91  void setPrefWidth( int w ) { mIfMO()->setPrefWidth(w); }
92  void setPrefHeightInChar( int h )
93  { mIfMO()->setPrefWidthInChar(h); }
94  void setPrefHeightInChar( float h )
95  { mIfMO()->setPrefHeightInChar(h); }
96  void setPrefWidthInChar( float w )
97  { mIfMO()->setPrefWidthInChar(w); }
98  void setPrefWidthInChar( int w )
99  { mIfMO()->setPrefWidthInChar(w); }
100 
101  virtual void reDraw( bool deep ) { mIfMO()->reDraw( deep ); }
102  void shallowRedraw( CallBacker* =0 ) {reDraw(false);}
103  void deepRedraw( CallBacker* =0 ) {reDraw(true); }
104 
105  void setStretch( int h, int v ){ mIfMO()->setStretch(h,v); }
106 
107  Color backgroundColor() const;
108  Color roBackgroundColor() const;
109  void setBackgroundColor( const Color& c )
110  { mIfMO()->setBackgroundColor(c); }
111 
112  void translateText();
113 
114 protected:
115 
116  virtual void attach_( constraintType t, uiObject* oth, int margin=-1,
117  bool reciprocal=true)
118  { mIfMO()->attach(t,oth,margin,reciprocal); }
119 
120 #undef mIfMO
121 #undef mRetMO
122 
123  virtual uiObject* mainobject() { return 0; }
124 };
125 
126 #endif
void shallowRedraw(CallBacker *=0)
Definition: uiparent.h:102
#define mExpClass(module)
Definition: commondefs.h:160
User interface main window.
Definition: uimainwin.h:36
int prefVNrPics() const
Definition: uiparent.h:89
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
bool sensitive() const
Definition: uiparent.h:74
void attach(constraintType t, int margin=-1)
Definition: uiparent.h:55
Definition of a mouse cursor, can be either a predefined shape (from the enum, or a file...
Definition: mousecursor.h:26
bool hasFocus() const
Definition: uiparent.h:71
Definition: uifont.h:39
const uiParentBody * pbody() const
Definition: uiparent.h:48
The base class for most UI elements.
Definition: uiobj.h:38
Definition: uistring.h:89
Definition: uiparent.h:26
void setBackgroundColor(const Color &c)
Definition: uiparent.h:109
uiSize actualsize(bool include_border) const
Definition: uiparent.h:81
Definition: uigeom.h:25
virtual void attach_(constraintType t, uiObject *oth, int margin=-1, bool reciprocal=true)
Definition: uiparent.h:116
void setFocus()
Definition: uiparent.h:70
void setCaption(const uiString &c)
Definition: uiparent.h:78
#define mRetMO(fn, val)
Definition: uiparent.h:53
virtual void reDraw(bool deep)
Definition: uiparent.h:101
const uiFont * font() const
Definition: uiparent.h:76
void setPrefWidthInChar(int w)
Definition: uiparent.h:98
bool isDisplayed() const
Definition: uiparent.h:68
void setPrefHeightInChar(float h)
Definition: uiparent.h:94
void setPrefHeight(int h)
Definition: uiparent.h:90
void deepRedraw(CallBacker *=0)
Definition: uiparent.h:103
virtual uiMainWin * mainwin()
Definition: uiparent.h:41
void setFont(const uiFont &f)
Definition: uiparent.h:77
Definition: uiparentbody.h:23
void setPrefWidthInChar(float w)
Definition: uiparent.h:96
uiObject * mainObject()
Definition: uiparent.h:43
#define mIfMO()
Definition: uiparent.h:52
void attach(constraintType t, uiParent *oth, int margin=-1, bool reciprocal=true)
Definition: uiparent.h:57
constraintType
Definition: uilayout.h:19
int prefHNrPics() const
Definition: uiparent.h:88
virtual uiObject * mainobject()
Definition: uiparent.h:123
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
const uiObject * mainObject() const
Definition: uiparent.h:44
void setPrefWidth(int w)
Definition: uiparent.h:91
void setCursor(const MouseCursor &c)
Definition: uiparent.h:79
void setStretch(int h, int v)
Definition: uiparent.h:105
void attach(constraintType t, uiObject *oth, int margin=-1, bool reciprocal=true)
Definition: uiparent.h:60
void setSensitive(bool yn=true)
Definition: uiparent.h:73
virtual void display(bool yn, bool shrk=false, bool maximize=false)
Definition: uiparent.h:65
void setPrefHeightInChar(int h)
Definition: uiparent.h:92

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