HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_PostIt Class Reference

#include <OP_PostIt.h>

+ Inheritance diagram for OP_PostIt:

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_PostItNoteFlagsflags () const
 
OP_PostItNoteFlagsflags ()
 
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_StringgetItemName () const override
 
bool setItemName (const UT_String &name) override
 
bool setText (const UT_String &text)
 
virtual const UT_StringgetText () const
 
bool setTextSize (fpreal size)
 
fpreal getTextSize () const
 
bool setTextColor (const UT_Color &clr)
 
const UT_ColorgetTextColor () 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_NetworkgetParentNetwork () 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_NetworkBoxgetOwnerBox () const
 
bool hasOwnerBox (const OP_NetworkBoxItem *item) const
 
OP_NetworkBoxgetMinimizedOwnerBox () 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_NetworkgetCreator () const
 
OP_NetworkgetCodeCreator () 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_PostItlookupPostItNote (int unique_id)
 
static const UT_ColordefaultColor ()
 Control the default color used on new post it notes. More...
 
static void setDefaultColor (const UT_Color *color)
 
static const UT_ColordefaultTextColor ()
 
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_NetworkBoxItemlookupItem (const OP_ItemType &type, int64 id)
 
static OP_NetworkBoxItemlookupItem (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_NonCopyableoperator= (const UT_NonCopyable &)=delete
 
- Protected Attributes inherited from OP_NetworkBoxItem
UT_Color myColor
 

Detailed Description

Definition at line 42 of file OP_PostIt.h.

Constructor & Destructor Documentation

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.

OP_PostIt::~OP_PostIt ( )
override

Member Function Documentation

static const UT_Color& OP_PostIt::defaultColor ( )
static

Control the default color used on new post it notes.

static const UT_Color& OP_PostIt::defaultTextColor ( )
static
const OP_PostItNoteFlags& OP_PostIt::flags ( ) const
inline

Definition at line 61 of file OP_PostIt.h.

OP_PostItNoteFlags& OP_PostIt::flags ( )
inline

Definition at line 62 of file OP_PostIt.h.

bool OP_PostIt::getDrawBackground ( ) const
inline

Definition at line 107 of file OP_PostIt.h.

void OP_PostIt::getFullPath ( UT_String str) const
void OP_PostIt::getFullPath ( UT_WorkBuffer str) const
fpreal OP_PostIt::getH ( ) 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.

const UT_String& OP_PostIt::getItemName ( ) const
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.

OP_ItemType OP_PostIt::getItemType ( ) const
overridevirtual

Our children should implement this and return what type of item they are.

Implements OP_NetworkBoxItem.

int64 OP_PostIt::getItemUniqueId ( ) const
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.

OP_Network* OP_PostIt::getParentNetwork ( ) const
overridevirtual

Returns the network that is our parent.

Implements OP_NetworkBoxItem.

bool OP_PostIt::getPicked ( ) const
overridevirtual

Returns true if this box is currently picked.

Implements OP_NetworkBoxItem.

bool OP_PostIt::getResizing ( )
virtual const UT_String& OP_PostIt::getText ( ) const
inlinevirtual

Definition at line 95 of file OP_PostIt.h.

const UT_Color& OP_PostIt::getTextColor ( ) const
inline

Definition at line 103 of file OP_PostIt.h.

fpreal OP_PostIt::getTextSize ( ) const
inline

Definition at line 99 of file OP_PostIt.h.

int OP_PostIt::getUniqueId ( ) const
inline

Definition at line 79 of file OP_PostIt.h.

fpreal OP_PostIt::getW ( ) const
overridevirtual

Implements OP_NetworkBoxItem.

fpreal OP_PostIt::getX ( ) const
overridevirtual

Implements OP_NetworkBoxItem.

fpreal OP_PostIt::getY ( ) const
overridevirtual

Implements OP_NetworkBoxItem.

virtual bool OP_PostIt::load ( UT_IStream is,
const char *  ext = "",
const char *  path = 0 
)
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.

static OP_PostIt* OP_PostIt::lookupPostItNote ( int  unique_id)
static

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 OP_ERROR OP_PostIt::save ( std::ostream &  os,
const OP_SaveFlags sflags,
const char *  path_prefix 
)
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 OP_ERROR OP_PostIt::saveIntrinsic ( std::ostream &  os,
const OP_SaveFlags sflags 
)
virtual
static void OP_PostIt::setDefaultColor ( const UT_Color color)
static
static void OP_PostIt::setDefaultTextColor ( const UT_Color color)
static
bool OP_PostIt::setDrawBackground ( bool  draw_background)
void OP_PostIt::setH ( fpreal  h,
bool  force = false 
)
bool OP_PostIt::setHWithBoundsChecks ( fpreal  h)
bool OP_PostIt::setItemName ( const UT_String name)
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.

bool OP_PostIt::setPicked ( bool  on_off,
bool  propagate_parent_event = true 
)
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)
void OP_PostIt::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_PostIt::setWWithBoundsChecks ( fpreal  h)
void OP_PostIt::setXY ( fpreal  x,
fpreal  y 
)
overridevirtual

Get and set the position of this item. Units are absolute, as opposed to relative units found in OPUI.

Implements OP_NetworkBoxItem.

void OP_PostIt::setXY ( fpreal  x,
fpreal  y,
bool  force,
bool  propagate_parent_event 
)

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.

Friends And Related Function Documentation

friend class OP_Network
friend

Definition at line 215 of file OP_PostIt.h.


The documentation for this class was generated from the following file: