#include <OP_NetworkBox.h>

Public Member Functions | |
| OP_NetworkBox (const UT_String &name, OP_Network *net) | |
| virtual | ~OP_NetworkBox () |
| virtual void | setXY (fpreal x, fpreal y) |
| void | setXY (fpreal x, fpreal y, bool force, bool propagate_parent_event) |
| bool | setXYWithBoundsChecks (fpreal x, fpreal y) |
| virtual fpreal | getX () const |
| virtual fpreal | getY () const |
| void | setW (fpreal w, bool force=false) |
| void | setH (fpreal h, bool force=false) |
| bool | setWWithBoundsChecks (fpreal w) |
| bool | setHWithBoundsChecks (fpreal h) |
| virtual fpreal | getW () const |
| virtual fpreal | getH () const |
| fpreal | getMaximizedW () const |
| fpreal | getMaximizedH () const |
| void | resizeToFit () |
| void | resizeToFit (fpreal xmin, fpreal ymin, fpreal xmax, fpreal ymax) |
| bool | setName (const UT_String &name) |
| virtual const UT_String & | getItemName () const |
| virtual bool | setColor (const UT_Color &color) |
| virtual const UT_Color * | getColor () const |
| int | getNitems () const |
| int | getNexposedItems () const |
| OP_NetworkBoxItem * | getItem (int idx) const |
| void | getNodes (OP_NodeList &list, int level=0) const |
| void | getPostIts (UT_PtrArray< OP_PostIt * > &list, int level=0) const |
| void | getNetboxes (UT_PtrArray< OP_NetworkBox * > &list, int level=0) const |
| bool | addItem (OP_NetworkBoxItem *item, bool propagate_parent_event=true, bool resize_to_fit=true) |
| bool | addItems (UT_PtrArray< OP_NetworkBoxItem * > &items) |
| bool | removeItem (OP_NetworkBoxItem *item, bool propagate_parent_event=true, bool do_reparent=false) |
| Remove the item from this box. The item's owner box is set to NULL. | |
| bool | removeItems (UT_PtrArray< OP_NetworkBoxItem * > &items) |
| bool | removeAllItems (bool do_reparent=false) |
| bool | setContents (UT_PtrArray< OP_NetworkBoxItem * > &items, bool snap_to_bounds) |
| virtual int | getPicked () const |
| Returns true if this box is currently picked. | |
| virtual int | setPicked (int on_off, bool propagate_parent_event=true) |
| bool | getMinimized () const |
| Get whether this box is currently minimized. | |
| bool | setMinimized (bool isminimized, bool update_position, bool propagate_parent_event) |
| void | setMarked (bool flag) |
| bool | getMarked () |
| void | getItemBounds (fpreal &x1, fpreal &y1, fpreal &x2, fpreal &y2, bool incl_buff_border=true) const |
| void | snapToBounds (bool incl_buff_border=true) |
| int | save (ostream &os, const OP_SaveFlags &flags) |
| Save the attributes of this network box to the ostream. | |
| bool | load (UT_IStream &is) |
| virtual OP_ItemType | getItemType () const |
| Returns my item type (OP_ITEMTYPE_NETWORKBOX). | |
| const OP_Stat & | getStat () const |
| OP_Stat & | getStat () |
| virtual OP_Network * | getParentNetwork () const |
| Return the network i'm in. | |
| void | getSaveFlagsString (UT_String &cmd, const char *flags, bool save_to_hip) const |
| int | saveCommand (ostream &os, const char *name, int dogeneral) const |
| int | getUniqueId () const |
| void | setResizing (bool resizing) |
| bool | getResizing () |
Static Public Member Functions | |
| static OP_NetworkBox * | lookupNetworkBox (int unique_id) |
| static void | clearAllPendingUndoFlags () |
| static void | setDragbarHeight (fpreal height) |
Definition at line 64 of file OP_NetworkBox.h.
| OP_NetworkBox::OP_NetworkBox | ( | const UT_String & | name, | |
| OP_Network * | net | |||
| ) |
Create a network box with the specified name. If a duplicate name is passed in, it will be altered to make it unique in the network.
| virtual OP_NetworkBox::~OP_NetworkBox | ( | ) | [virtual] |
| bool OP_NetworkBox::addItem | ( | OP_NetworkBoxItem * | item, | |
| bool | propagate_parent_event = true, |
|||
| bool | resize_to_fit = true | |||
| ) |
Add an item to this box. If the item was previously in another netbox, we remove it from there before we add it here. If 'resize_to_fit' is set to true, we'll resize if necessary to fit our contents after the item is added - this option should always be on, except when the undo mechanism requires some extra control to restore states properly
| bool OP_NetworkBox::addItems | ( | UT_PtrArray< OP_NetworkBoxItem * > & | items | ) |
| static void OP_NetworkBox::clearAllPendingUndoFlags | ( | ) | [static] |
| virtual const UT_Color* OP_NetworkBox::getColor | ( | void | ) | const [inline, virtual] |
| virtual fpreal OP_NetworkBox::getH | ( | ) | const [virtual] |
Implements OP_NetworkBoxItem.
| OP_NetworkBoxItem* OP_NetworkBox::getItem | ( | int | idx | ) | const |
| void OP_NetworkBox::getItemBounds | ( | fpreal & | x1, | |
| fpreal & | y1, | |||
| fpreal & | x2, | |||
| fpreal & | y2, | |||
| bool | incl_buff_border = true | |||
| ) | const |
Calculate the smallest bounds we're willing to accept as our size given our contents. By default, 'incl_buff_border' is set to add a small buffer border to make the layout look pretty. NOTE: If we contain no items, we return an inverted bounding box, see implementation for further details.
| virtual const UT_String& OP_NetworkBox::getItemName | ( | ) | const [inline, virtual] |
Basically the same as OP_Node::getName(), but abstracted to a higher level so we can call it on all items.
Implements OP_NetworkBoxItem.
Definition at line 144 of file OP_NetworkBox.h.
| virtual OP_ItemType OP_NetworkBox::getItemType | ( | ) | const [virtual] |
| bool OP_NetworkBox::getMarked | ( | ) |
| fpreal OP_NetworkBox::getMaximizedH | ( | ) | const |
| fpreal OP_NetworkBox::getMaximizedW | ( | ) | const |
Return the full maximized size of the netbox, regardless of whether the netbox is currently maximized or minimized
| bool OP_NetworkBox::getMinimized | ( | ) | const |
Get whether this box is currently minimized.
| void OP_NetworkBox::getNetboxes | ( | UT_PtrArray< OP_NetworkBox * > & | list, | |
| int | level = 0 | |||
| ) | const |
| int OP_NetworkBox::getNexposedItems | ( | ) | const |
| int OP_NetworkBox::getNitems | ( | ) | const |
Items which are contained in this box can be OP_Nodes, OP_InputIndirects or OP_NetworkBoxes. They are all encapsulated in the OP_NetworkBoxItem class.
| void OP_NetworkBox::getNodes | ( | OP_NodeList & | list, | |
| int | level = 0 | |||
| ) | const |
A convenience method, sometimes it's handy to get a quick list of all the nodes in a netbox.
| virtual OP_Network* OP_NetworkBox::getParentNetwork | ( | ) | const [virtual] |
| virtual int OP_NetworkBox::getPicked | ( | ) | const [virtual] |
| void OP_NetworkBox::getPostIts | ( | UT_PtrArray< OP_PostIt * > & | list, | |
| int | level = 0 | |||
| ) | const |
| bool OP_NetworkBox::getResizing | ( | ) |
| void OP_NetworkBox::getSaveFlagsString | ( | UT_String & | cmd, | |
| const char * | flags, | |||
| bool | save_to_hip | |||
| ) | const |
Sets 'cmd' to be a string containing our values for the flags specified by 'flags'. If 'flags' == NULL, then we output values for all of our flags.
| OP_Stat& OP_NetworkBox::getStat | ( | ) | [inline] |
Definition at line 249 of file OP_NetworkBox.h.
| const OP_Stat& OP_NetworkBox::getStat | ( | ) | const [inline] |
Definition at line 248 of file OP_NetworkBox.h.
| int OP_NetworkBox::getUniqueId | ( | ) | const [inline] |
Definition at line 271 of file OP_NetworkBox.h.
| virtual fpreal OP_NetworkBox::getW | ( | ) | const [virtual] |
Gives you the w/h of the netbox as you see it, meaning if the netbox is minimized, you get the minimized size.
Implements OP_NetworkBoxItem.
| virtual fpreal OP_NetworkBox::getX | ( | ) | const [virtual] |
Get the position of this box. Units are absolute, as opposed to relative units found in OPUI.
Implements OP_NetworkBoxItem.
| virtual fpreal OP_NetworkBox::getY | ( | ) | const [virtual] |
Implements OP_NetworkBoxItem.
| bool OP_NetworkBox::load | ( | UT_IStream & | is | ) |
Load the contents of the stream into the attributes of this network box; if binary is nonzero, load in binary mode. Loading doesn't send the OP_NETWORKBOX_CREATED message to the network; the caller is responsible for doing that.
| static OP_NetworkBox* OP_NetworkBox::lookupNetworkBox | ( | int | unique_id | ) | [static] |
Each netbox has a unique id. This is used primarily for undos, as we also keep a list of netboxes in order of id, so lookup by id becomes quite quick.
| bool OP_NetworkBox::removeAllItems | ( | bool | do_reparent = false |
) |
| bool OP_NetworkBox::removeItem | ( | OP_NetworkBoxItem * | item, | |
| bool | propagate_parent_event = true, |
|||
| bool | do_reparent = false | |||
| ) |
Remove the item from this box. The item's owner box is set to NULL.
| bool OP_NetworkBox::removeItems | ( | UT_PtrArray< OP_NetworkBoxItem * > & | items | ) |
Given an area defined by the absolute coordinates (xmin, ymin) - (xmax, ymax), resize the netbox if necessary to ensure that the area can fit inside this box. Will ONLY resize if the box is too small. Will NOT add a buffer border around its contents for prettiness.
| void OP_NetworkBox::resizeToFit | ( | ) |
Using the netbox's current X,Y, width, and height data, resize the netbox if necessary to fit its contents. Will ONLY resize if the box is too small. WILL add a small buffer border around its contents for prettiness.
| int OP_NetworkBox::save | ( | ostream & | os, | |
| const OP_SaveFlags & | flags | |||
| ) |
Save the attributes of this network box to the ostream.
| int OP_NetworkBox::saveCommand | ( | ostream & | os, | |
| const char * | name, | |||
| int | dogeneral | |||
| ) | const |
Used by opscript, this outputs the sequence of hscript commands necessary to recreate this network box. Does not script the box's contents. 'dogeneral' is set when opscript is generating a macro.
| virtual bool OP_NetworkBox::setColor | ( | const UT_Color & | color | ) | [virtual] |
The colour used to display our background. Returns true if the color changed.
Reimplemented from OP_NetworkBoxItem.
| bool OP_NetworkBox::setContents | ( | UT_PtrArray< OP_NetworkBoxItem * > & | items, | |
| bool | snap_to_bounds | |||
| ) |
Sets the network boxes contents to be exactly the items in 'items' (i.e. removes any previous contents not in 'items'). Set 'snap_to_bounds' to true if you'd like us to make the netbox's dimensions snap to form a nice snug fit around its new contents.
| static void OP_NetworkBox::setDragbarHeight | ( | fpreal | height | ) | [inline, static] |
Initialize the dragbar height for the network box to use. This gives it a more accurate idea of what its bounds are.
Definition at line 289 of file OP_NetworkBox.h.
| void OP_NetworkBox::setH | ( | fpreal | h, | |
| bool | force = false | |||
| ) |
| bool OP_NetworkBox::setHWithBoundsChecks | ( | fpreal | h | ) |
Set the network box's width like setH(), but first check if the new height is valid. This method wraps the resizing operation with calls to setResizing(true) and setResizing(false).
| void OP_NetworkBox::setMarked | ( | bool | flag | ) |
A very general purpose method used to temporarily mark this network box as being involved in an operation. Very useful if e.g. we have a set of nodes and network boxes to apply an operation to. In this case we want to mark each netbox as we apply our op to it and its contents, in case any of the nodes we're passed happen to be in one of those netboxes. In this way we can quickly check if a node's owning box has been marked, and avoid duplicately applying the operation to the node again. REMEMBER to UNMARK all netboxes you marked once you're done with your operation!
| bool OP_NetworkBox::setMinimized | ( | bool | isminimized, | |
| bool | update_position, | |||
| bool | propagate_parent_event | |||
| ) |
Set whether this box is currently minimized If update_position is true, then the box is moved to accomodate the minimized status. If propagate_parent_event is true, an event is sent to the network about our minimized state.
| bool OP_NetworkBox::setName | ( | const UT_String & | name | ) |
The name which is used for identification and in displays of this box. setName() returns true if the name change was successful, and alters the name slightly if necessary to make it unique within this network.
| virtual int OP_NetworkBox::setPicked | ( | int | on_off, | |
| bool | propagate_parent_event = true | |||
| ) | [virtual] |
Set whether this box is picked; returns true if the picked status has changed. Setting 'propagate_parent_event' to false stops this method from notifying the network of this change, useful when we're picking a lot of items at once, it's inefficient to trigger a callback for each pick separately, can just do one update at the end
Implements OP_NetworkBoxItem.
| void OP_NetworkBox::setResizing | ( | bool | resizing | ) |
ALWAYS call this with 'resizing' == true before you do any resizing operations (e.g. setW()), and call it after you're done resizing with 'resizing' == false. You should only do this once for each group of resizing operations on the same netbox.
This method: 1) ensures we get a proper undo block around all the resize ops, and 2) allows you to use setXY() to stretch the box to the left (otherwise, setXY() just moves the box)
| void OP_NetworkBox::setW | ( | fpreal | w, | |
| bool | force = false | |||
| ) |
Get and set the width and height of this box. Units are absolute as opposed to the relative units found in OPUI. If the width or height specified is smaller than that which will contain all of the items, the width or height respectively will only be adjusted to the minimum size required to contain the items. To avoid this automatic size check, set 'force' to true.
| bool OP_NetworkBox::setWWithBoundsChecks | ( | fpreal | w | ) |
Set the network box's width like setW(), but first check if the new width is valid. This method wraps the resizing operation with calls to setResizing(true) and setResizing(false).
Same as setXY(), but here we can force the box to take on these X/Y coordinates, even if our contents don't fit us any more. The propagate_parent_event tells this method whether or not it should send and event after moving the network box -- this should normally be set to true.
Set the coordinates for this box (lower left corner) in absolute units. NOTE: If myResizing is set, then setXY does NOT move the box, but effectively resizes it by moving the lower/left corner of the box without moving its contents, and this may result in a change in myW and/or myH.
Implements OP_NetworkBoxItem.
Set the network box's location like setXY(), but first check if the new position is valid. This method wraps the resizing operation with calls to setResizing(true) and setResizing(false).
| void OP_NetworkBox::snapToBounds | ( | bool | incl_buff_border = true |
) |
Automatically alters myX, myY, myW, myH in order to snap the size of the netbox to the minimum bounding box enclosing its contents. Will ALWAYS resize the box to the minimum bounding box size, unlike resizeToFit(). Set 'incl_buff_border' to true if you want a small buffer border to make the layout look pretty.
1.5.9