src/ascension/ui/text.h

changeset 194
7985c3b64460
parent 193
ddf690c0b36b
child 196
ac2ade047d5b
equal deleted inserted replaced
193:ddf690c0b36b 194:7985c3b64460
103 /** 103 /**
104 * Sets the text alignment. 104 * Sets the text alignment.
105 * 105 *
106 * @param node the text node 106 * @param node the text node
107 */ 107 */
108 static inline void asc_text_alignment( 108 void asc_text_alignment(
109 AscSceneNode *node, 109 AscText *node,
110 enum asc_text_alignment alignment 110 enum asc_text_alignment alignment
111 ) { 111 );
112 // TODO: does not need to be static
113 asc_set_flag_masked(node->flags, ASC_TEXT_ALIGNMENT_MASK, alignment);
114 asc_node_update(node);
115 }
116 112
117 /** 113 /**
118 * Decides whether the text shall be centered. 114 * Decides whether the text shall be centered.
119 * 115 *
120 * @param node the text node 116 * @param node the text node
121 * @param centered true when the text shall be centered 117 * @param centered true when the text shall be centered
122 */ 118 */
123 static inline void asc_text_centered( 119 void asc_text_centered(AscText *node, bool centered);
124 AscSceneNode *node,
125 bool centered
126 ) {
127 // TODO: does not need to be static
128 if (centered) {
129 asc_clear_flag(node->flags, ASC_TEXT_ALIGN_CENTERED);
130 } else {
131 asc_set_flag(node->flags, ASC_TEXT_ALIGN_CENTERED);
132 }
133 asc_node_update(node);
134 }
135 120
136 /** 121 /**
137 * Sets a new maximum width for the text. 122 * Sets a new maximum width for the text.
138 * 123 *
139 * @param node the text node 124 * @param node the text node
140 * @param max_width the new maximum width 125 * @param max_width the new maximum width
141 */ 126 */
142 static inline void asc_text_max_width( 127 void asc_text_max_width(AscText *node, unsigned max_width);
143 AscSceneNode *node,
144 unsigned max_width
145 ) {
146 // TODO: does not need to be static
147 ((AscText*)node)->max_width = max_width;
148 asc_node_update(node);
149 }
150 128
151 /** 129 /**
152 * Updates the content of a text node with formatted text. 130 * Updates the content of a text node with formatted text.
153 * 131 *
154 * @param text_node the node 132 * @param node the node
155 * @param format the format string 133 * @param format the format string
156 * @param ... the format arguments 134 * @param ... the format arguments
157 */ 135 */
158 void asc_text_printf( 136 void asc_text_printf(
159 AscText *text_node, 137 AscText *node,
160 const char *format, 138 const char *format,
161 ... 139 ...
162 ); 140 );
163 141
164 #endif //ASCENSION_UI_TEXT_H 142 #endif //ASCENSION_UI_TEXT_H

mercurial