00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __OP_Group_h__
00026 #define __OP_Group_h__
00027
00028 #include "OP_API.h"
00029 #include <UT/UT_Color.h>
00030 #include <UT/UT_String.h>
00031 #include <UT/UT_PtrArray.h>
00032
00033 class OP_Network;
00034 class OP_Node;
00035 class OP_GroupList;
00036
00037 class OP_API OP_Group
00038 {
00039 public:
00040 static char getGroupChar() { return '@'; }
00041
00042 const UT_String &getName() const { return myName; }
00043 void setName(const char *n);
00044
00045 int isInternal() const;
00046
00047
00048
00049
00050 int setPicked(int on_off, int list = 0);
00051 int getPicked(int list = 0) const;
00052 void setXY(float x, float y);
00053 float getX() const { return myPosX; }
00054 float getY() const { return myPosY; }
00055
00056
00057
00058 short getFlags() { return myFlags; }
00059 void setFlags(short f) { myFlags = f; }
00060
00061 const UT_Color &getColor(void) const { return myColor; }
00062 void setColor(const UT_Color &col) { myColor = col; }
00063
00064 void saveGroupForUndo();
00065 int saveContents(ostream &os, int binary=0);
00066 bool loadContents(UT_IStream &is);
00067 void clearUndoFlags() { mySavedForUndoFlag = 0; }
00068
00069
00070 void setFlag(char flagchar, int onoff);
00071 void setDisplay(int onoff);
00072 void setSelectable(int onoff);
00073 void setTemplate(int onoff);
00074 void setExposed(int onoff);
00075 void setSelected(int onoff);
00076 void setExport(int onoff);
00077 void setThumbnail(int onoff);
00078
00079
00080
00081
00082
00083 int clear(int send_change=1);
00084
00085
00086
00087
00088
00089 int addPattern(const char *pat);
00090 int subPattern(const char *pat);
00091 int setPattern(const char *pat) { clear(); return addPattern(pat); }
00092
00093
00094
00095
00096
00097
00098 int addMember(OP_Node *node, int send_change=1);
00099 int subMember(OP_Node *node, int send_change=1);
00100
00101
00102
00103
00104
00105
00106 int addPickedNodes(bool or_in_picked_netbox = false);
00107 int subPickedNodes(bool or_in_picked_netbox = false);
00108
00109
00110
00111 int subNonPickedRootNodes();
00112
00113
00114
00115
00116
00117
00118
00119 int isMember(const OP_Node *node) const;
00120 int contains(const OP_Node *node) const
00121 { return isMember(node); }
00122
00123
00124
00125
00126
00127
00128 int getPattern(UT_String &str) const;
00129
00130
00131
00132
00133 int getMembers(UT_PtrArray<OP_Node *> &list, int avoid_dups=0) const;
00134 int countMembers() const;
00135
00136 OP_Network *getNetwork() { return myNetwork; }
00137
00138
00139
00140
00141
00142 void sendGroupChange();
00143
00144 private:
00145 friend class OP_GroupList;
00146
00147
00148
00149 OP_Group(const char *name, OP_Network *net);
00150 ~OP_Group();
00151
00152
00153
00154
00155
00156
00157 void setGroupIndex(long index) { myGroupIndex = index; }
00158 long getGroupIndex() const { return myGroupIndex; }
00159
00160
00161
00162
00163
00164 int initialize(int state=0);
00165
00166 UT_String myName;
00167
00168 UT_Color myColor;
00169 float myPosX;
00170 float myPosY;
00171
00172 OP_Network *myNetwork;
00173
00174 long myGroupIndex;
00175
00176 char mySavedForUndoFlag;
00177 short myFlags;
00178 };
00179
00180 #endif