12 #ifndef __UN_StickyNoteData_h__
13 #define __UN_StickyNoteData_h__
55 void setCapacityIfNeeded(
UN_DataSize min_capacity );
78 UN_StickyNoteID addStickyNote();
81 void clearStickyNote(UN_StickyNoteID sticky_note_id );
87 bool removeStickyNote( UN_StickyNoteID sticky_note_id );
91 void removeAllStickyNotes(
bool reset_next_id );
95 bool isValid( UN_StickyNoteID sticky_note_id )
const
110 {
return UN_StickyNoteID( UN_DataIndexMap::IDIterator::operator*() ); }
124 {
return UN_StickyNoteID(
125 UN_DataIndexMap::OrderedIDIterator::operator*() ); }
134 return IDRange( id_range.begin(), id_range.end() );
149 return reinterpret_cast<UN_StickyNoteIDList&&
>( std::move(
dataIDs() ));
156 return reinterpret_cast<UN_StickyNoteIDList&&
>(
167 || UN_Utils::isValidGraphItemName( name, myNameSafeChars ));
168 setData( myName, note_id, name );
181 setData( myText, note_id, text );
187 return getDataRef( myText, note_id, theDefText );
193 setData( myPosition, note_id, position );
199 return getDataRef( myPosition, note_id, theDefPos );
205 setData( myDimensions, note_id, dimensions );
211 return getDataRef( myDimensions, note_id, theDefDim );
217 setData( myColor, note_id, color );
223 return getDataRef( myColor, note_id, theDefColor );
229 setData( myTextColor, note_id, text_color );
235 return getDataRef( myTextColor, note_id, theDefTextColor );
241 setData( myTextSize, note_id, text_size );
247 return getDataRef( myTextSize, note_id, theDefTextSize );
253 setData( myIsCollapsed, note_id, is_collapsed );
259 return getDataVal( myIsCollapsed, note_id, theDefCollapsed );
266 setData( myIsBackgroundHidden, note_id, is_hidden );
273 return getDataVal( myIsBackgroundHidden, note_id,
274 theDefBackgroundHidden);
281 myCheckValidNames = flag;
287 myNameSafeChars = safe_chars;
294 return UN_StickyNoteIndex(
314 void addCoreData( UN_StickyNoteIndex sticky_note_index );
317 void clearCoreData( UN_StickyNoteIndex sticky_note_index );
321 void removeCoreData()
326 void removeAllCoreData();
329 void setCoreDataCapacityIfNeeded(
UN_DataSize min_capacity );
332 bool isCoreDataSizeConsistent(
UN_DataSize expected_size )
const;
333 bool isCoreDataSizeConsistent()
const
334 {
return isCoreDataSizeConsistent( myName.size() ); }
338 bool isDataSizeConsistent()
const;
345 static inline const auto theDefColor =
347 static inline const auto theDefTextColor =
UT_BLACK;
348 static inline const auto theDefTextSize = 0.0F;
349 static inline const auto theDefCollapsed =
false;
350 static inline const auto theDefBackgroundHidden =
false;
386 bool myCheckValidNames =
false;
UN_StickyNoteIndex stickyNoteIndex(UN_StickyNoteID id) const
Returns the sticky note's data index into the data buffer arrays.
void setColor(UN_StickyNoteID note_id, const UT_Color &color)
Sets the sticky notes's background color in the graph editor.
Iterator for traversing valid sticky note IDs in an ascending order.
#define SYS_STATIC_ASSERT(expr)
OrderedIDIterator(const UN_DataIndexMap::OrderedIDIterator &id_iterator)
void setCheckValidStickyNoteNames(bool flag)
Asserts that the sticky note names are alphanumeric.
UN_CustomStickyNoteData * customStickyNoteData()
UT_Vector2T< fpreal64 > UT_Vector2D
static const UT_StringHolder theDefText
bool isValid(UN_DataID data_id) const
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Iterator for traversing valid data IDs in the map.
const UT_Color & textColor(UN_StickyNoteID note_id) const
Returns the sticky note's text (foreground) color in the graph editor.
Iterator for traversing valid sticky note IDs.
UN_StickyNoteIDList sortedStickyNoteIDs() const
Returns a list of all the valid sticky note IDs in the graph.
UN_Data & operator=(UN_Data &&)
const UT_Vector2D & position(UN_StickyNoteID note_id) const
Returns the sticky note's position in the graph editor.
const UT_StringHolder & name(UN_StickyNoteID note_id) const
Returns the name that identifies the sticky notes among its siblings.
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
UN_DataIndex dataIndex(UN_DataID id) const
const UT_Vector2D & dimensions(UN_StickyNoteID note_id) const
Returns the sticky note's dimensions (width & height).
void setBackgroundHidden(UN_StickyNoteID note_id, bool is_hidden)
void setText(UN_StickyNoteID note_id, const UT_StringRef &text)
Sets the sticky note's contents text.
UN_CustomData * customData()
Returns the custom data container, if one was provided.
const UN_CustomStickyNoteData * customStickyNoteData() const
static const UT_StringHolder theEmptyString
ROI OIIO_API text_size(string_view text, int fontsize=16, string_view fontname="")
void setPosition(UN_StickyNoteID note_id, const UT_Vector2D &position)
Sets the sticky note's location in the graph editor.
UN_DataIDList dataIDs() const
Returns a list of all the valid IDs in this container.
IDIterator(const UN_DataIndexMap::IDIterator &id_iterator)
Data buffer specialization for boolean (bit) values.
GLuint const GLchar * name
V getDataVal(const B &buffer, UN_DataID id, const V &default_value) const
const UT_StringHolder & text(UN_StickyNoteID note_id) const
Returns the sticky note's contents.
UN_DataIndexMap::IDRange IDRange
Returns a range for iterating valid IDs.
bool isValid(UN_StickyNoteID sticky_note_id) const
OrderedIDRange orderedIDRange() const
Maintains a mapping from data ID to data index in the data buffer.
void setStickyNoteNameSafeChars(const UT_StringRef &safe_chars)
A set of additional characters that are legal in sticky note names.
UN_StickyNoteIDList stickyNoteIDs() const
Returns a list of all the valid sticky note IDs in the graph.
void setDimensions(UN_StickyNoteID note_id, const UT_Vector2D &dimensions)
Sets the sticky note's width and height.
Iterator for traversing valid data IDs in the map in an ordered fashion.
void setTextColor(UN_StickyNoteID note_id, const UT_Color &text_color)
Sets the sticky notes's text (foreground) color in the graph editor.
SIM_API const UT_StringHolder position
void setData(B &buffer, UN_DataID id, const V &value)
Helper method to copy-assign the value to an entry in the data buffer.
const UT_Color & color(UN_StickyNoteID note_id) const
Returns the sticky note's background color in the graph editor.
UN_DataSize size() const
Returns the number of valid data items in the buffer.
void setCollapsed(UN_StickyNoteID note_id, bool is_collapsed)
Sets the sticky note's collapsed (minimized) state.
value_type operator*() const
UN_DataIDList sortedDataIDs() const
Returns a sorted list of all the valid IDs in this container.
value_type operator*() const
UN_DataIndexMap::OrderedIDRange OrderedIDRange
Returns a range for iterating valid IDs in an ascending order.
bool isBackgroundHidden(UN_StickyNoteID note_id) const
const V & getDataRef(const B &buffer, UN_DataID id, const V &default_value) const
Helper method to return a const ref to an entry in the data buffer.
void setName(UN_StickyNoteID note_id, const UT_StringRef &name)
Sets the sticky note name that differentiates it among its siblings.
UT_UniquePtr< UN_CustomStickyNoteData > UN_CustomStickyNoteDataPtr
bool isCollapsed(UN_StickyNoteID note_id) const
Returns true if the sticky note is collapsed (minimized).
float textSize(UN_StickyNoteID note_id) const
Returns the sticky note's text size.
OrderedIDRange orderedIDRange() const
void setTextSize(UN_StickyNoteID note_id, float text_size)
Sets the sticky note's text size.