00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GB_Group_h__
00021 #define __GB_Group_h__
00022
00023 #include "GB_API.h"
00024 #include <UT/UT_LinkList.h>
00025 #include <UT/UT_String.h>
00026 #include "GB_BaseGroup.h"
00027 #include "GB_Element.h"
00028 #include "GB_GroupList.h"
00029
00030 class GB_ElementTree;
00031
00032 class GB_API GB_Group : public GB_BaseGroup
00033 {
00034 public:
00035 GB_Group( GB_GroupList *o, const char *name, int hidden,
00036 unsigned short type = GBGROUP);
00037 ~GB_Group();
00038
00039 unsigned getOffset() const { return myOffset; }
00040 unsigned getMask() const { return myMask; }
00041 void setMask(unsigned o, unsigned m) { myOffset = o; myMask = m; }
00042
00043
00044 int isMixed(void) const;
00045
00046 int contains(const GB_Element *it) const;
00047 int containsMix(const GB_Element *it,
00048 const GB_Element *sec) const;
00049
00050 int contains(const GB_Element &it) const
00051 { return contains(&it); }
00052 int containsMix(const GB_Element &it,const GB_Element &sec) const
00053 { return containsMix(&it, &sec); }
00054
00055 int contains(unsigned int i) const
00056 { return contains(myOwner->element((int)i)); }
00057
00058
00059
00060
00061 void add(GB_Element *it, int order);
00062 void add(GB_Element *it);
00063 void addMix(GB_Element *it, GB_Element *sec);
00064
00065 void add(GB_Element &it, int order)
00066 {add(&it, order);}
00067 void add(GB_Element &it)
00068 {add(&it);}
00069 void addMix(GB_Element &it, GB_Element &sec)
00070 {addMix(&it, &sec);}
00071 void addMix(unsigned int num, unsigned int sec);
00072
00073 void add(unsigned int num, int order)
00074 {add(myOwner->element((int)num), order);}
00075 void add(unsigned int num)
00076 {add(myOwner->element((int)num));}
00077
00078 void toggle(GB_Element *it);
00079 void toggleMix(GB_Element *it, GB_Element *sec);
00080
00081 void toggle(GB_Element &it)
00082 {toggle(&it);}
00083 void toggleMix(GB_Element &it, GB_Element &sec)
00084 {toggleMix(&it, &sec);}
00085
00086 void toggle(unsigned int num)
00087 {toggle(myOwner->element((int)num));}
00088
00089 void remove(GB_Element *it);
00090 void removeMix(GB_Element *it, GB_Element *sec);
00091
00092
00093 void remove(GB_Element &it)
00094 {remove(&it);}
00095 void removeMix(GB_Element &it, GB_Element &sec)
00096 {removeMix(&it, &sec);}
00097
00098 void remove(unsigned int num)
00099 {remove(myOwner->element((int)num));}
00100
00101
00102
00103
00104
00105 virtual unsigned entries() const { return myOwner->entries(*this); }
00106 unsigned entriesMix() const { return myOwner->entriesMix(*this); }
00107
00108 virtual int isEmpty() const { return myOwner->isEmpty(*this); }
00109 int isEmptyMix() const { return myOwner->isEmptyMix(*this); }
00110
00111 virtual void clearEntries(void) { myOwner->clearEntries(*this); }
00112 void setEntries() { myOwner->setEntries(*this); }
00113 void toggleEntries() { myOwner->toggleEntries(*this); }
00114
00115
00116 void setFlags(const GB_Group *grp)
00117 { myOwner->assignEqual(*this, *grp); }
00118
00119
00120 GB_Group *prev() { return (GB_Group*)UT_LinkNode::prev();}
00121 GB_Group *next() { return (GB_Group*)UT_LinkNode::next();}
00122 const GB_Group *prev() const
00123 { return (const GB_Group*)UT_LinkNode::prev(); }
00124 const GB_Group *next() const
00125 { return (const GB_Group*)UT_LinkNode::next(); }
00126
00127 virtual int save(ostream &os, int binary) const
00128 { return myOwner->save(*this, os, binary); }
00129 virtual bool load(UT_IStream &is)
00130 { return myOwner->load(*this, is); }
00131
00132 GB_Group &operator |=(const GB_Group &d)
00133 { myOwner->orEqual(*this, d); return *this; }
00134 GB_Group &operator &=(const GB_Group &d)
00135 { myOwner->andEqual(*this, d); return *this; }
00136 GB_Group &operator -=(const GB_Group &d)
00137 { myOwner->minusEqual(*this, d); return *this; }
00138 GB_Group &operator ^=(const GB_Group &d)
00139 { myOwner->xorEqual(*this, d); return *this; }
00140 GB_Group &operator =(const GB_Group &d)
00141 { myOwner->assignEqual(*this, d); return *this; }
00142
00143
00144
00145 GB_ElementTree *ordered(void) const { return myTree; }
00146 GB_ElementTree *ordered(int yesno);
00147
00148 void setName(const char *n) { myOwner->rename(n, *this); myName.harden(n); }
00149
00150 private:
00151
00152 GB_ElementTree *myTree;
00153 GB_GroupList *myOwner;
00154 unsigned myOffset, myMask;
00155 };
00156
00157 class GB_API GB_PointGroup : public GB_Group
00158 {
00159 public:
00160 GB_PointGroup(GB_GroupList *o, const char *name, int hidden)
00161 : GB_Group(o, name, hidden, GBPOINTGROUP) {}
00162 ~GB_PointGroup() {}
00163 };
00164
00165 class GB_API GB_PrimitiveGroup : public GB_Group
00166 {
00167 public:
00168 GB_PrimitiveGroup(GB_GroupList *o, const char *name, int hidden)
00169 : GB_Group(o, name, hidden, GBPRIMITIVEGROUP) {}
00170 ~GB_PrimitiveGroup() {}
00171 };
00172
00173 #endif