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,2024 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 
FXGLObjectList & getList()
Return list of childern.
Definition: FXGLObject.h:98
FXbool replace(FXival pos, TYPE *object)
Replace object at position by given object.
Definition: FXObjectList.h:280
Basic OpenGL object.
Definition: FXGLObject.h:37
FXGLGroup()
Constructor.
Definition: FXGLObject.h:92
void insert(FXival pos, const FXGLObjectList &objs)
Insert list of child objects at given position.
Definition: FXGLObject.h:131
void prepend(FXGLObject *obj)
Prepend child object.
Definition: FXGLObject.h:134
OpenGL viewer widget.
Definition: FXGLViewer.h:93
FXbool remove(TYPE *object)
Remove object.
Definition: FXObjectList.h:292
FXbool insert(FXival pos, TYPE *object)
Insert object at certain position.
Definition: FXObjectList.h:244
void erase(FXival pos)
Remove child object at given position.
Definition: FXGLObject.h:152
FXbool prepend(TYPE *object)
Prepend object.
Definition: FXObjectList.h:256
FXGLGroup(const FXGLGroup &orig)
Copy constructor.
Definition: FXGLObject.h:95
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
void clear()
Remove all children.
Definition: FXGLObject.h:155
Group object.
Definition: FXGLObject.h:85
virtual ~FXGLObject()
Destructor.
Definition: FXGLObject.h:76
void insert(FXival pos, FXGLObject *obj)
Insert child object at given position.
Definition: FXGLObject.h:128
Definition: FX4Splitter.h:28
FXival no() const
Return number of objects.
Definition: FXObjectList.h:59
void replace(FXival pos, FXGLObject *obj)
Replace child object.
Definition: FXGLObject.h:146
FXbool erase(FXival pos)
Remove object at pos.
Bounds.
Definition: FXRangef.h:32
FXival no() const
Return number of children.
Definition: FXGLObject.h:122
void append(FXGLObject *obj)
Append child object.
Definition: FXGLObject.h:140
FXGLObject * child(FXival pos) const
Child at position.
Definition: FXGLObject.h:125
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
void prepend(const FXGLObjectList &objs)
Prepend list of child objects at given position.
Definition: FXGLObject.h:137
void append(const FXGLObjectList &objs)
Append list of child objects at given position.
Definition: FXGLObject.h:143
FXGLObject()
Constructors.
Definition: FXGLObject.h:46
FXbool append(TYPE *object)
Append object.
Definition: FXObjectList.h:268
FXbool clear()
Remove all objects.
FXGLObject(const FXGLObject &orig)
Copy constructor.
Definition: FXGLObject.h:49

Copyright © 1997-2022 Jeroen van der Zijp