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,v 1.13 2007/10/17 08:53:33 vlad Exp $ */
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 
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  redraw(*pPainter);
88  }
89 
95  virtual bool isHardcopy () const {
96  return false;
97  }
98 
99 
100  /*
101  * Flag of redrawing
102  */
103 
105  virtual void setDirty () = 0;
106 
108  virtual void resetDirty () = 0;
109 
111  virtual bool isDirty () const = 0;
112 
113 
114  /*
115  * Dynamic tip facilities
116  */
117 
120  virtual void setTipable (bool bFlag) {
121  m_bTipable = bFlag;
122  }
123 
125  virtual bool isTipable () const {
126  return m_bTipable;
127  }
128 
138  virtual bool tip (const QPoint& p,
139  QString& qsShort, QString& qsLong);
140 
141 
142  /*
143  * Events processing
144  */
145 
148  virtual ZqbEventHint input (QEvent& event) = 0;
149 
153  virtual bool isInputable () const {
154  return m_bInputable;
155  }
156 
159  virtual void setInputable (bool bFlag) {
160  m_bInputable = bFlag;
161  }
162 
163 
164  /*
165  * Position and size properties
166  */
167 
173  virtual void updateGeometry () = 0;
174 
178  virtual void updateLimits (QPainter* paint = NULL) = 0;
179 
183  virtual bool getRect (QRect& ) {
184  return false;
185  }
186 
191  virtual bool setRect (const QRect& ) {
192  return false;
193  }
194 
195 
196  /*
197  * Qt links
198  */
199 
202  virtual QPainter* getScreenPainter () const = 0;
203 
206  virtual void setScreenPainter (QPainter* pPainter) = 0;
207 
210  virtual QWidget* getAreaWidget () const = 0;
211 
214  virtual void setAreaWidget (QWidget* pWidget) = 0;
215 
216 };
217 
218 #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:153
virtual void updateLimits(QPainter *paint=NULL)=0
virtual bool getRect(QRect &)
Definition: zqb_visible.hpp:183
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:159
virtual void setTipable(bool bFlag)
Definition: zqb_visible.hpp:120
virtual void redraw()
Definition: zqb_visible.hpp:82
virtual QWidget * getAreaWidget() const =0
virtual bool setRect(const QRect &)
Definition: zqb_visible.hpp:191
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:125
virtual ~ZqbVisible()
virtual bool isHardcopy() const
Definition: zqb_visible.hpp:95