UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zqb_visible.hpp
1 /* zqb_visible.hpp */
2 /* $Id: zqb_visible.hpp 20080 2009-12-15 15:57:52Z vlad $ */
3 #ifndef __zqb_visible_hpp
4 #define __zqb_visible_hpp
5 
6 #include <qpainter.h>
7 #include <qwidget.h>
8 
9 
14 enum ZqbEventHint
15 {
16  Z_EH_ACCEPT,
18  Z_EH_IGNORE,
20  Z_EH_GRAB
21 };
22 
23 
33 class ZqbVisible
34 {
35 private:
36 
38  bool m_bDrawable;
39 
41  bool m_bInputable;
42 
44  bool m_bTipable;
45 
46 public:
47 
50  ZqbVisible (bool bDrawable = false, bool bInputable = false,
51  bool bTipable = false)
52  : m_bDrawable(bDrawable), m_bInputable(bInputable), m_bTipable(bTipable)
53  {}
54 
56  virtual ~ZqbVisible ();
57 
58 
59  /*
60  * Drawing
61  */
62 
64  virtual void redraw (QPainter& paint) = 0;
65 
69  virtual bool isDrawable () const {
70  return m_bDrawable;
71  }
72 
75  virtual void setDrawable (bool bFlag) {
76  m_bDrawable = bFlag;
77  }
78 
82  virtual void redraw () {
83  QPainter *pPainter = getScreenPainter();
84  if(NULL == pPainter)
85  return;
86 
87  // urij
88  if (!(pPainter->isActive()))
89  return;
90 
91  redraw(*pPainter);
92  }
93 
99  virtual bool isHardcopy () const {
100  return false;
101  }
102 
103 
104  /*
105  * Flag of redrawing
106  */
107 
109  virtual void setDirty () = 0;
110 
112  virtual void resetDirty () = 0;
113 
115  virtual bool isDirty () const = 0;
116 
117 
118  /*
119  * Dynamic tip facilities
120  */
121 
124  virtual void setTipable (bool bFlag) {
125  m_bTipable = bFlag;
126  }
127 
129  virtual bool isTipable () const {
130  return m_bTipable;
131  }
132 
142  virtual bool tip (const QPoint& p,
143  QString& qsShort, QString& qsLong);
144 
145 
146  /*
147  * Events processing
148  */
149 
152  virtual ZqbEventHint input (QEvent& event) = 0;
153 
157  virtual bool isInputable () const {
158  return m_bInputable;
159  }
160 
163  virtual void setInputable (bool bFlag) {
164  m_bInputable = bFlag;
165  }
166 
167 
168  /*
169  * Position and size properties
170  */
171 
177  virtual void updateGeometry () = 0;
178 
182  virtual void updateLimits (QPainter* paint = NULL) = 0;
183 
187  virtual bool getRect (QRect& ) {
188  return false;
189  }
190 
195  virtual bool setRect (const QRect& ) {
196  return false;
197  }
198 
199 
200  /*
201  * Qt links
202  */
203 
206  virtual QPainter* getScreenPainter () const = 0;
207 
210  virtual void setScreenPainter (QPainter* pPainter) = 0;
211 
214  virtual QWidget* getAreaWidget () const = 0;
215 
218  virtual void setAreaWidget (QWidget* pWidget) = 0;
219 
220 };
221 
222 #endif /* zqb_visible.hpp */
virtual bool isDirty() const =0
virtual void updateGeometry()=0
virtual ZqbEventHint input(QEvent &event)=0
virtual QPainter * getScreenPainter() const =0
virtual void setScreenPainter(QPainter *pPainter)=0
virtual bool isInputable() const
Definition: zqb_visible.hpp:157
virtual void updateLimits(QPainter *paint=NULL)=0
virtual bool getRect(QRect &)
Definition: zqb_visible.hpp:187
virtual void setDrawable(bool bFlag)
Definition: zqb_visible.hpp:75
virtual bool tip(const QPoint &p, QString &qsShort, QString &qsLong)
virtual void setInputable(bool bFlag)
Definition: zqb_visible.hpp:163
virtual void setTipable(bool bFlag)
Definition: zqb_visible.hpp:124
virtual void redraw()
Definition: zqb_visible.hpp:82
virtual QWidget * getAreaWidget() const =0
virtual bool setRect(const QRect &)
Definition: zqb_visible.hpp:195
ZqbVisible(bool bDrawable=false, bool bInputable=false, bool bTipable=false)
Definition: zqb_visible.hpp:50
virtual void setDirty()=0
virtual bool isDrawable() const
Definition: zqb_visible.hpp:69
Definition: zqb_visible.hpp:33
virtual void setAreaWidget(QWidget *pWidget)=0
virtual void resetDirty()=0
virtual bool isTipable() const
Definition: zqb_visible.hpp:129
virtual ~ZqbVisible()
virtual bool isHardcopy() const
Definition: zqb_visible.hpp:99