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