UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ZtMain.H
1 // ZtMain.H $Revision: 1.13 $ $Date: 2004/10/07 14:01:36 $
2 
3 #if !defined __ZtMain_H
4 
5 #define __ZtMain_H
6 
7 #include <zm/InfoLine.H>
8 
9 #include <zm/ZPixelCoord.H>
10 #include <zm/ZNaturalCoord.H>
11 #include <zm/ZtObject.H>
12 
13 
14 /*************************************************************
15  * Two pixel groups describe the whole box of main window.
16  * They have special group ids:
17  *************************************************************/
18 #define WHOLE_BOX_ID 0
19 #define WHOLE_WIDTH_ID WHOLE_BOX_ID
20 #define WHOLE_HEIGHT_ID WHOLE_BOX_ID
21 
22 
23 /*************************************************************
24  * Center of control under vertical and horizontal pixel and
25  * natural groups.
26  *************************************************************/
27 
28 #define PtrType ZtObject*
29 #define PtrAr ZtObjAr
30 #include <mix/PtrAr.H> /* ==> class ZtObjAr */
31 
32 class ZtMain
33  : public ZWindow
34 #ifndef NO_XTOOLKIT
35  , public ZWidget
36 #endif /* NO_XTOOLKIT */
37 {
38 public:
39 
40  ZPCoordMaster *mpx; /* Controls horizontal pixel groups */
41  ZPCoordMaster *mpy; /* Controls vertical pixel groups */
42 
43  ZNCoordMaster *mnx; /* Controls horizontal natural groups */
44  ZNCoordMaster *mny; /* Controls vertical natural groups */
45 
46  ZtMain (const ZConnect& zconnect, Window window);
47  ZtMain (const ZWindow& zwindow);
48 #ifndef NO_XTOOLKIT
49  ZtMain (const ZWidget& zwidget);
50 #endif /* NO_XTOOLKIT */
51  virtual ~ZtMain ();
52 
53  /* Add object at the top of drawing list */
54  void add (const ZtObject* pObject);
55 
56  /* Returns count of objects */
57  int objects_count () const;
58 
59  /* Put object at the top of drawing list */
60  void raise_exch (int iObject);
61  void raise_shift (int iObject);
62 
63  /* Get index of object by pointer or (-1) if no such object */
64  int object_index (const ZtObject* pObject) const;
65 
66  /* Delete object from drawing list by index and by pointer */
67  void remove (int iObject);
68  void remove (const ZtObject* pObject);
69 
70  /* Hide object (don't draw it) by index */
71  void hide (int iObject);
72 
73  /* Show object (don't draw it) by index */
74  void show (int iObject);
75 
76  /* Return TRUE if object is hidden */
77  Logic is_hidden (int iObject) const;
78 
79  /* Get pointer at object by its index or NULL if no such index */
80  ZtObject* object_pointer (int iObject) const;
81  ZtObject& operator[] (int iObject) const;
82 
83  /* Exposure procedure is called when resize or expose event is take
84  place */
85  virtual void expose ();
86 
88  virtual void redraw ();
89 
90  /* Draw image to TIFF file */
91  virtual void draw_to_tiff (const char* path);
92 
94  virtual void draw_to_pixmap (ZArea& pixmap);
95 
96  /* Event processing for all objects with final status:
97  ziProcessed - if event processing has been finished (ungrab input);
98  ziGrabInput - if event processing must be continued (grab input);
99  ziSkipped - if this event is not processed. */
100  virtual ZInputStatus input (const XEvent* xev);
101 
102  /* Set mode of expose: with buffered pixmap (TRUE) or without (FALSE) */
103  void seldom_redraw (Logic flag);
104 
105  /* Get mode of expose: with buffered pixmap (TRUE) or without (FALSE) */
106  Logic is_seldom_redraw () const;
107 
108 #ifdef NO_XTOOLKIT
109  /* Return NULL only if no XToolkit code is allowed */
110  virtual Widget widget () const;
111 #endif /* NO_XTOOLKIT */
112 
113  /***********************************************************************
114  * Special facility for window-local user messages
115  ***********************************************************************/
116 
118  void set_info_lines (InfoLine* il);
119 
121  InfoLine* get_info_lines () const;
122 
123 protected:/* data */
124 
127 
128 protected:
129 
130  /* Direct drawing procedure to pointed drawable */
131  virtual void draw_to (Drawable d, const ZSize& s);
132 
135  Logic cache_is_actual () const;
136 
139  ZtObjAr *objects;
142 private:
143 
145  void init ();
146 
148  Logic seldom_flag;
149 
150 };
151 
152 
153 /*************************************************************
154  * INLINES
155  *************************************************************/
156 
157 /*************************************************************
158  * Get mode of expose: with buffered pixmap (TRUE) or without
159  * (FALSE)
160  */
161 inline Logic
162 ZtMain::is_seldom_redraw () const
163 {
164  return seldom_flag;
165 }
166 
167 #ifdef NO_XTOOLKIT
168 /*************************************************************
169  * Return NULL only if no XToolkit code is allowed.
170  * Usually widget() is inherited from ZWidget.
171  */
172 inline Widget
173 ZtMain::widget () const
174 {
175  return NULL;
176 }
177 #endif /* NO_XTOOLKIT */
178 
179 
180 #endif // ZtMain.H
Definition: ZBase.H:234
Definition: ZBase.H:291
Definition: ZBase.H:316
Definition: ZBase.H:58
Definition: ZBase.H:118
void set_info_lines(InfoLine *il)
Definition: ZtMain.H:32
Definition: InfoLine.H:51
Definition: ZPixelCoord.H:174
InfoLine * get_info_lines() const
Definition: ZtObject.H:57
int iGrabInput
Definition: ZtMain.H:140
virtual void redraw()
InfoLine * pInfoLine
Definition: ZtMain.H:126
Logic cache_is_actual() const
Definition: ZNaturalCoord.H:164
ZArea * cached_area
Definition: ZtMain.H:137
ZtObjAr * objects
Definition: ZtMain.H:139
virtual void draw_to_pixmap(ZArea &pixmap)