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