OpendTect-6_4  6.4
i_layout.h
Go to the documentation of this file.
1 #ifndef i_layout_h
2 #define i_layout_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: 18/08/1999
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uilayout.h"
16 #include "uigeom.h"
17 #include "uiobj.h"
18 #include "sets.h"
19 
20 #include <QLayout>
21 #include <QRect>
22 
23 
24 class resizeItem;
25 class Timer;
26 
28 enum stretchLimitTp { left=1, right=2, above=4, below=8,
30 
31 
33 class i_LayoutItem;
34 
35 enum LayoutMode { minimum=0, preferred=1, setGeom=2, all=3 };
36  // all is used for setting cached positions dirty
37 const int nLayoutMode = 3;
38 
40 
70 class i_LayoutMngr : public mQtclass(QLayout), public NamedObject
71 {
72  friend class i_LayoutItem;
73  friend class uiGroupParentBody;
74 
75 public:
76  i_LayoutMngr(mQtclass(QWidget*) prnt,
77  const char* name,uiObjectBody& mngbdy);
78 
79  virtual ~i_LayoutMngr();
80 
81  virtual void addItem(mQtclass(QLayoutItem*));
82  void addItem(i_LayoutItem*);
83 
84  virtual mQtclass(QSize) sizeHint() const;
85  virtual mQtclass(QSize) minimumSize() const;
86 
87  virtual mQtclass(QLayoutItem*) itemAt(int idx) const;
88  virtual mQtclass(QLayoutItem*) takeAt(int idx);
89  virtual int count() const;
90 
91  virtual void invalidate();
92  virtual void updatedAlignment(LayoutMode);
93  virtual void initChildLayout(LayoutMode);
94 
95  bool attach(constraintType,mQtclass(QWidget&),
96  mQtclass(QWidget*),int,
97  bool reciprocal=true);
98 
99  const uiRect& curpos(LayoutMode) const;
100  uiRect& curpos(LayoutMode);
101  uiRect winpos(LayoutMode) const;
102 
103  void forceChildrenRedraw(uiObjectBody*,bool deep);
104  void childrenClear(uiObject*);
105  bool isChild(uiObject*);
106 
107  int childStretch(bool hor) const;
108 
109  int borderSpace() const { return borderspc; }
110  int horSpacing() const;
111  int verSpacing() const { return vspacing; }
112 
113  void setHSpacing(int s) { hspacing = s; }
114  void setVSpacing(int s) { vspacing = s; }
115  void setBorderSpace(int s) { borderspc = s; }
116 
117  void setIsMain( bool yn ) { ismain = yn; }
118  void layoutChildren(LayoutMode,bool finalLoop=false);
119 
120 private:
121 
122  void setGeometry( const mQtclass(QRect&) );
123 
124  inline void doLayout( LayoutMode m, const mQtclass(QRect&) r ) const
125  { const_cast<i_LayoutMngr*>(this)->doLayout(m,r); }
126  void doLayout( LayoutMode m, const mQtclass(QRect&) );
127 
128  void itemDel( CallBacker* );
129 
130  void moveChildrenTo( int , int, LayoutMode );
131  void fillResizeList( ObjectSet<resizeItem>&, bool );
132  bool tryToGrowItem( resizeItem&, const int, const int,
133  int, int, const mQtclass(QRect&), int);
134  void resizeTo( const mQtclass(QRect&) );
135  void childrenCommitGeometrySet(bool);
136 
138 
140 
142  mQtclass(QRect) prefGeometry;
143 
147  bool ismain;
148 
149  int hspacing;
150  int vspacing;
152 
153  uiObjectBody& managedBody;
154 
155  void startPoptimer();
156  void popTimTick(CallBacker*);
158  bool popped_up;
160 
161 };
162 
163 #endif
Timer & poptimer
Definition: i_layout.h:157
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
int hspacing
Definition: i_layout.h:149
Definition: uigeom.h:42
virtual void invalidate()
#define mQtclass(cls)
Definition: commondefs.h:229
void setHSpacing(int s)
Definition: i_layout.h:113
friend class i_LayoutItem
Definition: i_layout.h:72
Definition: i_layout.h:28
void setGeometry(const mQtclass(QRect &))
bool popped_up
Definition: i_layout.h:158
Definition: i_layout.h:28
Definition: i_layout.h:35
Definition: i_layout.h:29
i_LayoutMngr(mQtclass(QWidget *) prnt, const char *name, uiObjectBody &mngbdy)
ObjectSet< i_LayoutItem > childrenlist
Definition: i_layout.h:139
virtual void updatedAlignment(LayoutMode)
The base class for most UI elements.
Definition: uiobj.h:38
bool attach(constraintType, mQtclass(QWidget &), mQtclass(QWidget *), int, bool reciprocal=true)
bool prefposStored
Definition: i_layout.h:146
uiRect winpos(LayoutMode) const
void childrenClear(uiObject *)
uiObjectBody & managedBody
Definition: i_layout.h:153
int childStretch(bool hor) const
uiRect childrenRect(LayoutMode)
const uiRect & curpos(LayoutMode) const
Set of pointers to objects.
Definition: commontypes.h:32
void childrenCommitGeometrySet(bool)
Set of (small) copyable elements.
Definition: commontypes.h:30
void doLayout(LayoutMode m, const mQtclass(QRect &) r) const
Definition: i_layout.h:124
LayoutMode
Definition: i_layout.h:35
uiRect layoutpos[nLayoutMode]
Definition: i_layout.h:141
void resizeTo(const mQtclass(QRect &))
Definition: i_layout.h:35
void fillResizeList(ObjectSet< resizeItem > &, bool)
void setVSpacing(int s)
Definition: i_layout.h:114
virtual int count() const
int horSpacing() const
bool preferredDone
Definition: i_layout.h:145
void setBorderSpace(int s)
Definition: i_layout.h:115
bool timer_running
Definition: i_layout.h:159
Object with a name.
Definition: namedobj.h:35
int borderSpace() const
Definition: i_layout.h:109
friend class uiGroupParentBody
Definition: i_layout.h:73
Definition: i_layout.h:29
int borderspc
Definition: i_layout.h:151
virtual void addItem(mQtclass(QLayoutItem *))
constraintType
Definition: uilayout.h:19
stretchLimitTp
internal enum used to determine in which direction a widget can be stretched and to check which outer...
Definition: i_layout.h:28
TypeSet< uiConstraint > constraintList
Definition: i_layout.h:32
void setIsMain(bool yn)
Definition: i_layout.h:117
const int nLayoutMode
Definition: i_layout.h:37
bool tryToGrowItem(resizeItem &, const int, const int, int, int, const mQtclass(QRect &), int)
Definition: i_layout.h:28
Definition: i_layout.h:35
int verSpacing() const
Definition: i_layout.h:111
void startPoptimer()
bool minimumDone
Definition: i_layout.h:144
Timer class.
Definition: timer.h:25
Definition: i_layout.h:35
virtual ~i_LayoutMngr()
bool ismain
Definition: i_layout.h:147
virtual const OD::String & name() const
Definition: namedobj.h:47
void layoutChildren(LayoutMode, bool finalLoop=false)
void moveChildrenTo(int, int, LayoutMode)
virtual void initChildLayout(LayoutMode)
dGB&#39;s layout manager
Definition: i_layout.h:70
void popTimTick(CallBacker *)
int vspacing
Definition: i_layout.h:150
bool isChild(uiObject *)
void itemDel(CallBacker *)
void forceChildrenRedraw(uiObjectBody *, bool deep)
virtual mQtclass(QSize) sizeHint() const
Definition: i_layout.h:28

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