Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXGLObject.h
1 /********************************************************************************
2 * *
3 * O p e n G L O b j e c t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXGLOBJECT_H
22 #define FXGLOBJECT_H
23 
24 #ifndef FXOBJECT_H
25 #include "FXObject.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXGLViewer;
32 class FXGLObject;
33 
34 
35 
37 class FXAPI FXGLObject : public FXObject {
38  FXDECLARE(FXGLObject)
39 public:
40  enum {
41  ID_LAST=10000 // Leaving ample room for FXGLViewer subclasses
42  };
43 public:
44 
47 
49  FXGLObject(const FXGLObject& orig):FXObject(orig){}
50 
52  virtual void bounds(FXRangef& box);
53 
55  virtual void draw(FXGLViewer* viewer);
56 
58  virtual void hit(FXGLViewer* viewer);
59 
61  virtual FXGLObject* copy();
62 
64  virtual FXGLObject* identify(FXuint* path);
65 
67  virtual FXbool canDrag() const;
68 
70  virtual FXbool canDelete() const;
71 
73  virtual FXbool drag(FXGLViewer* viewer,FXint fx,FXint fy,FXint tx,FXint ty);
74 
76  virtual ~FXGLObject(){}
77  };
78 
79 
81 typedef FXObjectListOf<FXGLObject> FXGLObjectList;
82 
83 
85 class FXAPI FXGLGroup : public FXGLObject {
86  FXDECLARE(FXGLGroup)
87 protected:
88  FXGLObjectList list; // List of all objects
89 public:
90 
92  FXGLGroup(){ }
93 
95  FXGLGroup(const FXGLGroup& orig):FXGLObject(orig),list(orig.list){ }
96 
98  FXGLObjectList& getList(){ return list; }
99 
101  virtual void bounds(FXRangef& box);
102 
104  virtual void draw(FXGLViewer* viewer);
105 
107  virtual void hit(FXGLViewer* viewer);
108 
110  virtual FXGLObject* copy();
111 
113  virtual FXGLObject* identify(FXuint* path);
114 
116  virtual FXbool canDrag() const;
117 
119  virtual FXbool drag(FXGLViewer* viewer,FXint fx,FXint fy,FXint tx,FXint ty);
120 
122  FXival no() const { return list.no(); }
123 
125  FXGLObject* child(FXival pos) const { return list[pos]; }
126 
128  void insert(FXival pos,FXGLObject* obj){ list.insert(pos,obj); }
129 
131  void insert(FXival pos,const FXGLObjectList& objs){ list.insert(pos,objs); }
132 
134  void prepend(FXGLObject* obj){ list.prepend(obj); }
135 
137  void prepend(const FXGLObjectList& objs){ list.prepend(objs); }
138 
140  void append(FXGLObject* obj){ list.append(obj); }
141 
143  void append(const FXGLObjectList& objs){ list.append(objs); }
144 
146  void replace(FXival pos,FXGLObject* obj){ list.replace(pos,obj); }
147 
149  void remove(FXGLObject* obj){ list.remove(obj); }
150 
152  void erase(FXival pos){ list.erase(pos); }
153 
155  void clear(){ list.clear(); }
156 
158  virtual void save(FXStream& store) const;
159  virtual void load(FXStream& store);
160 
162  virtual ~FXGLGroup();
163  };
164 
165 
166 }
167 
168 #endif
169 

Copyright © 1997-2016 Jeroen van der Zijp