UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
zqb_container.hpp
1 /* zqb_container.hpp */
2 /* $Id: zqb_container.hpp 20080 2009-12-15 15:57:52Z vlad $ */
3 #ifndef __zqb_container_hpp
4 #define __zqb_container_hpp
5 
6 #include <stdarg.h>
7 
8 #include "zqb_objectarray.hpp"
9 
10 
11 class QPainter;
12 class ZqObject;
13 
14 
23 class ZqbContainer
24 {
25 protected:
26 
29 
30 public:
31 
33  virtual ~ZqbContainer () {}
34 
35 
37  virtual int numberOfObjects () const
38  {
39  return m_Objects.size();
40  }
41 
42 
45  virtual bool isEmpty () const
46  {
47  return 0 == numberOfObjects();
48  }
49 
50 
54  virtual bool addObject (ZqObject* obj)
55  {
56  if(NULL == obj)
57  return false;
58  return m_Objects.put(obj);
59  }
60 
61 
65  virtual bool removeObject (ZqObject* obj)
66  {
67  if(NULL == obj)
68  return false;
69 
70  return m_Objects.remove(obj);
71  }
72 
73 
77  virtual bool toFront (ZqObject* obj)
78  {
79  if(NULL == obj)
80  return false;
81  return m_Objects.toEnd(obj);
82  }
83 
84 
88  virtual bool toBack (ZqObject* obj)
89  {
90  if(NULL == obj)
91  return false;
92  return m_Objects.toBegin(obj);
93  }
94 
95 
100  virtual int setDrawOrder (const ZqbObjectArray& objects)
101  {
102  for(int i = objects.size() - 1; i != 0; --i)
103  toFront(objects[i]);
104  return 0;
105  }
106 
107 
113  virtual int setDrawOrder (ZqObject* obj1, ...)
114  {
115  va_list ap;
116  ZqbObjectArray objlist;
117  ZqObject *obj;
118 
119  va_start(ap, obj1);
120  for(obj = obj1; NULL != obj; va_arg(ap, ZqObject*))
121  objlist.put(obj);
122  va_end(ap);
123 
124  return setDrawOrder(objlist);
125  }
126 
127 
129  ZqbObjectArray::iterator begin ()
130  {
131  return m_Objects.begin();
132  }
133 
135  ZqbObjectArray::iterator end ()
136  {
137  return m_Objects.end();
138  }
139 
141  ZqbObjectArray::reverse_iterator rbegin ()
142  {
143  return m_Objects.rbegin();
144  }
145 
147  ZqbObjectArray::reverse_iterator rend ()
148  {
149  return m_Objects.rend();
150  }
151 
155  void addInteractiveObjects (bool bFlag, ZqbContainer& cont);
156 
157 
159  void redrawObjects (QPainter* paint);
160 
162  size_t size () const
163  {
164  return m_Objects.size();
165  }
166 
167 };
168 
169 #endif /* zqb_container.hpp */
virtual bool toBack(ZqObject *obj)
Definition: zqb_container.hpp:88
size_t size() const
Definition: zqb_container.hpp:162
ZqbObjectArray::iterator end()
Definition: zqb_container.hpp:135
virtual bool removeObject(ZqObject *obj)
Definition: zqb_container.hpp:65
bool remove(ZqObject *pObj)
Definition: zqb_objectarray.hpp:64
virtual bool isEmpty() const
Definition: zqb_container.hpp:45
virtual bool addObject(ZqObject *obj)
Definition: zqb_container.hpp:54
void redrawObjects(QPainter *paint)
ZqbObjectArray::reverse_iterator rend()
Definition: zqb_container.hpp:147
Definition: zqb_objectarray.hpp:26
virtual ~ZqbContainer()
Definition: zqb_container.hpp:33
Definition: zqb_container.hpp:23
virtual int setDrawOrder(ZqObject *obj1,...)
Definition: zqb_container.hpp:113
virtual int setDrawOrder(const ZqbObjectArray &objects)
Definition: zqb_container.hpp:100
virtual bool toFront(ZqObject *obj)
Definition: zqb_container.hpp:77
ZqbObjectArray m_Objects
Definition: zqb_container.hpp:28
ZqbObjectArray::iterator begin()
Definition: zqb_container.hpp:129
Definition: zq_object.hpp:36
bool toBegin(ZqObject *pObj)
Definition: zqb_objectarray.hpp:89
bool toEnd(ZqObject *pObj)
Definition: zqb_objectarray.hpp:76
virtual int numberOfObjects() const
Definition: zqb_container.hpp:37
bool put(ZqObject *pObj)
Definition: zqb_objectarray.hpp:53
void addInteractiveObjects(bool bFlag, ZqbContainer &cont)
ZqbObjectArray::reverse_iterator rbegin()
Definition: zqb_container.hpp:141