OpendTect-6_4  6.4
uibody.h
Go to the documentation of this file.
1 #ifndef uibody_h
2 #define uibody_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 "uiparent.h"
17 
18 mFDQtclass(QWidget)
19 
20 mExpClass(uiBase) uiBody
21 {
22 public:
23  uiBody() {}
24  virtual ~uiBody() {}
25 
26  virtual void finalise() {}
27  virtual bool finalised() const { return false; }
28  virtual void clear() {}
29  virtual void fontchanged() {}
30 
31 
33  inline const mQtclass(QWidget*) qwidget() const
34  { return qwidget_();}
36  inline mQtclass(QWidget*) qwidget()
37  {return const_cast<mQtclass(QWidget*)>(qwidget_());}
38 
39 protected:
40  virtual const mQtclass(QWidget*) qwidget_() const =0;
41 
42 };
43 
44 
50 template <class C, class T>
51 mClass(uiBase) uiBodyImpl : public uiBody
52 {
53 public:
54  uiBodyImpl( C& hndle, uiParent* parnt, T& qthng )
55  : uiBody()
56  , qthing_(&qthng)
57  , handle_(hndle)
58  {}
59 
60 
61 
62  T* qthing() { return qthing_; }
63  const T* qthing() const { return qthing_; }
64 
65  inline const C& handle() { return handle_; }
66 
67 protected:
68  ~uiBodyImpl() { delete qthing_; }
69 
70  virtual const mQtclass(QWidget*) qwidget_() const
71  {return dynamic_cast<mQtclass(QWidget*)>( qthing_ );}
72 
73  T* qthing_;
74 
75 private:
76 
77  C& handle_;
78 
79 };
80 
81 #endif
#define mExpClass(module)
Definition: commondefs.h:160
C & handle_
Definition: i_uiobjqtbody.h:110
#define mQtclass(cls)
Definition: commondefs.h:229
void clear(std::ios &)
const C & handle()
Definition: uibody.h:65
virtual const mQtclass(QWidget *) qwidget_() const
Definition: uibody.h:70
Definition: uiparent.h:26
const T * qthing() const
Definition: uibody.h:63
virtual const QWidget * qwidget_() const
Definition: i_uiobjqtbody.h:28
T * qthing_
Definition: uibody.h:73
C & handle_
Definition: uibody.h:77
Simple delegating implementation of uiBody.
Definition: uibody.h:51
~uiBodyImpl()
Definition: uibody.h:68
uiBodyImpl(C &hndle, uiParent *parnt, T &qthng)
Definition: uibody.h:54
mFDQtclass(QWidget) class uiBody
Definition: uibody.h:18
#define mClass(module)
Definition: commondefs.h:164
T * qthing()
Definition: uibody.h:62

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