00001 // Filename: pgEntry.I 00002 // Created by: drose (13Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: PGEntry::set_text 00018 // Access: Published 00019 // Description: Changes the text currently displayed within the 00020 // entry. This uses the Unicode encoding currently 00021 // specified for the "focus" TextNode; therefore, the 00022 // TextNode must exist before calling set_text(). 00023 // 00024 // The return value is true if all the text is accepted, 00025 // or false if some was truncated (see set_max_width(), 00026 // etc.). 00027 //////////////////////////////////////////////////////////////////// 00028 INLINE bool PGEntry:: 00029 set_text(const string &text) { 00030 LightReMutexHolder holder(_lock); 00031 TextNode *text_node = get_text_def(S_focus); 00032 nassertr(text_node != (TextNode *)NULL, false); 00033 return set_wtext(text_node->decode_text(text)); 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: PGEntry::get_plain_text 00038 // Access: Published 00039 // Description: Returns the text currently displayed within the 00040 // entry, without any embedded properties characters. 00041 // 00042 // This uses the Unicode encoding currently specified 00043 // for the "focus" TextNode; therefore, the TextNode 00044 // must exist before calling get_text(). 00045 //////////////////////////////////////////////////////////////////// 00046 INLINE string PGEntry:: 00047 get_plain_text() const { 00048 LightReMutexHolder holder(_lock); 00049 TextNode *text_node = get_text_def(S_focus); 00050 nassertr(text_node != (TextNode *)NULL, string()); 00051 return text_node->encode_wtext(get_plain_wtext()); 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: PGEntry::get_text 00056 // Access: Published 00057 // Description: Returns the text currently displayed within the 00058 // entry. This uses the Unicode encoding currently 00059 // specified for the "focus" TextNode; therefore, the 00060 // TextNode must exist before calling get_text(). 00061 //////////////////////////////////////////////////////////////////// 00062 INLINE string PGEntry:: 00063 get_text() const { 00064 LightReMutexHolder holder(_lock); 00065 TextNode *text_node = get_text_def(S_focus); 00066 nassertr(text_node != (TextNode *)NULL, string()); 00067 return text_node->encode_wtext(get_wtext()); 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: PGEntry::get_num_characters 00072 // Access: Published 00073 // Description: Returns the number of characters of text in the 00074 // entry. This is the actual number of visible 00075 // characters, not counting implicit newlines due to 00076 // wordwrapping, or formatted characters for text 00077 // properties changes. If there is an embedded 00078 // TextGraphic object, it counts as one character. 00079 // 00080 // This is also the length of the string returned by 00081 // get_plain_text(). 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE int PGEntry:: 00084 get_num_characters() const { 00085 LightReMutexHolder holder(_lock); 00086 return _text.get_num_characters(); 00087 } 00088 00089 //////////////////////////////////////////////////////////////////// 00090 // Function: PGEntry::get_character 00091 // Access: Published 00092 // Description: Returns the character at the indicated position in 00093 // the entry. If the object at this position is a 00094 // graphic object instead of a character, returns 0. 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE wchar_t PGEntry:: 00097 get_character(int n) const { 00098 LightReMutexHolder holder(_lock); 00099 return _text.get_character(n); 00100 } 00101 00102 //////////////////////////////////////////////////////////////////// 00103 // Function: PGEntry::get_graphic 00104 // Access: Published 00105 // Description: Returns the graphic object at the indicated position 00106 // in the pre-wordwrapped string. If the object at this 00107 // position is a character instead of a graphic object, 00108 // returns NULL. 00109 //////////////////////////////////////////////////////////////////// 00110 INLINE const TextGraphic *PGEntry:: 00111 get_graphic(int n) const { 00112 LightReMutexHolder holder(_lock); 00113 return _text.get_graphic(n); 00114 } 00115 00116 //////////////////////////////////////////////////////////////////// 00117 // Function: PGEntry::get_properties 00118 // Access: Published 00119 // Description: Returns the TextProperties in effect for the object 00120 // at the indicated position in the pre-wordwrapped 00121 // string. 00122 //////////////////////////////////////////////////////////////////// 00123 INLINE const TextProperties &PGEntry:: 00124 get_properties(int n) const { 00125 LightReMutexHolder holder(_lock); 00126 return _text.get_properties(n); 00127 } 00128 00129 //////////////////////////////////////////////////////////////////// 00130 // Function: PGEntry::set_cursor_position 00131 // Access: Published 00132 // Description: Sets the current position of the cursor. This is the 00133 // position within the text at which the next letter 00134 // typed by the user will be inserted; normally it is 00135 // the same as the length of the text. 00136 //////////////////////////////////////////////////////////////////// 00137 INLINE void PGEntry:: 00138 set_cursor_position(int position) { 00139 LightReMutexHolder holder(_lock); 00140 if (_cursor_position != position) { 00141 _cursor_position = position; 00142 _cursor_stale = true; 00143 _blink_start = ClockObject::get_global_clock()->get_frame_time(); 00144 } 00145 } 00146 00147 //////////////////////////////////////////////////////////////////// 00148 // Function: PGEntry::get_cursor_position 00149 // Access: Published 00150 // Description: Returns the current position of the cursor. 00151 //////////////////////////////////////////////////////////////////// 00152 INLINE int PGEntry:: 00153 get_cursor_position() const { 00154 LightReMutexHolder holder(_lock); 00155 return _cursor_position; 00156 } 00157 00158 //////////////////////////////////////////////////////////////////// 00159 // Function: PGEntry::get_cursor_X 00160 // Access: Published 00161 // Description: Returns the node position x of the cursor 00162 //////////////////////////////////////////////////////////////////// 00163 00164 INLINE PN_stdfloat PGEntry:: 00165 get_cursor_X() const { 00166 LightReMutexHolder holder(_lock); 00167 return _cursor_def.get_x(); 00168 } 00169 00170 //////////////////////////////////////////////////////////////////// 00171 // Function: PGEntry::get_cursor_y 00172 // Access: Published 00173 // Description: Returns the node position y of the cursor 00174 //////////////////////////////////////////////////////////////////// 00175 00176 INLINE PN_stdfloat PGEntry:: 00177 get_cursor_Y() const { 00178 LightReMutexHolder holder(_lock); 00179 return _cursor_def.get_y(); 00180 } 00181 00182 00183 //////////////////////////////////////////////////////////////////// 00184 // Function: PGEntry::set_max_chars 00185 // Access: Published 00186 // Description: Sets the maximum number of characters that may be 00187 // typed into the entry. This is a limit on the number 00188 // of characters, as opposed to the width of the entry; 00189 // see also set_max_width(). 00190 // 00191 // If this is 0, there is no limit. 00192 //////////////////////////////////////////////////////////////////// 00193 INLINE void PGEntry:: 00194 set_max_chars(int max_chars) { 00195 LightReMutexHolder holder(_lock); 00196 _max_chars = max_chars; 00197 } 00198 00199 //////////////////////////////////////////////////////////////////// 00200 // Function: PGEntry::get_max_chars 00201 // Access: Published 00202 // Description: Returns the current maximum number of characters that 00203 // may be typed into the entry, or 0 if there is no 00204 // limit. See set_max_chars(). 00205 //////////////////////////////////////////////////////////////////// 00206 INLINE int PGEntry:: 00207 get_max_chars() const { 00208 LightReMutexHolder holder(_lock); 00209 return _max_chars; 00210 } 00211 00212 //////////////////////////////////////////////////////////////////// 00213 // Function: PGEntry::set_max_width 00214 // Access: Published 00215 // Description: Sets the maximum width of all characters that may be 00216 // typed into the entry. This is a limit on the width 00217 // of the formatted text, not a fixed limit on the 00218 // number of characters; also set_max_chars(). 00219 // 00220 // If this is 0, there is no limit. 00221 // 00222 // If _num_lines is more than 1, rather than being a 00223 // fixed width on the whole entry, this becomes instead 00224 // the wordwrap width (and the width limit on the entry 00225 // is essentially _max_width * _num_lines). 00226 //////////////////////////////////////////////////////////////////// 00227 INLINE void PGEntry:: 00228 set_max_width(PN_stdfloat max_width) { 00229 LightReMutexHolder holder(_lock); 00230 _max_width = max_width; 00231 _text_geom_stale = true; 00232 } 00233 00234 //////////////////////////////////////////////////////////////////// 00235 // Function: PGEntry::get_max_width 00236 // Access: Published 00237 // Description: Returns the current maximum width of the characters 00238 // that may be typed into the entry, or 0 if there is no 00239 // limit. See set_max_width(). 00240 //////////////////////////////////////////////////////////////////// 00241 INLINE PN_stdfloat PGEntry:: 00242 get_max_width() const { 00243 LightReMutexHolder holder(_lock); 00244 return _max_width; 00245 } 00246 00247 //////////////////////////////////////////////////////////////////// 00248 // Function: PGEntry::set_num_lines 00249 // Access: Published 00250 // Description: Sets the number of lines of text the PGEntry will 00251 // use. This only has meaning if _max_width is not 0; 00252 // _max_width indicates the wordwrap width of each line. 00253 //////////////////////////////////////////////////////////////////// 00254 INLINE void PGEntry:: 00255 set_num_lines(int num_lines) { 00256 LightReMutexHolder holder(_lock); 00257 nassertv(num_lines >= 1); 00258 _num_lines = num_lines; 00259 _text_geom_stale = true; 00260 } 00261 00262 //////////////////////////////////////////////////////////////////// 00263 // Function: PGEntry::get_num_lines 00264 // Access: Published 00265 // Description: Returns the number of lines of text the PGEntry will 00266 // use, if _max_width is not 0. See set_num_lines(). 00267 //////////////////////////////////////////////////////////////////// 00268 INLINE int PGEntry:: 00269 get_num_lines() const { 00270 LightReMutexHolder holder(_lock); 00271 return _num_lines; 00272 } 00273 00274 //////////////////////////////////////////////////////////////////// 00275 // Function: PGEntry::set_blink_rate 00276 // Access: Published 00277 // Description: Sets the number of times per second the cursor will 00278 // blink while the entry has keyboard focus. 00279 // 00280 // If this is 0, the cursor does not blink, but is held 00281 // steady. 00282 //////////////////////////////////////////////////////////////////// 00283 INLINE void PGEntry:: 00284 set_blink_rate(PN_stdfloat blink_rate) { 00285 LightReMutexHolder holder(_lock); 00286 _blink_rate = blink_rate; 00287 } 00288 00289 //////////////////////////////////////////////////////////////////// 00290 // Function: PGEntry::get_blink_rate 00291 // Access: Published 00292 // Description: Returns the number of times per second the cursor 00293 // will blink, or 0 if the cursor is not to blink. 00294 //////////////////////////////////////////////////////////////////// 00295 INLINE PN_stdfloat PGEntry:: 00296 get_blink_rate() const { 00297 LightReMutexHolder holder(_lock); 00298 return _blink_rate; 00299 } 00300 00301 //////////////////////////////////////////////////////////////////// 00302 // Function: PGEntry::get_cursor_def 00303 // Access: Published 00304 // Description: Returns the Node that will be rendered to represent 00305 // the cursor. You can attach suitable cursor geometry 00306 // to this node. 00307 //////////////////////////////////////////////////////////////////// 00308 INLINE NodePath PGEntry:: 00309 get_cursor_def() { 00310 LightReMutexHolder holder(_lock); 00311 return _cursor_def; 00312 } 00313 00314 //////////////////////////////////////////////////////////////////// 00315 // Function: PGEntry::clear_cursor_def 00316 // Access: Published 00317 // Description: Removes all the children from the cursor_def node, in 00318 // preparation for adding a new definition. 00319 //////////////////////////////////////////////////////////////////// 00320 INLINE void PGEntry:: 00321 clear_cursor_def() { 00322 LightReMutexHolder holder(_lock); 00323 _cursor_def.remove_node(); 00324 _cursor_def = _cursor_scale.attach_new_node("cursor"); 00325 } 00326 00327 //////////////////////////////////////////////////////////////////// 00328 // Function: PGEntry::set_cursor_keys_active 00329 // Access: Published 00330 // Description: Sets whether the arrow keys (and home/end) control 00331 // movement of the cursor. If true, they are active; if 00332 // false, they are ignored. 00333 //////////////////////////////////////////////////////////////////// 00334 INLINE void PGEntry:: 00335 set_cursor_keys_active(bool flag) { 00336 LightReMutexHolder holder(_lock); 00337 _cursor_keys_active = flag; 00338 } 00339 00340 //////////////////////////////////////////////////////////////////// 00341 // Function: PGEntry::get_cursor_keys_active 00342 // Access: Published 00343 // Description: Returns whether the arrow keys are currently set to 00344 // control movement of the cursor; see 00345 // set_cursor_keys_active(). 00346 //////////////////////////////////////////////////////////////////// 00347 INLINE bool PGEntry:: 00348 get_cursor_keys_active() const { 00349 LightReMutexHolder holder(_lock); 00350 return _cursor_keys_active; 00351 } 00352 00353 //////////////////////////////////////////////////////////////////// 00354 // Function: PGEntry::set_obscure_mode 00355 // Access: Published 00356 // Description: Specifies whether obscure mode should be enabled. In 00357 // obscure mode, a string of asterisks is displayed 00358 // instead of the literal text, e.g. for entering 00359 // passwords. 00360 // 00361 // In obscure mode, the width of the text is computed 00362 // based on the width of the string of asterisks, not on 00363 // the width of the actual text. This has implications 00364 // on the maximum length of text that may be entered if 00365 // max_width is in effect. 00366 //////////////////////////////////////////////////////////////////// 00367 INLINE void PGEntry:: 00368 set_obscure_mode(bool flag) { 00369 LightReMutexHolder holder(_lock); 00370 if (_obscure_mode != flag) { 00371 _obscure_mode = flag; 00372 _text_geom_stale = true; 00373 } 00374 } 00375 00376 //////////////////////////////////////////////////////////////////// 00377 // Function: PGEntry::get_obscure_mode 00378 // Access: Published 00379 // Description: Specifies whether obscure mode is enabled. See 00380 // set_obscure_mode(). 00381 //////////////////////////////////////////////////////////////////// 00382 INLINE bool PGEntry:: 00383 get_obscure_mode() const { 00384 LightReMutexHolder holder(_lock); 00385 return _obscure_mode; 00386 } 00387 00388 //////////////////////////////////////////////////////////////////// 00389 // Function: PGEntry::set_overflow_mode 00390 // Access: Published 00391 // Description: Specifies whether overflow mode should be enabled. 00392 // In overflow mode, text can overflow the boundaries 00393 // of the Entry element horizontally. 00394 // 00395 // Overflow mode only works when the number of lines 00396 // is 1. 00397 //////////////////////////////////////////////////////////////////// 00398 INLINE void PGEntry:: 00399 set_overflow_mode(bool flag) { 00400 LightReMutexHolder holder(_lock); 00401 if (_overflow_mode != flag) { 00402 _overflow_mode = flag; 00403 _text_geom_stale = true; 00404 _cursor_stale = true; 00405 } 00406 } 00407 00408 //////////////////////////////////////////////////////////////////// 00409 // Function: PGEntry::get_overflow_mode 00410 // Access: Published 00411 // Description: Specifies whether overflow mode is enabled. See 00412 // set_overflow_mode(). 00413 //////////////////////////////////////////////////////////////////// 00414 INLINE bool PGEntry:: 00415 get_overflow_mode() const { 00416 LightReMutexHolder holder(_lock); 00417 return _overflow_mode; 00418 } 00419 00420 //////////////////////////////////////////////////////////////////// 00421 // Function: PGEntry::set_candidate_active 00422 // Access: Published 00423 // Description: Specifies the name of the TextProperties structure 00424 // added to the TextPropertiesManager that will be used 00425 // to render candidate strings from the IME, used for 00426 // typing characters in east Asian languages. Each 00427 // candidate string represents one possible way to 00428 // interpret the sequence of keys the user has just 00429 // entered; it should not be considered typed yet, but 00430 // it is important for the user to be able to see what 00431 // he is considering entering. 00432 // 00433 // This particular method sets the properties for the 00434 // subset of the current candidate string that the user 00435 // can actively scroll through. 00436 //////////////////////////////////////////////////////////////////// 00437 INLINE void PGEntry:: 00438 set_candidate_active(const string &candidate_active) { 00439 LightReMutexHolder holder(_lock); 00440 _candidate_active = candidate_active; 00441 } 00442 00443 //////////////////////////////////////////////////////////////////// 00444 // Function: PGEntry::get_candidate_active 00445 // Access: Published 00446 // Description: See set_candidate_active(). 00447 //////////////////////////////////////////////////////////////////// 00448 INLINE const string &PGEntry:: 00449 get_candidate_active() const { 00450 LightReMutexHolder holder(_lock); 00451 return _candidate_active; 00452 } 00453 00454 //////////////////////////////////////////////////////////////////// 00455 // Function: PGEntry::set_candidate_inactive 00456 // Access: Published 00457 // Description: Specifies the name of the TextProperties structure 00458 // added to the TextPropertiesManager that will be used 00459 // to render candidate strings from the IME, used for 00460 // typing characters in east Asian languages. Each 00461 // candidate string represents one possible way to 00462 // interpret the sequence of keys the user has just 00463 // entered; it should not be considered typed yet, but 00464 // it is important for the user to be able to see what 00465 // he is considering entering. 00466 // 00467 // This particular method sets the properties for the 00468 // subset of the current candidate string that the user 00469 // is not actively scrolling through. 00470 //////////////////////////////////////////////////////////////////// 00471 INLINE void PGEntry:: 00472 set_candidate_inactive(const string &candidate_inactive) { 00473 LightReMutexHolder holder(_lock); 00474 _candidate_inactive = candidate_inactive; 00475 } 00476 00477 //////////////////////////////////////////////////////////////////// 00478 // Function: PGEntry::get_candidate_inactive 00479 // Access: Published 00480 // Description: See set_candidate_inactive(). 00481 //////////////////////////////////////////////////////////////////// 00482 INLINE const string &PGEntry:: 00483 get_candidate_inactive() const { 00484 LightReMutexHolder holder(_lock); 00485 return _candidate_inactive; 00486 } 00487 00488 //////////////////////////////////////////////////////////////////// 00489 // Function: PGEntry::get_accept_prefix 00490 // Access: Published, Static 00491 // Description: Returns the prefix that is used to define the accept 00492 // event for all PGEntries. The accept event is the 00493 // concatenation of this string followed by get_id(). 00494 //////////////////////////////////////////////////////////////////// 00495 INLINE string PGEntry:: 00496 get_accept_prefix() { 00497 return "accept-"; 00498 } 00499 00500 //////////////////////////////////////////////////////////////////// 00501 // Function: PGEntry::get_accept_failed_prefix 00502 // Access: Published, Static 00503 // Description: Returns the prefix that is used to define the accept 00504 // failed event for all PGEntries. This event is the 00505 // concatenation of this string followed by get_id(). 00506 //////////////////////////////////////////////////////////////////// 00507 INLINE string PGEntry:: 00508 get_accept_failed_prefix() { 00509 return "acceptfailed-"; 00510 } 00511 00512 //////////////////////////////////////////////////////////////////// 00513 // Function: PGEntry::get_overflow_prefix 00514 // Access: Published, Static 00515 // Description: Returns the prefix that is used to define the overflow 00516 // event for all PGEntries. The overflow event is the 00517 // concatenation of this string followed by get_id(). 00518 //////////////////////////////////////////////////////////////////// 00519 INLINE string PGEntry:: 00520 get_overflow_prefix() { 00521 return "overflow-"; 00522 } 00523 00524 //////////////////////////////////////////////////////////////////// 00525 // Function: PGEntry::get_type_prefix 00526 // Access: Published, Static 00527 // Description: Returns the prefix that is used to define the type 00528 // event for all PGEntries. The type event is the 00529 // concatenation of this string followed by get_id(). 00530 //////////////////////////////////////////////////////////////////// 00531 INLINE string PGEntry:: 00532 get_type_prefix() { 00533 return "type-"; 00534 } 00535 00536 //////////////////////////////////////////////////////////////////// 00537 // Function: PGEntry::get_erase_prefix 00538 // Access: Published, Static 00539 // Description: Returns the prefix that is used to define the erase 00540 // event for all PGEntries. The erase event is the 00541 // concatenation of this string followed by get_id(). 00542 //////////////////////////////////////////////////////////////////// 00543 INLINE string PGEntry:: 00544 get_erase_prefix() { 00545 return "erase-"; 00546 } 00547 00548 //////////////////////////////////////////////////////////////////// 00549 // Function: PGEntry::get_cursormove_prefix 00550 // Access: Published, Static 00551 // Description: Returns the prefix that is used to define the cursor 00552 // event for all PGEntries. The cursor event is the 00553 // concatenation of this string followed by get_id(). 00554 //////////////////////////////////////////////////////////////////// 00555 INLINE string PGEntry:: 00556 get_cursormove_prefix() { 00557 return "cursormove-"; 00558 } 00559 00560 //////////////////////////////////////////////////////////////////// 00561 // Function: PGEntry::get_accept_event 00562 // Access: Published 00563 // Description: Returns the event name that will be thrown when the 00564 // entry is accepted normally. 00565 //////////////////////////////////////////////////////////////////// 00566 INLINE string PGEntry:: 00567 get_accept_event(const ButtonHandle &button) const { 00568 return get_accept_prefix() + button.get_name() + "-" + get_id(); 00569 } 00570 00571 //////////////////////////////////////////////////////////////////// 00572 // Function: PGEntry::get_accept_failed_event 00573 // Access: Published 00574 // Description: Returns the event name that will be thrown when the 00575 // entry cannot accept an input 00576 //////////////////////////////////////////////////////////////////// 00577 INLINE string PGEntry:: 00578 get_accept_failed_event(const ButtonHandle &button) const { 00579 return get_accept_failed_prefix() + button.get_name() + "-" + get_id(); 00580 } 00581 00582 //////////////////////////////////////////////////////////////////// 00583 // Function: PGEntry::get_overflow_event 00584 // Access: Published 00585 // Description: Returns the event name that will be thrown when too 00586 // much text is attempted to be entered into the 00587 // PGEntry, exceeding either the limit set via 00588 // set_max_chars() or via set_max_width(). 00589 //////////////////////////////////////////////////////////////////// 00590 INLINE string PGEntry:: 00591 get_overflow_event() const { 00592 return get_overflow_prefix() + get_id(); 00593 } 00594 00595 //////////////////////////////////////////////////////////////////// 00596 // Function: PGEntry::get_type_event 00597 // Access: Published 00598 // Description: Returns the event name that will be thrown whenever 00599 // the user extends the text by typing. 00600 //////////////////////////////////////////////////////////////////// 00601 INLINE string PGEntry:: 00602 get_type_event() const { 00603 return get_type_prefix() + get_id(); 00604 } 00605 00606 //////////////////////////////////////////////////////////////////// 00607 // Function: PGEntry::get_erase_event 00608 // Access: Published 00609 // Description: Returns the event name that will be thrown whenever 00610 // the user erases characters in the text. 00611 //////////////////////////////////////////////////////////////////// 00612 INLINE string PGEntry:: 00613 get_erase_event() const { 00614 return get_erase_prefix() + get_id(); 00615 } 00616 00617 //////////////////////////////////////////////////////////////////// 00618 // Function: PGEntry::get_cursormove_event 00619 // Access: Published 00620 // Description: Returns the event name that will be thrown whenever 00621 // the cursor moves 00622 //////////////////////////////////////////////////////////////////// 00623 INLINE string PGEntry:: 00624 get_cursormove_event() const { 00625 return get_cursormove_prefix() + get_id(); 00626 } 00627 00628 //////////////////////////////////////////////////////////////////// 00629 // Function: PGEntry::set_wtext 00630 // Access: Published 00631 // Description: Changes the text currently displayed within the 00632 // entry. 00633 // 00634 // The return value is true if all the text is accepted, 00635 // or false if some was truncated (see set_max_width(), 00636 // etc.). 00637 //////////////////////////////////////////////////////////////////// 00638 INLINE bool PGEntry:: 00639 set_wtext(const wstring &wtext) { 00640 LightReMutexHolder holder(_lock); 00641 bool ret = _text.set_wtext(wtext); 00642 if (_obscure_mode) { 00643 ret = _obscure_text.set_wtext(wstring(_text.get_num_characters(), '*')); 00644 } 00645 _text_geom_stale = true; 00646 set_cursor_position(min(_cursor_position, _text.get_num_characters())); 00647 return ret; 00648 } 00649 00650 //////////////////////////////////////////////////////////////////// 00651 // Function: PGEntry::get_plain_wtext 00652 // Access: Published 00653 // Description: Returns the text currently displayed within the 00654 // entry, without any embedded properties characters. 00655 //////////////////////////////////////////////////////////////////// 00656 INLINE wstring PGEntry:: 00657 get_plain_wtext() const { 00658 LightReMutexHolder holder(_lock); 00659 return _text.get_plain_wtext(); 00660 } 00661 00662 //////////////////////////////////////////////////////////////////// 00663 // Function: PGEntry::get_wtext 00664 // Access: Published 00665 // Description: Returns the text currently displayed within the 00666 // entry. 00667 //////////////////////////////////////////////////////////////////// 00668 INLINE wstring PGEntry:: 00669 get_wtext() const { 00670 LightReMutexHolder holder(_lock); 00671 return _text.get_wtext(); 00672 } 00673 00674 //////////////////////////////////////////////////////////////////// 00675 // Function: PGEntry::set_accept_enabled 00676 // Access: Published 00677 // Description: Sets whether the input may be accepted--use to 00678 // disable submission by the user 00679 //////////////////////////////////////////////////////////////////// 00680 INLINE void PGEntry:: 00681 set_accept_enabled(bool enabled) { 00682 LightReMutexHolder holder(_lock); 00683 _accept_enabled = enabled; 00684 }