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