00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FXGLOBJECT_H
00022 #define FXGLOBJECT_H
00023
00024 #ifndef FXOBJECT_H
00025 #include "FXObject.h"
00026 #endif
00027
00028 namespace FX {
00029
00030
00031 class FXGLViewer;
00032 class FXGLObject;
00033
00034
00035
00037 class FXAPI FXGLObject : public FXObject {
00038 FXDECLARE(FXGLObject)
00039 public:
00040 enum {
00041 ID_LAST=10000
00042 };
00043 public:
00044
00046 FXGLObject(){}
00047
00049 FXGLObject(const FXGLObject& orig):FXObject(orig){}
00050
00052 virtual void bounds(FXRangef& box);
00053
00055 virtual void draw(FXGLViewer* viewer);
00056
00058 virtual void hit(FXGLViewer* viewer);
00059
00061 virtual FXGLObject* copy();
00062
00064 virtual FXGLObject* identify(FXuint* path);
00065
00067 virtual FXbool canDrag() const;
00068
00070 virtual FXbool canDelete() const;
00071
00073 virtual FXbool drag(FXGLViewer* viewer,FXint fx,FXint fy,FXint tx,FXint ty);
00074
00076 virtual ~FXGLObject(){}
00077 };
00078
00079
00081
00082
00083
00085 typedef FXObjectListOf<FXGLObject> FXGLObjectList;
00086
00087
00089 class FXAPI FXGLGroup : public FXGLObject {
00090 FXDECLARE(FXGLGroup)
00091 protected:
00092 FXGLObjectList list;
00093 public:
00094
00096 FXGLGroup(){ }
00097
00099 FXGLGroup(const FXGLGroup& orig):FXGLObject(orig),list(orig.list){ }
00100
00102 FXGLObjectList& getList(){ return list; }
00103
00105 virtual void bounds(FXRangef& box);
00106
00108 virtual void draw(FXGLViewer* viewer);
00109
00111 virtual void hit(FXGLViewer* viewer);
00112
00114 virtual FXGLObject* copy();
00115
00117 virtual FXGLObject* identify(FXuint* path);
00118
00120 virtual FXbool canDrag() const;
00121
00123 virtual FXbool drag(FXGLViewer* viewer,FXint fx,FXint fy,FXint tx,FXint ty);
00124
00126 FXint no() const { return list.no(); }
00127
00129 FXGLObject* child(FXint pos) const { return list[pos]; }
00130
00132 void insert(FXint pos,FXGLObject* obj){ list.insert(pos,obj); }
00133
00135 void prepend(FXGLObject* obj){ list.prepend(obj); }
00136
00138 void append(FXGLObject* obj){ list.append(obj); }
00139
00141 void replace(FXint pos,FXGLObject* obj){ list.replace(pos,obj); }
00142
00144 void remove(FXGLObject* obj){ list.remove(obj); }
00145
00147 void erase(FXint pos){ list.erase(pos); }
00148
00150 void clear(){ list.clear(); }
00151
00153 virtual void save(FXStream& store) const;
00154 virtual void load(FXStream& store);
00155
00157 virtual ~FXGLGroup();
00158 };
00159
00160
00162 class FXAPI FXGLPoint : public FXGLObject {
00163 FXDECLARE(FXGLPoint)
00164 public:
00165 FXVec3f pos;
00166 public:
00167
00169 FXGLPoint();
00170
00172 FXGLPoint(const FXGLPoint& orig);
00173
00175 FXGLPoint(FXfloat x,FXfloat y,FXfloat z);
00176
00178 virtual FXGLObject* copy();
00179
00181 virtual void bounds(FXRangef& box);
00182
00184 virtual void draw(FXGLViewer* viewer);
00185
00187 virtual void hit(FXGLViewer* viewer);
00188
00190 virtual void save(FXStream& store) const;
00191
00193 virtual void load(FXStream& store);
00194 };
00195
00196
00198 class FXAPI FXGLLine : public FXGLObject {
00199 FXDECLARE(FXGLLine)
00200 public:
00201 FXGLPoint fm,to;
00202 public:
00203
00205 FXGLLine();
00206
00208 FXGLLine(const FXGLLine& orig);
00209
00211 FXGLLine(FXfloat fx,FXfloat fy,FXfloat fz,FXfloat tx,FXfloat ty,FXfloat tz);
00212
00214 virtual void bounds(FXRangef& box);
00215
00217 virtual void draw(FXGLViewer* viewer);
00218
00220 virtual FXGLObject* copy();
00221
00223 virtual void hit(FXGLViewer* viewer);
00224
00226 virtual void save(FXStream& store) const;
00227
00229 virtual void load(FXStream& store);
00230 };
00231
00232 }
00233
00234 #endif
00235