HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_StickyNoteUtils.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UN_StickyNoteUtils.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UN_StickyNoteUtils_h__
13 #define __UN_StickyNoteUtils_h__
14 
15 
16 #include "UN_API.h"
17 #include "UN_GraphData.h"
18 
19 
20 namespace UN_StickyNoteUtils
21 {
22  /// Returns true if the sticky_note by the given ID is valid
23  /// in the given graph.
24  static inline bool
25  isValid( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
26  {
27  return graph_data && graph_data->isValid( sticky_note_id );
28  }
29 
30  /// Sets the sticky note's name that differentiates it among its siblings.
31  static inline void
32  setName( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
33  const UT_StringRef &name )
34  {
35  if( graph_data )
36  graph_data->setStickyNoteName( sticky_note_id, name );
37  }
38 
39  /// Returns the sticky note name that differentiates it among its siblings.
40  static inline const UT_StringHolder &
41  name( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
42  {
43  return graph_data
44  ? graph_data->stickyNoteData().name( sticky_note_id )
46  }
47 
48  /// Sets the sticky note's contents.
49  static inline void
50  setText( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
51  const UT_StringRef &text )
52  {
53  if( graph_data )
54  graph_data->stickyNoteData().setText( sticky_note_id, text );
55  }
56 
57  /// Returns the name of the sticky note's conents.
58  static inline const UT_StringHolder &
59  text( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
60  {
61  return graph_data
62  ? graph_data->stickyNoteData().text( sticky_note_id )
64  }
65 
66  /// Sets the sticky note's location in the graph editor.
67  static inline void
68  setPosition( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
69  const UT_Vector2R &position )
70  {
71  if( graph_data )
72  graph_data->stickyNoteData().setPosition( sticky_note_id, position);
73  }
74 
75  /// Returns the sticky note's position in the graph editor.
76  static inline const UT_Vector2D &
77  position( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
78  {
79  return graph_data
80  ? graph_data->stickyNoteData().position( sticky_note_id )
82  }
83 
84  /// Sets the sticky note's width and height.
85  static inline void
86  setDimensions( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
87  const UT_Vector2R &dimensions )
88  {
89  if( graph_data )
90  graph_data->stickyNoteData().setDimensions(
91  sticky_note_id, dimensions );
92  }
93 
94  /// Returns the sticky note's dimensions (width & height).
95  static inline const UT_Vector2D &
96  dimensions( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
97  {
98  return graph_data
99  ? graph_data->stickyNoteData().dimensions( sticky_note_id )
101  }
102 
103  /// Sets the sticky note's (background) color.
104  static inline void
105  setColor( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
106  const UT_Color &color )
107  {
108  if( graph_data )
109  graph_data->stickyNoteData().setColor( sticky_note_id, color );
110  }
111 
112  /// Returns the sticky note's (background) color.
113  static inline const UT_Color &
114  color( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
115  {
116  return graph_data
117  ? graph_data->stickyNoteData().color( sticky_note_id )
119  }
120 
121  /// Sets the sticky note's text (foreground) color.
122  static inline void
123  setTextColor( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
124  const UT_Color &color )
125  {
126  if( graph_data )
127  graph_data->stickyNoteData().setTextColor( sticky_note_id, color );
128  }
129 
130  /// Returns the sticky note's text (foreground) color.
131  static inline const UT_Color &
132  textColor( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
133  {
134  return graph_data
135  ? graph_data->stickyNoteData().textColor( sticky_note_id )
137  }
138 
139  /// Sets the sticky note's text size.
140  static inline void
141  setTextSize( UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id,
142  float text_size )
143  {
144  if( graph_data )
145  graph_data->stickyNoteData().setTextSize( sticky_note_id,
146  text_size );
147  }
148 
149  /// Returns the sticky note's text size.
150  static inline float
151  textSize( const UN_GraphData *graph_data, UN_StickyNoteID sticky_note_id )
152  {
153  return graph_data
154  ? graph_data->stickyNoteData().textSize( sticky_note_id )
156  }
157 
158  /// Sets the sticky note's collapsed (minimized) state.
159  static inline void
160  setCollapsed( UN_GraphData *graph_data,
161  UN_StickyNoteID sticky_note_id, bool is_collapsed )
162  {
163  if( graph_data )
164  graph_data->stickyNoteData().setCollapsed(
165  sticky_note_id, is_collapsed );
166  }
167 
168  /// Returns true if the sticky note is collapsed (minimized).
169  static inline bool
170  isCollapsed( const UN_GraphData *graph_data,
171  UN_StickyNoteID sticky_note_id )
172  {
173  return graph_data
174  ? graph_data->stickyNoteData().isCollapsed( sticky_note_id )
176  }
177 
178  /// Sets the flag on the sticky note to avoid drawing its background,
179  /// effectively making it transparent.
180  static inline void
181  setBackgroundHidden( UN_GraphData *graph_data,
182  UN_StickyNoteID sticky_note_id, bool is_hidden )
183  {
184  if( graph_data )
185  graph_data->stickyNoteData().setBackgroundHidden(
186  sticky_note_id, is_hidden );
187  }
188 
189  /// Returns true if the background of the sticky note is not drawn,
190  /// effectively making it transparent.
191  static inline bool
192  isBackgroundHidden( const UN_GraphData *graph_data,
193  UN_StickyNoteID sticky_note_id )
194  {
195  return graph_data
196  ? graph_data->stickyNoteData().isBackgroundHidden( sticky_note_id )
198  }
199 }
200 
201 #endif
202 
void setColor(UN_StickyNoteID note_id, const UT_Color &color)
Sets the sticky notes's background color in the graph editor.
static const auto theDefTextSize
static const auto theDefCollapsed
static const auto theDefPos
void setStickyNoteName(UN_StickyNoteID sticky_note, const UT_StringRef &name)
Sets the name of the given sticky note.
static const UT_StringHolder theDefText
const UT_Color & textColor(UN_StickyNoteID note_id) const
Returns the sticky note's text (foreground) color in the graph editor.
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.
const UT_Vector2D & dimensions(UN_StickyNoteID note_id) const
Returns the sticky note's dimensions (width & height).
bool isValid(UN_NodeID node) const
Definition: UN_GraphData.h:472
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.
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.
GLuint const GLchar * name
Definition: glcorearb.h:786
const UT_StringHolder & text(UN_StickyNoteID note_id) const
Returns the sticky note's contents.
static const auto theDefBackgroundHidden
UN_StickyNoteData & stickyNoteData()
Returns the container of data for the sticky notes in the graph.
Definition: UN_GraphData.h:523
static const auto theDefTextColor
void setDimensions(UN_StickyNoteID note_id, const UT_Vector2D &dimensions)
Sets the sticky note's width and height.
void setTextColor(UN_StickyNoteID note_id, const UT_Color &text_color)
Sets the sticky notes's text (foreground) color in the graph editor.
GLuint color
Definition: glcorearb.h:1261
const UT_Color & color(UN_StickyNoteID note_id) const
Returns the sticky note's background color in the graph editor.
void setCollapsed(UN_StickyNoteID note_id, bool is_collapsed)
Sets the sticky note's collapsed (minimized) state.
static const auto theDefColor
bool isBackgroundHidden(UN_StickyNoteID note_id) const
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.
static const auto theDefDim
void setTextSize(UN_StickyNoteID note_id, float text_size)
Sets the sticky note's text size.