00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __OP_NetworkBoxItem__
00022 #define __OP_NetworkBoxItem__
00023
00024 #include "OP_API.h"
00025 #include <SYS/SYS_Types.h>
00026 #include <UT/UT_PtrArray.h>
00027
00028 #include "OP_NetworkBoxItemFlags.h"
00029
00030 #define OP_NO_OWNER_NETWORK_BOX "__NO_OWNER_NETWORK_BOX__"
00031
00032 class OP_Network;
00033 class OP_NetworkBox;
00034 class OP_NetworkBoxItem;
00035 class OP_Node;
00036 class UT_Color;
00037 class UT_String;
00038 class UT_HashTable;
00039
00040 typedef UT_PtrArray<OP_NetworkBoxItem *> OP_NetworkBoxItemList;
00041
00042
00043
00044 typedef unsigned int OP_ItemTypeMask;
00045
00046 enum OP_ItemType
00047 {
00048 OP_ITEMTYPE_NODE = 0x00000001,
00049 OP_ITEMTYPE_INDIRECT = 0x00000002,
00050 OP_ITEMTYPE_NETWORKBOX = 0x00000004,
00051 OP_ITEMTYPE_POSTIT_NOTE = 0x00000008,
00052
00053 OP_ITEMTYPE_ALL = 0xFFFFFFFF
00054
00055 };
00056
00057 class OP_API OP_NetworkBoxItem
00058 {
00059 public:
00060 OP_NetworkBoxItem(OP_NetworkBoxItemFlags *flag = NULL);
00061 virtual ~OP_NetworkBoxItem();
00062
00063 virtual const OP_NetworkBoxItemFlags &flags() const { return *myFlags; }
00064 virtual OP_NetworkBoxItemFlags &flags() { return *myFlags; }
00065
00066
00067
00068 virtual void setXY(fpreal x, fpreal y) = 0;
00069 virtual fpreal getX() const = 0;
00070 virtual fpreal getY() const = 0;
00071 virtual fpreal getW() const = 0;
00072 virtual fpreal getH() const = 0;
00073
00074
00075 static fpreal getMaxSafeX() { return 1e6; }
00076 static fpreal getMinSafeX() { return -1e6; }
00077 static fpreal getMaxSafeY() { return 1e6; }
00078 static fpreal getMinSafeY() { return -1e6; }
00079
00080
00081
00082
00083
00084
00085
00086 void moveToGoodPosition(bool relativetoinputs = true,
00087 bool moveinputs = true,
00088 bool moveoutputs = true,
00089 bool moveunconnected = true);
00090
00091
00092
00093
00094
00095 void setOwnerBox(OP_NetworkBox *box);
00096 OP_NetworkBox *getOwnerBox() const;
00097
00098 virtual int setPicked(int on_off,
00099 bool propagate_parent_event = true) = 0;
00100 virtual int getPicked() const = 0;
00101
00102
00103 virtual OP_Network *getParentNetwork() const = 0;
00104
00105
00106
00107 void getPathFromParent(UT_String &str,
00108 const OP_Node *parent) const;
00109
00110
00111
00112 virtual bool setColor(const UT_Color &color);
00113 virtual const UT_Color *getColor() const;
00114
00115
00116 virtual OP_ItemType getItemType() const = 0;
00117
00118
00119
00120 virtual const UT_String &getItemName() const = 0;
00121
00122
00123
00124
00125
00126
00127
00128
00129 OP_Network *getCreator() const;
00130
00131 private:
00132
00133
00134
00135
00136 void getConnectedItems(OP_NetworkBoxItemList &items,
00137 bool inputs, bool recursive) const;
00138
00139
00140
00141 void getContainedItems(OP_NetworkBoxItemList &items) const;
00142
00143
00144 static void addItemToTable(const OP_NetworkBoxItem *item,
00145 UT_HashTable &connectedtable,
00146 bool inputs, bool recursive);
00147 static void getConnectedItems(const OP_NetworkBoxItem *item,
00148 UT_HashTable &connectedtable,
00149 bool inputs, bool recursive);
00150 static void getContainedItems(const OP_NetworkBox *box,
00151 OP_NetworkBoxItemList &items);
00152
00153 OP_NetworkBox *myOwnerBox;
00154 OP_NetworkBoxItemFlags *myFlags;
00155 };
00156
00157 #endif
00158