Panda3D
pgEntry.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file pgEntry.I
10  * @author drose
11  * @date 2002-03-13
12  */
13 
14 /**
15  * Changes the text currently displayed within the entry. This uses the
16  * Unicode encoding currently specified for the "focus" TextNode; therefore,
17  * the TextNode must exist before calling set_text().
18  *
19  * The return value is true if all the text is accepted, or false if some was
20  * truncated (see set_max_width(), etc.).
21  */
22 INLINE bool PGEntry::
23 set_text(const std::string &text) {
24  LightReMutexHolder holder(_lock);
25  TextNode *text_node = get_text_def(S_focus);
26  nassertr(text_node != nullptr, false);
27  return set_wtext(text_node->decode_text(text));
28 }
29 
30 /**
31  * Returns the text currently displayed within the entry, without any embedded
32  * properties characters.
33  *
34  * This uses the Unicode encoding currently specified for the "focus"
35  * TextNode; therefore, the TextNode must exist before calling get_text().
36  */
37 INLINE std::string PGEntry::
38 get_plain_text() const {
39  LightReMutexHolder holder(_lock);
40  TextNode *text_node = get_text_def(S_focus);
41  nassertr(text_node != nullptr, std::string());
42  return text_node->encode_wtext(get_plain_wtext());
43 }
44 
45 /**
46  * Returns the text currently displayed within the entry. This uses the
47  * Unicode encoding currently specified for the "focus" TextNode; therefore,
48  * the TextNode must exist before calling get_text().
49  */
50 INLINE std::string PGEntry::
51 get_text() const {
52  LightReMutexHolder holder(_lock);
53  TextNode *text_node = get_text_def(S_focus);
54  nassertr(text_node != nullptr, std::string());
55  return text_node->encode_wtext(get_wtext());
56 }
57 
58 /**
59  * Returns the number of characters of text in the entry. This is the actual
60  * number of visible characters, not counting implicit newlines due to
61  * wordwrapping, or formatted characters for text properties changes. If
62  * there is an embedded TextGraphic object, it counts as one character.
63  *
64  * This is also the length of the string returned by get_plain_text().
65  */
66 INLINE int PGEntry::
67 get_num_characters() const {
68  LightReMutexHolder holder(_lock);
69  return _text.get_num_characters();
70 }
71 
72 /**
73  * Returns the character at the indicated position in the entry. If the
74  * object at this position is a graphic object instead of a character, returns
75  * 0.
76  */
77 INLINE wchar_t PGEntry::
78 get_character(int n) const {
79  LightReMutexHolder holder(_lock);
80  return _text.get_character(n);
81 }
82 
83 /**
84  * Returns the graphic object at the indicated position in the pre-wordwrapped
85  * string. If the object at this position is a character instead of a graphic
86  * object, returns NULL.
87  */
88 INLINE const TextGraphic *PGEntry::
89 get_graphic(int n) const {
90  LightReMutexHolder holder(_lock);
91  return _text.get_graphic(n);
92 }
93 
94 /**
95  * Returns the TextProperties in effect for the object at the indicated
96  * position in the pre-wordwrapped string.
97  */
99 get_properties(int n) const {
100  LightReMutexHolder holder(_lock);
101  return _text.get_properties(n);
102 }
103 
104 /**
105  * Sets the current position of the cursor. This is the position within the
106  * text at which the next letter typed by the user will be inserted; normally
107  * it is the same as the length of the text.
108  */
109 INLINE void PGEntry::
110 set_cursor_position(int position) {
111  LightReMutexHolder holder(_lock);
112  if (_cursor_position != position) {
113  _cursor_position = position;
114  _cursor_stale = true;
115  _blink_start = ClockObject::get_global_clock()->get_frame_time();
116 
117 #ifdef THREADED_PIPELINE
118  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
119  update_cursor();
120  }
121 #endif
122  }
123 }
124 
125 /**
126  * Returns the current position of the cursor.
127  */
128 INLINE int PGEntry::
129 get_cursor_position() const {
130  LightReMutexHolder holder(_lock);
131  return _cursor_position;
132 }
133 
134 /**
135  * Returns the node position x of the cursor
136  */
137 
138 INLINE PN_stdfloat PGEntry::
139 get_cursor_X() const {
140  LightReMutexHolder holder(_lock);
141  return _cursor_def.get_x();
142 }
143 
144 /**
145  * Returns the node position y of the cursor
146  */
147 
148 INLINE PN_stdfloat PGEntry::
149 get_cursor_Y() const {
150  LightReMutexHolder holder(_lock);
151  return _cursor_def.get_y();
152 }
153 
154 
155 /**
156  * Sets the maximum number of characters that may be typed into the entry.
157  * This is a limit on the number of characters, as opposed to the width of the
158  * entry; see also set_max_width().
159  *
160  * If this is 0, there is no limit.
161  */
162 INLINE void PGEntry::
163 set_max_chars(int max_chars) {
164  LightReMutexHolder holder(_lock);
165  _max_chars = max_chars;
166 }
167 
168 /**
169  * Returns the current maximum number of characters that may be typed into the
170  * entry, or 0 if there is no limit. See set_max_chars().
171  */
172 INLINE int PGEntry::
173 get_max_chars() const {
174  LightReMutexHolder holder(_lock);
175  return _max_chars;
176 }
177 
178 /**
179  * Sets the maximum width of all characters that may be typed into the entry.
180  * This is a limit on the width of the formatted text, not a fixed limit on
181  * the number of characters; also set_max_chars().
182  *
183  * If this is 0, there is no limit.
184  *
185  * If _num_lines is more than 1, rather than being a fixed width on the whole
186  * entry, this becomes instead the wordwrap width (and the width limit on the
187  * entry is essentially _max_width * _num_lines).
188  */
189 INLINE void PGEntry::
190 set_max_width(PN_stdfloat max_width) {
191  LightReMutexHolder holder(_lock);
192  _max_width = max_width;
193  _text_geom_stale = true;
194 
195 #ifdef THREADED_PIPELINE
196  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
197  update_text();
198  update_cursor();
199  }
200 #endif
201 }
202 
203 /**
204  * Returns the current maximum width of the characters that may be typed into
205  * the entry, or 0 if there is no limit. See set_max_width().
206  */
207 INLINE PN_stdfloat PGEntry::
208 get_max_width() const {
209  LightReMutexHolder holder(_lock);
210  return _max_width;
211 }
212 
213 /**
214  * Sets the number of lines of text the PGEntry will use. This only has
215  * meaning if _max_width is not 0; _max_width indicates the wordwrap width of
216  * each line.
217  */
218 INLINE void PGEntry::
219 set_num_lines(int num_lines) {
220  LightReMutexHolder holder(_lock);
221  nassertv(num_lines >= 1);
222  if (_num_lines != num_lines) {
223  _num_lines = num_lines;
224  _text_geom_stale = true;
225  update_text();
226 
227 #ifdef THREADED_PIPELINE
228  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
229  update_cursor();
230  }
231 #endif
232  }
233 }
234 
235 /**
236  * Returns the number of lines of text the PGEntry will use, if _max_width is
237  * not 0. See set_num_lines().
238  */
239 INLINE int PGEntry::
240 get_num_lines() const {
241  LightReMutexHolder holder(_lock);
242  return _num_lines;
243 }
244 
245 /**
246  * Sets the number of times per second the cursor will blink while the entry
247  * has keyboard focus.
248  *
249  * If this is 0, the cursor does not blink, but is held steady.
250  */
251 INLINE void PGEntry::
252 set_blink_rate(PN_stdfloat blink_rate) {
253  LightReMutexHolder holder(_lock);
254  _blink_rate = blink_rate;
255 }
256 
257 /**
258  * Returns the number of times per second the cursor will blink, or 0 if the
259  * cursor is not to blink.
260  */
261 INLINE PN_stdfloat PGEntry::
262 get_blink_rate() const {
263  LightReMutexHolder holder(_lock);
264  return _blink_rate;
265 }
266 
267 /**
268  * Returns the Node that will be rendered to represent the cursor. You can
269  * attach suitable cursor geometry to this node.
270  */
272 get_cursor_def() {
273  LightReMutexHolder holder(_lock);
274  return _cursor_def;
275 }
276 
277 /**
278  * Removes all the children from the cursor_def node, in preparation for
279  * adding a new definition.
280  */
281 INLINE void PGEntry::
283  LightReMutexHolder holder(_lock);
284  _cursor_def.remove_node();
285  _cursor_def = _cursor_scale.attach_new_node("cursor");
286 }
287 
288 /**
289  * Sets whether the arrow keys (and home/end) control movement of the cursor.
290  * If true, they are active; if false, they are ignored.
291  */
292 INLINE void PGEntry::
293 set_cursor_keys_active(bool flag) {
294  LightReMutexHolder holder(_lock);
295  _cursor_keys_active = flag;
296 }
297 
298 /**
299  * Returns whether the arrow keys are currently set to control movement of the
300  * cursor; see set_cursor_keys_active().
301  */
302 INLINE bool PGEntry::
303 get_cursor_keys_active() const {
304  LightReMutexHolder holder(_lock);
305  return _cursor_keys_active;
306 }
307 
308 /**
309  * Specifies whether obscure mode should be enabled. In obscure mode, a
310  * string of asterisks is displayed instead of the literal text, e.g. for
311  * entering passwords.
312  *
313  * In obscure mode, the width of the text is computed based on the width of
314  * the string of asterisks, not on the width of the actual text. This has
315  * implications on the maximum length of text that may be entered if max_width
316  * is in effect.
317  */
318 INLINE void PGEntry::
319 set_obscure_mode(bool flag) {
320  LightReMutexHolder holder(_lock);
321  if (_obscure_mode != flag) {
322  _obscure_mode = flag;
323  _text_geom_stale = true;
324 
325 #ifdef THREADED_PIPELINE
326  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
327  update_text();
328  update_cursor();
329  }
330 #endif
331  }
332 }
333 
334 /**
335  * Specifies whether obscure mode is enabled. See set_obscure_mode().
336  */
337 INLINE bool PGEntry::
338 get_obscure_mode() const {
339  LightReMutexHolder holder(_lock);
340  return _obscure_mode;
341 }
342 
343 /**
344  * Specifies whether overflow mode should be enabled. In overflow mode, text
345  * can overflow the boundaries of the Entry element horizontally.
346  *
347  * Overflow mode only works when the number of lines is 1.
348  */
349 INLINE void PGEntry::
350 set_overflow_mode(bool flag) {
351  LightReMutexHolder holder(_lock);
352  if (_overflow_mode != flag) {
353  _overflow_mode = flag;
354  _text_geom_stale = true;
355  _cursor_stale = true;
356 
357 #ifdef THREADED_PIPELINE
358  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
359  update_text();
360  update_cursor();
361  }
362 #endif
363  }
364 }
365 
366 /**
367  * Specifies whether overflow mode is enabled. See set_overflow_mode().
368  */
369 INLINE bool PGEntry::
370 get_overflow_mode() const {
371  LightReMutexHolder holder(_lock);
372  return _overflow_mode;
373 }
374 
375 /**
376  * Specifies the name of the TextProperties structure added to the
377  * TextPropertiesManager that will be used to render candidate strings from
378  * the IME, used for typing characters in east Asian languages. Each
379  * candidate string represents one possible way to interpret the sequence of
380  * keys the user has just entered; it should not be considered typed yet, but
381  * it is important for the user to be able to see what he is considering
382  * entering.
383  *
384  * This particular method sets the properties for the subset of the current
385  * candidate string that the user can actively scroll through.
386  */
387 INLINE void PGEntry::
388 set_candidate_active(const std::string &candidate_active) {
389  LightReMutexHolder holder(_lock);
390  _candidate_active = candidate_active;
391 }
392 
393 /**
394  * See set_candidate_active().
395  */
396 INLINE const std::string &PGEntry::
397 get_candidate_active() const {
398  LightReMutexHolder holder(_lock);
399  return _candidate_active;
400 }
401 
402 /**
403  * Specifies the name of the TextProperties structure added to the
404  * TextPropertiesManager that will be used to render candidate strings from
405  * the IME, used for typing characters in east Asian languages. Each
406  * candidate string represents one possible way to interpret the sequence of
407  * keys the user has just entered; it should not be considered typed yet, but
408  * it is important for the user to be able to see what he is considering
409  * entering.
410  *
411  * This particular method sets the properties for the subset of the current
412  * candidate string that the user is not actively scrolling through.
413  */
414 INLINE void PGEntry::
415 set_candidate_inactive(const std::string &candidate_inactive) {
416  LightReMutexHolder holder(_lock);
417  _candidate_inactive = candidate_inactive;
418 }
419 
420 /**
421  * See set_candidate_inactive().
422  */
423 INLINE const std::string &PGEntry::
424 get_candidate_inactive() const {
425  LightReMutexHolder holder(_lock);
426  return _candidate_inactive;
427 }
428 
429 /**
430  * Returns the prefix that is used to define the accept event for all
431  * PGEntries. The accept event is the concatenation of this string followed
432  * by get_id().
433  */
434 INLINE std::string PGEntry::
436  return "accept-";
437 }
438 
439 /**
440  * Returns the prefix that is used to define the accept failed event for all
441  * PGEntries. This event is the concatenation of this string followed by
442  * get_id().
443  */
444 INLINE std::string PGEntry::
446  return "acceptfailed-";
447 }
448 
449 /**
450  * Returns the prefix that is used to define the overflow event for all
451  * PGEntries. The overflow event is the concatenation of this string followed
452  * by get_id().
453  */
454 INLINE std::string PGEntry::
456  return "overflow-";
457 }
458 
459 /**
460  * Returns the prefix that is used to define the type event for all PGEntries.
461  * The type event is the concatenation of this string followed by get_id().
462  */
463 INLINE std::string PGEntry::
464 get_type_prefix() {
465  return "type-";
466 }
467 
468 /**
469  * Returns the prefix that is used to define the erase event for all
470  * PGEntries. The erase event is the concatenation of this string followed by
471  * get_id().
472  */
473 INLINE std::string PGEntry::
475  return "erase-";
476 }
477 
478 /**
479  * Returns the prefix that is used to define the cursor event for all
480  * PGEntries. The cursor event is the concatenation of this string followed
481  * by get_id().
482  */
483 INLINE std::string PGEntry::
485  return "cursormove-";
486 }
487 
488 /**
489  * Returns the event name that will be thrown when the entry is accepted
490  * normally.
491  */
492 INLINE std::string PGEntry::
493 get_accept_event(const ButtonHandle &button) const {
494  return get_accept_prefix() + button.get_name() + "-" + get_id();
495 }
496 
497 /**
498  * Returns the event name that will be thrown when the entry cannot accept an
499  * input
500  */
501 INLINE std::string PGEntry::
502 get_accept_failed_event(const ButtonHandle &button) const {
503  return get_accept_failed_prefix() + button.get_name() + "-" + get_id();
504 }
505 
506 /**
507  * Returns the event name that will be thrown when too much text is attempted
508  * to be entered into the PGEntry, exceeding either the limit set via
509  * set_max_chars() or via set_max_width().
510  */
511 INLINE std::string PGEntry::
512 get_overflow_event() const {
513  return get_overflow_prefix() + get_id();
514 }
515 
516 /**
517  * Returns the event name that will be thrown whenever the user extends the
518  * text by typing.
519  */
520 INLINE std::string PGEntry::
521 get_type_event() const {
522  return get_type_prefix() + get_id();
523 }
524 
525 /**
526  * Returns the event name that will be thrown whenever the user erases
527  * characters in the text.
528  */
529 INLINE std::string PGEntry::
530 get_erase_event() const {
531  return get_erase_prefix() + get_id();
532 }
533 
534 /**
535  * Returns the event name that will be thrown whenever the cursor moves
536  */
537 INLINE std::string PGEntry::
538 get_cursormove_event() const {
539  return get_cursormove_prefix() + get_id();
540 }
541 
542 /**
543  * Changes the text currently displayed within the entry.
544  *
545  * The return value is true if all the text is accepted, or false if some was
546  * truncated (see set_max_width(), etc.).
547  */
548 INLINE bool PGEntry::
549 set_wtext(const std::wstring &wtext) {
550  LightReMutexHolder holder(_lock);
551  bool ret = _text.set_wtext(wtext);
552  if (_obscure_mode) {
553  ret = _obscure_text.set_wtext(std::wstring(_text.get_num_characters(), '*'));
554  }
555  _text_geom_stale = true;
556 #ifdef THREADED_PIPELINE
557  if (Pipeline::get_render_pipeline()->get_num_stages() > 1) {
558  update_text();
559  }
560 #endif
561  set_cursor_position(std::min(_cursor_position, _text.get_num_characters()));
562  return ret;
563 }
564 
565 /**
566  * Returns the text currently displayed within the entry, without any embedded
567  * properties characters.
568  */
569 INLINE std::wstring PGEntry::
570 get_plain_wtext() const {
571  LightReMutexHolder holder(_lock);
572  return _text.get_plain_wtext();
573 }
574 
575 /**
576  * Returns the text currently displayed within the entry.
577  */
578 INLINE std::wstring PGEntry::
579 get_wtext() const {
580  LightReMutexHolder holder(_lock);
581  return _text.get_wtext();
582 }
583 
584 /**
585  * Sets whether the input may be accepted--use to disable submission by the
586  * user
587  */
588 INLINE void PGEntry::
589 set_accept_enabled(bool enabled) {
590  LightReMutexHolder holder(_lock);
591  _accept_enabled = enabled;
592 }
A ButtonHandle represents a single button from any device, including keyboard buttons and mouse butto...
Definition: buttonHandle.h:26
get_name
Returns the name of the button.
Definition: buttonHandle.h:61
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
Definition: clockObject.h:91
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
Definition: clockObject.I:215
Similar to MutexHolder, but for a light reentrant mutex.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
Definition: nodePath.cxx:628
NodePath attach_new_node(PandaNode *node, int sort=0, Thread *current_thread=Thread::get_current_thread()) const
Attaches a new node, with or without existing parents, to the scene graph below the referenced node o...
Definition: nodePath.cxx:600
const std::string & get_candidate_active() const
See set_candidate_active().
Definition: pgEntry.I:397
PN_stdfloat get_cursor_X() const
Returns the node position x of the cursor.
Definition: pgEntry.I:139
std::string get_plain_text() const
Returns the text currently displayed within the entry, without any embedded properties characters.
Definition: pgEntry.I:38
std::string get_overflow_event() const
Returns the event name that will be thrown when too much text is attempted to be entered into the PGE...
Definition: pgEntry.I:512
void set_candidate_active(const std::string &candidate_active)
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be us...
Definition: pgEntry.I:388
void set_cursor_position(int position)
Sets the current position of the cursor.
Definition: pgEntry.I:110
std::wstring get_wtext() const
Returns the text currently displayed within the entry.
Definition: pgEntry.I:579
const std::string & get_candidate_inactive() const
See set_candidate_inactive().
Definition: pgEntry.I:424
const TextProperties & get_properties(int n) const
Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped ...
Definition: pgEntry.I:99
TextNode * get_text_def(int state) const
Returns the TextNode that will be used to render the text within the entry when the entry is in the i...
Definition: pgEntry.cxx:699
std::string get_type_event() const
Returns the event name that will be thrown whenever the user extends the text by typing.
Definition: pgEntry.I:521
NodePath get_cursor_def()
Returns the Node that will be rendered to represent the cursor.
Definition: pgEntry.I:272
void set_cursor_keys_active(bool flag)
Sets whether the arrow keys (and home/end) control movement of the cursor.
Definition: pgEntry.I:293
void set_max_chars(int max_chars)
Sets the maximum number of characters that may be typed into the entry.
Definition: pgEntry.I:163
void set_overflow_mode(bool flag)
Specifies whether overflow mode should be enabled.
Definition: pgEntry.I:350
std::string get_accept_failed_event(const ButtonHandle &button) const
Returns the event name that will be thrown when the entry cannot accept an input.
Definition: pgEntry.I:502
void set_num_lines(int num_lines)
Sets the number of lines of text the PGEntry will use.
Definition: pgEntry.I:219
PN_stdfloat get_cursor_Y() const
Returns the node position y of the cursor.
Definition: pgEntry.I:149
bool get_cursor_keys_active() const
Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_ke...
Definition: pgEntry.I:303
int get_num_characters() const
Returns the number of characters of text in the entry.
Definition: pgEntry.I:67
std::string get_cursormove_event() const
Returns the event name that will be thrown whenever the cursor moves.
Definition: pgEntry.I:538
std::string get_text() const
Returns the text currently displayed within the entry.
Definition: pgEntry.I:51
static std::string get_cursormove_prefix()
Returns the prefix that is used to define the cursor event for all PGEntries.
Definition: pgEntry.I:484
wchar_t get_character(int n) const
Returns the character at the indicated position in the entry.
Definition: pgEntry.I:78
void set_max_width(PN_stdfloat max_width)
Sets the maximum width of all characters that may be typed into the entry.
Definition: pgEntry.I:190
static std::string get_accept_failed_prefix()
Returns the prefix that is used to define the accept failed event for all PGEntries.
Definition: pgEntry.I:445
void set_candidate_inactive(const std::string &candidate_inactive)
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be us...
Definition: pgEntry.I:415
bool set_wtext(const std::wstring &wtext)
Changes the text currently displayed within the entry.
Definition: pgEntry.I:549
std::string get_erase_event() const
Returns the event name that will be thrown whenever the user erases characters in the text.
Definition: pgEntry.I:530
PN_stdfloat get_max_width() const
Returns the current maximum width of the characters that may be typed into the entry,...
Definition: pgEntry.I:208
bool get_overflow_mode() const
Specifies whether overflow mode is enabled.
Definition: pgEntry.I:370
static std::string get_accept_prefix()
Returns the prefix that is used to define the accept event for all PGEntries.
Definition: pgEntry.I:435
void set_obscure_mode(bool flag)
Specifies whether obscure mode should be enabled.
Definition: pgEntry.I:319
static std::string get_overflow_prefix()
Returns the prefix that is used to define the overflow event for all PGEntries.
Definition: pgEntry.I:455
int get_num_lines() const
Returns the number of lines of text the PGEntry will use, if _max_width is not 0.
Definition: pgEntry.I:240
void set_blink_rate(PN_stdfloat blink_rate)
Sets the number of times per second the cursor will blink while the entry has keyboard focus.
Definition: pgEntry.I:252
bool set_text(const std::string &text)
Changes the text currently displayed within the entry.
Definition: pgEntry.I:23
int get_cursor_position() const
Returns the current position of the cursor.
Definition: pgEntry.I:129
PN_stdfloat get_blink_rate() const
Returns the number of times per second the cursor will blink, or 0 if the cursor is not to blink.
Definition: pgEntry.I:262
static std::string get_type_prefix()
Returns the prefix that is used to define the type event for all PGEntries.
Definition: pgEntry.I:464
std::string get_accept_event(const ButtonHandle &button) const
Returns the event name that will be thrown when the entry is accepted normally.
Definition: pgEntry.I:493
const TextGraphic * get_graphic(int n) const
Returns the graphic object at the indicated position in the pre-wordwrapped string.
Definition: pgEntry.I:89
bool get_obscure_mode() const
Specifies whether obscure mode is enabled.
Definition: pgEntry.I:338
static std::string get_erase_prefix()
Returns the prefix that is used to define the erase event for all PGEntries.
Definition: pgEntry.I:474
int get_max_chars() const
Returns the current maximum number of characters that may be typed into the entry,...
Definition: pgEntry.I:173
void clear_cursor_def()
Removes all the children from the cursor_def node, in preparation for adding a new definition.
Definition: pgEntry.I:282
std::wstring get_plain_wtext() const
Returns the text currently displayed within the entry, without any embedded properties characters.
Definition: pgEntry.I:570
void set_accept_enabled(bool enabled)
Sets whether the input may be accepted–use to disable submission by the user.
Definition: pgEntry.I:589
const std::string & get_id() const
Returns the unique ID assigned to this PGItem.
Definition: pgItem.I:224
static Pipeline * get_render_pipeline()
Returns a pointer to the global render pipeline.
Definition: pipeline.I:18
bool set_wtext(const std::wstring &wtext)
Accepts a new text string and associated properties structure, and precomputes the wordwrapping layou...
std::wstring get_wtext() const
Returns a wstring that represents the contents of the text.
get_properties
Returns the default TextProperties that are applied to the text in the absence of any nested property...
int get_num_characters() const
Returns the number of characters of text, before wordwrapping.
const TextGraphic * get_graphic(int n) const
Returns the graphic object at the indicated position in the pre-wordwrapped string.
wchar_t get_character(int n) const
Returns the character at the indicated position in the pre-wordwrapped string.
std::wstring get_plain_wtext() const
Returns a wstring that represents the contents of the text, without any embedded properties character...
std::wstring decode_text(const std::string &text) const
Returns the given wstring decoded to a single-byte string, via the current encoding system.
Definition: textEncoder.I:490
std::string encode_wtext(const std::wstring &wtext) const
Encodes a wide-text string into a single-char string, according to the current encoding.
Definition: textEncoder.I:481
This defines a special model that has been constructed for the purposes of embedding an arbitrary gra...
Definition: textGraphic.h:37
The primary interface to this module.
Definition: textNode.h:48
This defines the set of visual properties that may be assigned to the individual characters of the te...