UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZtObject.H
1 // ZtObject.H $Revision: 1.15 $ $Date: 2004/10/07 14:01:36 $
2 
3 #if !defined __ZtObject_H
4 
5 #define __ZtObject_H
6 
7 #include <stdio.h>
8 #include <stdarg.h>
9 #include <zm/InfoLine.H>
10 
11 #include <zm/ZBase.H>
12 #include <zm/ZPixelCoord.H>
13 #include <zm/ZNaturalCoord.H>
14 
15 
55 class ZtMain;
56 
57 class ZtObject : public ZDrawable, public ZRect
58 {
59 public:
60 
62  ZtObject (ZtMain* pManager, ZGroupId pxid, ZGroupId pyid);
63 
65  ZtObject (ZtMain* pManager, ZGroupId pxid, ZGroupId pyid,
66  ZDimension dim, ZGroupId nid);
67 
69  ZtObject (ZtMain* pManager, ZGroupId pxid, ZGroupId pyid,
70  ZGroupId nxid, ZGroupId nyid);
71 
73  ZtObject (const ZtObject& zobj);
74 
75  virtual ~ZtObject ();
76 
78  ZtMain* get_manager () const;
79 
81  virtual void prepare_xywh ();
82 
84  ZNCoordSlave& nx () const;
85  ZNCoordSlave& ny () const;
86 
88  Logic is_vertical () const;
89  Logic is_horizontal () const;
90 
91  /* Proportionality tools */
92  float x_p2n (int pcoord) const;
93  float y_p2n (int pcoord) const;
94  int x_n2p (float ncoord) const;
95  int y_n2p (float ncoord) const;
96 
100  Logic clip_line_by_rect (float sx[2], float sy[2]) const;
101  Logic clip_line_by_rect (int sx[2], int sy[2]) const;
102  Logic clip_line_by_rect (float sx[2], float sy[2],
103  float nx[2], float ny[2]) const;
104  Logic clip_line_by_rect (float sx[2], float sy[2],
105  int px[2], int py[2]) const;
106 
109  Logic clip_rect_by_rect (float rcx[2], float rcy[2]) const;
110  Logic clip_rect_by_rect (float rx[2], float ry[2],
111  float cx[2], float cy[2]) const;
112 
114  void seldom_redraw (Logic flag);
115 
117  Logic is_seldom_redraw () const;
118 
120  void changes ();
121 
123  void done ();
124 
126  Logic is_changed () const;
127 
129  virtual void extent_rect (ZRect& res);
130 
132  virtual void expose ();
133 
135  virtual void redraw ();
136 
138  virtual void can_hear_events (Logic flag);
139 
141  Logic is_deaf () const;
142 
147  virtual ZInputStatus input (const XEvent* xev);
148 
150  virtual void show ();
151 
153  virtual void hide ();
154 
156  Logic is_hidden () const;
157 
160  virtual Logic belong (int px, int py) const;
161 
164  void raise_exch ();
165 
168  void raise_shift ();
169 
171  virtual const char* class_id () const;
172 
173  /***********************************************************************
174  * Special facility for window-local user messages
175  ***********************************************************************/
176 
178  void wePutMsg (int elevel, const char* s);
179 
181  void weFormatMsg (int elevel, const char* format, ...);
182 
184  void put_msg (int elevel, const char* format, va_list val);
185 
187  void format_msg (int elevel, const char* format, ...);
188 
190  void set_info_lines (InfoLine* il);
191 
193  InfoLine* get_info_lines () const;
194 
195 protected:/* data */
196 
199 
200 public:/* data */
201 
202  /* Always have pixel place */
207  float belong_eps;
208 
209 private:
210 
211  Logic deaf_flag;
212  Logic changes_flag;
213  Logic seldom_flag;
214  Logic hidden_flag;
216  /* For redraw optimization */
217  Drawable pix_image;
218  ZRect pix_rect;
221  void construct (ZtMain* pManager);
222 
223 protected:
224 
230 };
231 
232 /*
233  * General proportionality tools.
234  */
235 
240 float p2n (const ZPCoordSlave& ps, const ZNCoordSlave& ns, int pcoord);
241 
242 
247 int n2p (const ZNCoordSlave& ns, const ZPCoordSlave& ps, float ncoord);
248 
249 
250 
251 /*************************************************************
252  * INLINES
253  *************************************************************/
254 
255 /*************************************************************
256  * Get mode of expose: with buffered pixmap (TRUE) or without
257  * (FALSE)
258  */
259 inline Logic
261 {
262  return !!seldom_flag;
263 }
264 
265 
266 /*************************************************************
267  * Returns TRUE if some perameters of object has been changed.
268  */
269 inline Logic
271 {
272  return !!changes_flag;
273 }
274 
275 
276 /*************************************************************
277  * Get mode of event control: TRUE(can't process), FALSE(hears
278  * events).
279  */
280 inline Logic
282 {
283  return !!deaf_flag;
284 }
285 
286 
287 /*************************************************************
288  * Returns TRUE if object will expose itself or FALSE
289  * otherwise.
290  */
291 inline Logic
293 {
294  return !!hidden_flag;
295 }
296 
297 
298 #endif // ZtObject.H
virtual void expose()
Logic is_vertical() const
ZNCoordSlave * pnx
Definition: ZtObject.H:225
Definition: ZBase.H:87
virtual void show()
ZtMain * get_manager() const
float belong_eps
Definition: ZtObject.H:207
ZNCoordSlave * pny
Definition: ZtObject.H:226
virtual ZInputStatus input(const XEvent *xev)
void wePutMsg(int elevel, const char *s)
Definition: ZtMain.H:32
virtual Logic belong(int px, int py) const
virtual void can_hear_events(Logic flag)
void raise_shift()
void set_info_lines(InfoLine *il)
virtual const char * class_id() const
InfoLine * get_info_lines() const
void changes()
Definition: ZPixelCoord.H:102
ZNCoordSlave & nx() const
InfoLine * pInfoLine
Definition: ZtObject.H:198
Definition: InfoLine.H:51
Logic is_seldom_redraw() const
Definition: ZtObject.H:260
void seldom_redraw(Logic flag)
Logic clip_rect_by_rect(float rcx[2], float rcy[2]) const
void raise_exch()
Definition: ZBase.H:259
Definition: ZtObject.H:57
void put_msg(int elevel, const char *format, va_list val)
ZtObject(ZtMain *pManager, ZGroupId pxid, ZGroupId pyid)
Logic is_hidden() const
Definition: ZtObject.H:292
virtual void extent_rect(ZRect &res)
Logic is_deaf() const
Definition: ZtObject.H:281
void weFormatMsg(int elevel, const char *format,...)
void format_msg(int elevel, const char *format,...)
ZPCoordSlave px
Definition: ZtObject.H:203
Definition: ZNaturalCoord.H:88
ZtMain * manager
Definition: ZtObject.H:228
virtual void prepare_xywh()
virtual void redraw()
void done()
ZPCoordSlave py
Definition: ZtObject.H:204
virtual void hide()
Logic is_changed() const
Definition: ZtObject.H:270
Logic clip_line_by_rect(float sx[2], float sy[2]) const