OpendTect  6.3
uibaseobject.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: 16/05/2001
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "uibasemod.h"
14 #include "namedobj.h"
15 #include "notify.h"
16 #include "rowcol.h"
17 
18 class uiBody;
19 mFDQtclass(QWidget)
20 
21 
26 mExpClass(uiBase) uiBaseObject : public NamedCallBacker
27 {
28 public:
29  uiBaseObject(const char* nm, uiBody* = 0);
30  virtual ~uiBaseObject();
31 
32  // implementation: uiobj.cc
33  void finalise();
34  bool finalised() const;
35  void clear();
36 
37  virtual void translateText() {}
41  inline const uiBody* body() const { return body_; }
42  inline uiBody* body() { return body_; }
43 
44  static void addCmdRecorder(const CallBack&);
45  static void removeCmdRecorder(const CallBack&);
46 
47  int /* refnr */ beginCmdRecEvent(const char* msg=0);
48  void endCmdRecEvent(int refnr,const char* msg=0);
49 
50  int /* refnr */ beginCmdRecEvent(od_uint64 id,
51  const char* msg=0);
52  void endCmdRecEvent(od_uint64 id,int refnr,
53  const char* msg=0);
54 
55  virtual Notifier<uiBaseObject>& preFinalise()
56  { return finaliseStart_; }
57  virtual Notifier<uiBaseObject>& postFinalise()
58  { return finaliseDone_; }
59 
60  virtual int getNrWidgets() const = 0;
61  virtual mQtclass(QWidget)* getWidget(int widgetindex);
62  const mQtclass(QWidget)* getConstWidget(int widgetindex) const;
63 
64  virtual RowCol getWidgetOrigin(int widgetindex) const;
65  virtual RowCol getWidgetSpan(int widgetindex) const;
66 
67  int getNrRows() const;
68  int getNrCols() const;
69 
70 protected:
71 
72  void setBody( uiBody* b ) { body_ = b; }
73 
74  Notifier<uiBaseObject> finaliseStart_;
76  Notifier<uiBaseObject> finaliseDone_;
78 
79 private:
80 
81  int getNrRowCols( bool row ) const;
82  int cmdrecrefnr_;
83  uiBody* body_;
84 
85 };
86 
87 
88 /*
89 CmdRecorder annotation to distinguish real user actions from actions
90 performed by program code. Should be used at start of each (non-const)
91 uiObject function that calls any uiBody/Qt function that may trigger a
92 signal received by the corresponding Messenger class (see i_q****.h).
93 Apart from a few notify handler functions, it will do no harm when
94 using this annotation unnecessarily.
95 */
96 
97 #define mBlockCmdRec CmdRecStopper cmdrecstopper(this);
98 
100 {
101 public:
102  CmdRecStopper(const uiBaseObject*);
103  ~CmdRecStopper();
104 
105  static void clearStopperList(const CallBacker* cmdrec);
107 
108  static bool isInStopperList(const uiBaseObject* obj);
109 };
#define mExpClass(module)
Definition: commondefs.h:157
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
#define mQtclass(cls)
Definition: commondefs.h:232
void clear(std::ios &)
Definition: uibaseobject.h:99
Class to help setup a callback handling.
Definition: notify.h:121
#define mFDQtclass(cls)
Definition: commondefs.h:231
#define od_uint64
Definition: plftypes.h:35
IdxPair used for its row() and col().
Definition: rowcol.h:23
CallBacks object-oriented (object + method).
Definition: callback.h:62
CallBacker object with a name. Use if you want your object to be able to send and receive CallBack&#39;s...
Definition: namedobj.h:50

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