HDK
|
#include <OP_PostIt.h>
Public Member Functions | |
OP_PostIt (const UT_String &name, OP_Network *net) | |
~OP_PostIt () override | |
void | setXY (fpreal x, fpreal y) override |
fpreal | getX () const override |
fpreal | getY () const override |
fpreal | getW () const override |
fpreal | getH () const override |
fpreal | getMaximizedW () const |
fpreal | getMaximizedH () const |
bool | setWWithBoundsChecks (fpreal h) |
bool | setHWithBoundsChecks (fpreal h) |
const OP_PostItNoteFlags & | flags () const |
OP_PostItNoteFlags & | flags () |
bool | getPicked () const override |
Returns true if this box is currently picked. More... | |
bool | setPicked (bool on_off, bool propagate_parent_event=true) override |
int | getUniqueId () const |
int64 | getItemUniqueId () const override |
Functions to get hip-file-unique ids for any item type. More... | |
bool | setName (const UT_String &name) |
const UT_String & | getItemName () const override |
bool | setItemName (const UT_String &name) override |
bool | setText (const UT_String &text) |
virtual const UT_String & | getText () const |
bool | setTextSize (fpreal size) |
fpreal | getTextSize () const |
bool | setTextColor (const UT_Color &clr) |
const UT_Color & | getTextColor () const |
bool | setDrawBackground (bool draw_background) |
bool | getDrawBackground () const |
OP_ItemType | getItemType () const override |
Our children should implement this and return what type of item they are. More... | |
OP_Network * | getParentNetwork () const override |
Returns the network that is our parent. More... | |
void | setW (fpreal w, bool force=false) |
void | setH (fpreal h, bool force=false) |
void | getItemBounds (fpreal &x1, fpreal &y1, fpreal &x2, fpreal &y2, bool incl_buff_border=true) const |
void | setResizing (bool resizing) |
bool | getResizing () |
void | setXY (fpreal x, fpreal y, bool force, bool propagate_parent_event) |
virtual OP_ERROR | save (std::ostream &os, const OP_SaveFlags &sflags, const char *path_prefix) |
virtual OP_ERROR | saveIntrinsic (std::ostream &os, const OP_SaveFlags &sflags) |
virtual bool | load (UT_IStream &is, const char *ext="", const char *path=0) |
void | getFullPath (UT_String &str) const |
void | getFullPath (UT_WorkBuffer &str) const |
bool | getMinimized () const |
Get whether this box is currently minimized. More... | |
bool | setMinimized (bool isminimized, bool update_position, bool propagate_parent_event) |
int | saveCommand (std::ostream &os) const |
int64 | getMemoryUsage (bool inclusive) const |
Returns the amount of memory owned by this OP_PostIt. More... | |
Public Member Functions inherited from OP_NetworkBoxItem | |
OP_NetworkBoxItem () | |
virtual | ~OP_NetworkBoxItem () |
bool | setXYWithBoundsChecks (fpreal x, fpreal y) |
void | validateSafeBounds (fpreal &x, fpreal &y) |
void | validateSafeBounds (fpreal &x, fpreal &y, fpreal &w, fpreal &h) |
void | moveToGoodPosition (bool relativetoinputs=true, bool moveinputs=true, bool moveoutputs=true, bool moveunconnected=true) |
void | setOwnerBox (OP_NetworkBox *box) |
OP_NetworkBox * | getOwnerBox () const |
bool | hasOwnerBox (const OP_NetworkBoxItem *item) const |
OP_NetworkBox * | getMinimizedOwnerBox () const |
void | getPathFromParent (UT_String &str, const OP_Node *parent) const |
void | getPathFromParent (UT_WorkBuffer &str, const OP_Node *parent) const |
void | getRelativePathTo (const OP_NetworkBoxItem *base_item, UT_String &result) const |
Returns the path of this item relative to 'base_item'. More... | |
virtual UT_Color | getColor () const |
Accessors for color used in the network view. More... | |
virtual bool | setColor (const UT_Color &color) |
virtual bool | getItemExpose () const |
virtual void | setItemExpose (bool expose) |
OP_Network * | getCreator () const |
OP_Network * | getCodeCreator () const |
void | getConnectedItems (OP_NetworkBoxItemList &connected, bool inputs, bool recursive, bool include_this_item) const |
Fills an array with all network box items connected to this item. More... | |
int64 | getMemoryUsage (bool inclusive) const |
Static Public Member Functions | |
static OP_PostIt * | lookupPostItNote (int unique_id) |
static const UT_Color & | defaultColor () |
Control the default color used on new post it notes. More... | |
static void | setDefaultColor (const UT_Color *color) |
static const UT_Color & | defaultTextColor () |
static void | setDefaultTextColor (const UT_Color *color) |
Static Public Member Functions inherited from OP_NetworkBoxItem | |
static fpreal | getMaxSafeX () |
The following methods return the safe extents of the position of items. More... | |
static fpreal | getMinSafeX () |
static fpreal | getMaxSafeY () |
static fpreal | getMinSafeY () |
static OP_NetworkBoxItem * | lookupItem (const OP_ItemType &type, int64 id) |
static OP_NetworkBoxItem * | lookupItem (const OP_ItemId &id) |
Friends | |
class | OP_Network |
Additional Inherited Members | |
Protected Member Functions inherited from UT_NonCopyableNS::UT_NonCopyable | |
UT_NonCopyable ()=default | |
~UT_NonCopyable ()=default | |
UT_NonCopyable (const UT_NonCopyable &)=delete | |
UT_NonCopyable & | operator= (const UT_NonCopyable &)=delete |
Protected Attributes inherited from OP_NetworkBoxItem | |
UT_Color | myColor |
Definition at line 42 of file OP_PostIt.h.
OP_PostIt::OP_PostIt | ( | 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.
|
override |
|
static |
Control the default color used on new post it notes.
|
static |
|
inline |
Definition at line 61 of file OP_PostIt.h.
|
inline |
Definition at line 62 of file OP_PostIt.h.
|
inline |
Definition at line 107 of file OP_PostIt.h.
void OP_PostIt::getFullPath | ( | UT_WorkBuffer & | str | ) | const |
|
overridevirtual |
Implements OP_NetworkBoxItem.
void OP_PostIt::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.
|
inlineoverridevirtual |
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 89 of file OP_PostIt.h.
|
overridevirtual |
Our children should implement this and return what type of item they are.
Implements OP_NetworkBoxItem.
|
inlineoverridevirtual |
Functions to get hip-file-unique ids for any item type.
Implements OP_NetworkBoxItem.
Definition at line 81 of file OP_PostIt.h.
fpreal OP_PostIt::getMaximizedH | ( | ) | const |
fpreal OP_PostIt::getMaximizedW | ( | ) | const |
int64 OP_PostIt::getMemoryUsage | ( | bool | inclusive | ) | const |
Returns the amount of memory owned by this OP_PostIt.
bool OP_PostIt::getMinimized | ( | ) | const |
Get whether this box is currently minimized.
|
overridevirtual |
Returns the network that is our parent.
Implements OP_NetworkBoxItem.
|
overridevirtual |
Returns true if this box is currently picked.
Implements OP_NetworkBoxItem.
bool OP_PostIt::getResizing | ( | ) |
|
inlinevirtual |
Definition at line 95 of file OP_PostIt.h.
|
inline |
Definition at line 103 of file OP_PostIt.h.
|
inline |
Definition at line 99 of file OP_PostIt.h.
|
inline |
Definition at line 79 of file OP_PostIt.h.
|
overridevirtual |
Implements OP_NetworkBoxItem.
|
overridevirtual |
Implements OP_NetworkBoxItem.
|
overridevirtual |
Implements OP_NetworkBoxItem.
|
virtual |
Load the contents of the stream into the attributes of this post-it note; if binary is nonzero, load in binary mode. Loading doesn't send the OP_POSTIT_NOTE_CREATED message to the network; the caller is responsible for doing that.
Each netbox has a unique id. This is used primarily for undos, as we also keep a list of notes in order of id, so lookup by id becomes quite quick.
|
virtual |
int OP_PostIt::saveCommand | ( | std::ostream & | os | ) | const |
Used by opscript, this outputs the sequence of hscript commands necessary to recreate this sticky note.
|
virtual |
bool OP_PostIt::setDrawBackground | ( | bool | draw_background | ) |
bool OP_PostIt::setHWithBoundsChecks | ( | fpreal | h | ) |
|
inlineoverridevirtual |
Implements OP_NetworkBoxItem.
Definition at line 91 of file OP_PostIt.h.
bool OP_PostIt::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_PostIt::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.
|
overridevirtual |
Set whether this box is picked; returns true if the picked status has changed.
Implements OP_NetworkBoxItem.
void OP_PostIt::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)
bool OP_PostIt::setText | ( | const UT_String & | text | ) |
bool OP_PostIt::setTextColor | ( | const UT_Color & | clr | ) |
bool OP_PostIt::setTextSize | ( | fpreal | size | ) |
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_PostIt::setWWithBoundsChecks | ( | fpreal | h | ) |
Get and set the position of this item. Units are absolute, as opposed to relative units found in OPUI.
Implements OP_NetworkBoxItem.
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.
|
friend |
Definition at line 215 of file OP_PostIt.h.