Panda3D
|
This is a particular kind of PGItem that handles simple one-line or short multi-line text entries, of the sort where the user can type any string. More...
#include "pgEntry.h"
Public Types | |
enum | State { S_focus = 0, S_no_focus, S_inactive } |
Public Member Functions | |
PGEntry (const string &name) | |
virtual void | accept (const MouseWatcherParameter ¶m) |
This is a callback hook function, called whenever the entry is accepted by the user pressing Enter normally. | |
virtual void | accept_failed (const MouseWatcherParameter ¶m) |
This is a callback hook function, called whenever the user presses Enter but we can't accept the input. | |
virtual void | candidate (const MouseWatcherParameter ¶m, bool background) |
This is a callback hook function, called whenever the user selects an item from the IME menu. | |
void | clear_cursor_def () |
Removes all the children from the cursor_def node, in preparation for adding a new definition. | |
virtual bool | cull_callback (CullTraverser *trav, CullTraverserData &data) |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time. | |
virtual void | cursormove () |
This is a callback hook function, called whenever the cursor moves. | |
virtual void | erase (const MouseWatcherParameter ¶m) |
This is a callback hook function, called whenever the user erase characters in the text. | |
virtual TypeHandle | force_init_type () |
string | get_accept_event (const ButtonHandle &button) const |
Returns the event name that will be thrown when the entry is accepted normally. | |
string | get_accept_failed_event (const ButtonHandle &button) const |
Returns the event name that will be thrown when the entry cannot accept an input. | |
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. | |
const string & | get_candidate_active () const |
See set_candidate_active(). | |
const string & | get_candidate_inactive () const |
See set_candidate_inactive(). | |
wchar_t | get_character (int n) const |
Returns the character at the indicated position in the entry. | |
NodePath | get_cursor_def () |
Returns the Node that will be rendered to represent the cursor. | |
bool | get_cursor_keys_active () const |
Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_keys_active(). | |
int | get_cursor_position () const |
Returns the current position of the cursor. | |
PN_stdfloat | get_cursor_X () const |
Returns the node position x of the cursor. | |
PN_stdfloat | get_cursor_Y () const |
Returns the node position y of the cursor. | |
string | get_cursormove_event () const |
Returns the event name that will be thrown whenever the cursor moves. | |
string | get_erase_event () const |
Returns the event name that will be thrown whenever the user erases characters in the text. | |
const TextGraphic * | get_graphic (int n) const |
Returns the graphic object at the indicated position in the pre-wordwrapped string. | |
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. | |
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. | |
int | get_num_characters () const |
Returns the number of characters of text in the entry. | |
int | get_num_lines () const |
Returns the number of lines of text the PGEntry will use, if _max_width is not 0. | |
bool | get_obscure_mode () const |
Specifies whether obscure mode is enabled. | |
string | get_overflow_event () const |
Returns the event name that will be thrown when too much text is attempted to be entered into the PGEntry, exceeding either the limit set via set_max_chars() or via set_max_width(). | |
bool | get_overflow_mode () const |
Specifies whether overflow mode is enabled. | |
string | get_plain_text () const |
Returns the text currently displayed within the entry, without any embedded properties characters. | |
wstring | get_plain_wtext () const |
Returns the text currently displayed within the entry, without any embedded properties characters. | |
const TextProperties & | get_properties (int n) const |
Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped string. | |
string | get_text () const |
Returns the text currently displayed within the entry. | |
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 indicated state. | |
virtual TypeHandle | get_type () const |
string | get_type_event () const |
Returns the event name that will be thrown whenever the user extends the text by typing. | |
wstring | get_wtext () const |
Returns the text currently displayed within the entry. | |
bool | is_wtext () const |
Returns true if any of the characters in the string returned by get_wtext() are out of the range of an ASCII character (and, therefore, get_wtext() should be called in preference to get_text()). | |
virtual void | keystroke (const MouseWatcherParameter ¶m, bool background) |
This is a callback hook function, called whenever the user types a key. | |
virtual PandaNode * | make_copy () const |
Returns a newly-allocated Node that is a shallow copy of this one. | |
virtual void | overflow (const MouseWatcherParameter ¶m) |
This is a callback hook function, called whenever the entry is overflowed because the user attempts to type too many characters, exceeding either set_max_chars() or set_max_width(). | |
virtual void | press (const MouseWatcherParameter ¶m, bool background) |
This is a callback hook function, called whenever a mouse or keyboard entry is depressed while the mouse is within the region. | |
void | set_accept_enabled (bool enabled) |
Sets whether the input may be accepted--use to disable submission by the user. | |
virtual void | set_active (bool active) |
Toggles the active/inactive state of the entry. | |
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. | |
void | set_candidate_active (const string &candidate_active) |
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages. | |
void | set_candidate_inactive (const string &candidate_inactive) |
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages. | |
void | set_cursor_keys_active (bool flag) |
Sets whether the arrow keys (and home/end) control movement of the cursor. | |
void | set_cursor_position (int position) |
Sets the current position of the cursor. | |
virtual void | set_focus (bool focus) |
Toggles the focus state of the entry. | |
void | set_max_chars (int max_chars) |
Sets the maximum number of characters that may be typed into the entry. | |
void | set_max_width (PN_stdfloat max_width) |
Sets the maximum width of all characters that may be typed into the entry. | |
void | set_num_lines (int num_lines) |
Sets the number of lines of text the PGEntry will use. | |
void | set_obscure_mode (bool flag) |
Specifies whether obscure mode should be enabled. | |
void | set_overflow_mode (bool flag) |
Specifies whether overflow mode should be enabled. | |
bool | set_text (const string &text) |
Changes the text currently displayed within the entry. | |
void | set_text_def (int state, TextNode *node) |
Changes the TextNode that will be used to render the text within the entry when the entry is in the indicated state. | |
bool | set_wtext (const wstring &wtext) |
Changes the text currently displayed within the entry. | |
void | setup (PN_stdfloat width, int num_lines) |
Sets up the entry for normal use. | |
void | setup_minimal (PN_stdfloat width, int num_lines) |
Sets up the entry without creating any frame or other decoration. | |
virtual void | type (const MouseWatcherParameter ¶m) |
This is a callback hook function, called whenever the user extends the text by typing. | |
virtual void | xform (const LMatrix4 &mat) |
Transforms the contents of this node by the indicated matrix, if it means anything to do so. | |
Static Public Member Functions | |
static string | get_accept_failed_prefix () |
Returns the prefix that is used to define the accept failed event for all PGEntries. | |
static string | get_accept_prefix () |
Returns the prefix that is used to define the accept event for all PGEntries. | |
static TypeHandle | get_class_type () |
static string | get_cursormove_prefix () |
Returns the prefix that is used to define the cursor event for all PGEntries. | |
static string | get_erase_prefix () |
Returns the prefix that is used to define the erase event for all PGEntries. | |
static string | get_overflow_prefix () |
Returns the prefix that is used to define the overflow event for all PGEntries. | |
static string | get_type_prefix () |
Returns the prefix that is used to define the type event for all PGEntries. | |
static void | init_type () |
Protected Member Functions | |
PGEntry (const PGEntry ©) |
This is a particular kind of PGItem that handles simple one-line or short multi-line text entries, of the sort where the user can type any string.
A PGEntry does all of its internal manipulation on a wide string, so it can store the full Unicode character set. The interface can support either the wide string getters and setters, or the normal 8-bit string getters and setters, which use whatever encoding method is specified by the associated TextNode.
void PGEntry::accept | ( | const MouseWatcherParameter & | param | ) | [virtual] |
This is a callback hook function, called whenever the entry is accepted by the user pressing Enter normally.
Definition at line 473 of file pgEntry.cxx.
References get_accept_event(), MouseWatcherParameter::get_button(), PGItem::play_sound(), and set_focus().
Referenced by press().
void PGEntry::accept_failed | ( | const MouseWatcherParameter & | param | ) | [virtual] |
This is a callback hook function, called whenever the user presses Enter but we can't accept the input.
Definition at line 489 of file pgEntry.cxx.
References get_accept_failed_event(), MouseWatcherParameter::get_button(), and PGItem::play_sound().
Referenced by press().
void PGEntry::candidate | ( | const MouseWatcherParameter & | param, |
bool | background | ||
) | [virtual] |
This is a callback hook function, called whenever the user selects an item from the IME menu.
Reimplemented from PGItem.
Definition at line 448 of file pgEntry.cxx.
References PGItem::get_active(), MouseWatcherParameter::get_candidate_string(), MouseWatcherParameter::get_cursor_pos(), MouseWatcherParameter::get_highlight_end(), MouseWatcherParameter::get_highlight_start(), MouseWatcherParameter::has_candidate(), and type().
void PGEntry::clear_cursor_def | ( | ) | [inline] |
Removes all the children from the cursor_def node, in preparation for adding a new definition.
Definition at line 321 of file pgEntry.I.
References NodePath::attach_new_node(), and NodePath::remove_node().
Referenced by setup_minimal().
bool PGEntry::cull_callback | ( | CullTraverser * | trav, |
CullTraverserData & | data | ||
) | [virtual] |
This function will be called during the cull traversal to perform any additional operations that should be performed at cull time.
This may include additional manipulation of render state or additional visible/invisible decisions, or any other arbitrary operation.
Note that this function will *not* be called unless set_cull_callback() is called in the constructor of the derived class. It is necessary to call set_cull_callback() to indicated that we require cull_callback() to be called.
By the time this function is called, the node has already passed the bounding-volume test for the viewing frustum, and the node's transform and state have already been applied to the indicated CullTraverserData object.
The return value is true if this node should be visible, or false if it should be culled.
Reimplemented from PGItem.
Definition at line 192 of file pgEntry.cxx.
References NodePath::node(), and CullTraverser::traverse().
void PGEntry::cursormove | ( | ) | [virtual] |
This is a callback hook function, called whenever the cursor moves.
Definition at line 552 of file pgEntry.cxx.
References get_cursormove_event().
void PGEntry::erase | ( | const MouseWatcherParameter & | param | ) | [virtual] |
This is a callback hook function, called whenever the user erase characters in the text.
Definition at line 537 of file pgEntry.cxx.
References get_erase_event(), and PGItem::play_sound().
Referenced by press().
string PGEntry::get_accept_event | ( | const ButtonHandle & | button | ) | const [inline] |
Returns the event name that will be thrown when the entry is accepted normally.
Definition at line 567 of file pgEntry.I.
References get_accept_prefix(), PGItem::get_id(), and ButtonHandle::get_name().
Referenced by accept().
string PGEntry::get_accept_failed_event | ( | const ButtonHandle & | button | ) | const [inline] |
Returns the event name that will be thrown when the entry cannot accept an input.
Definition at line 578 of file pgEntry.I.
References get_accept_failed_prefix(), PGItem::get_id(), and ButtonHandle::get_name().
Referenced by accept_failed().
string PGEntry::get_accept_failed_prefix | ( | ) | [inline, static] |
Returns the prefix that is used to define the accept failed event for all PGEntries.
This event is the concatenation of this string followed by get_id().
Definition at line 508 of file pgEntry.I.
Referenced by get_accept_failed_event().
string PGEntry::get_accept_prefix | ( | ) | [inline, static] |
Returns the prefix that is used to define the accept event for all PGEntries.
The accept event is the concatenation of this string followed by get_id().
Definition at line 496 of file pgEntry.I.
Referenced by get_accept_event().
PN_stdfloat PGEntry::get_blink_rate | ( | ) | const [inline] |
const string & PGEntry::get_candidate_active | ( | ) | const [inline] |
const string & PGEntry::get_candidate_inactive | ( | ) | const [inline] |
wchar_t PGEntry::get_character | ( | int | n | ) | const [inline] |
Returns the character at the indicated position in the entry.
If the object at this position is a graphic object instead of a character, returns 0.
Definition at line 97 of file pgEntry.I.
References TextAssembler::get_character().
NodePath PGEntry::get_cursor_def | ( | ) | [inline] |
Returns the Node that will be rendered to represent the cursor.
You can attach suitable cursor geometry to this node.
Definition at line 309 of file pgEntry.I.
Referenced by setup_minimal().
bool PGEntry::get_cursor_keys_active | ( | ) | const [inline] |
Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_keys_active().
int PGEntry::get_cursor_position | ( | ) | const [inline] |
PN_stdfloat PGEntry::get_cursor_X | ( | ) | const [inline] |
PN_stdfloat PGEntry::get_cursor_Y | ( | ) | const [inline] |
string PGEntry::get_cursormove_event | ( | ) | const [inline] |
Returns the event name that will be thrown whenever the cursor moves.
Definition at line 624 of file pgEntry.I.
References get_cursormove_prefix(), and PGItem::get_id().
Referenced by cursormove().
string PGEntry::get_cursormove_prefix | ( | ) | [inline, static] |
Returns the prefix that is used to define the cursor event for all PGEntries.
The cursor event is the concatenation of this string followed by get_id().
Definition at line 556 of file pgEntry.I.
Referenced by get_cursormove_event().
string PGEntry::get_erase_event | ( | ) | const [inline] |
Returns the event name that will be thrown whenever the user erases characters in the text.
Definition at line 613 of file pgEntry.I.
References get_erase_prefix(), and PGItem::get_id().
Referenced by erase().
string PGEntry::get_erase_prefix | ( | ) | [inline, static] |
Returns the prefix that is used to define the erase event for all PGEntries.
The erase event is the concatenation of this string followed by get_id().
Definition at line 544 of file pgEntry.I.
Referenced by get_erase_event().
const TextGraphic * PGEntry::get_graphic | ( | int | n | ) | const [inline] |
Returns the graphic object at the indicated position in the pre-wordwrapped string.
If the object at this position is a character instead of a graphic object, returns NULL.
Definition at line 111 of file pgEntry.I.
References TextAssembler::get_graphic().
int PGEntry::get_max_chars | ( | ) | const [inline] |
Returns the current maximum number of characters that may be typed into the entry, or 0 if there is no limit.
See set_max_chars().
Definition at line 207 of file pgEntry.I.
Referenced by keystroke().
PN_stdfloat PGEntry::get_max_width | ( | ) | const [inline] |
Returns the current maximum width of the characters that may be typed into the entry, or 0 if there is no limit.
See set_max_width().
int PGEntry::get_num_characters | ( | ) | const [inline] |
Returns the number of characters of text in the entry.
This is the actual number of visible characters, not counting implicit newlines due to wordwrapping, or formatted characters for text properties changes. If there is an embedded TextGraphic object, it counts as one character.
This is also the length of the string returned by get_plain_text().
Definition at line 84 of file pgEntry.I.
References TextAssembler::get_num_characters().
int PGEntry::get_num_lines | ( | ) | const [inline] |
Returns the number of lines of text the PGEntry will use, if _max_width is not 0.
See set_num_lines().
bool PGEntry::get_obscure_mode | ( | ) | const [inline] |
Specifies whether obscure mode is enabled.
See set_obscure_mode().
string PGEntry::get_overflow_event | ( | ) | const [inline] |
Returns the event name that will be thrown when too much text is attempted to be entered into the PGEntry, exceeding either the limit set via set_max_chars() or via set_max_width().
Definition at line 591 of file pgEntry.I.
References PGItem::get_id(), and get_overflow_prefix().
Referenced by overflow().
bool PGEntry::get_overflow_mode | ( | ) | const [inline] |
Specifies whether overflow mode is enabled.
See set_overflow_mode().
Definition at line 415 of file pgEntry.I.
Referenced by keystroke(), and press().
string PGEntry::get_overflow_prefix | ( | ) | [inline, static] |
Returns the prefix that is used to define the overflow event for all PGEntries.
The overflow event is the concatenation of this string followed by get_id().
Definition at line 520 of file pgEntry.I.
Referenced by get_overflow_event().
string PGEntry::get_plain_text | ( | ) | const [inline] |
Returns the text currently displayed within the entry, without any embedded properties characters.
This uses the Unicode encoding currently specified for the "focus" TextNode; therefore, the TextNode must exist before calling get_text().
Definition at line 47 of file pgEntry.I.
References TextEncoder::encode_wtext(), get_plain_wtext(), and get_text_def().
wstring PGEntry::get_plain_wtext | ( | ) | const [inline] |
Returns the text currently displayed within the entry, without any embedded properties characters.
Definition at line 657 of file pgEntry.I.
References TextAssembler::get_plain_wtext().
Referenced by get_plain_text().
const TextProperties & PGEntry::get_properties | ( | int | n | ) | const [inline] |
Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped string.
Definition at line 124 of file pgEntry.I.
References TextAssembler::get_properties().
string PGEntry::get_text | ( | ) | const [inline] |
Returns the text currently displayed within the entry.
This uses the Unicode encoding currently specified for the "focus" TextNode; therefore, the TextNode must exist before calling get_text().
Definition at line 63 of file pgEntry.I.
References TextEncoder::encode_wtext(), get_text_def(), and get_wtext().
TextNode * PGEntry::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 indicated state.
See set_text_def().
Definition at line 718 of file pgEntry.cxx.
References PGItem::get_text_node().
Referenced by get_plain_text(), get_text(), set_text(), setup(), and setup_minimal().
string PGEntry::get_type_event | ( | ) | const [inline] |
Returns the event name that will be thrown whenever the user extends the text by typing.
Definition at line 602 of file pgEntry.I.
References PGItem::get_id(), and get_type_prefix().
Referenced by type().
string PGEntry::get_type_prefix | ( | ) | [inline, static] |
Returns the prefix that is used to define the type event for all PGEntries.
The type event is the concatenation of this string followed by get_id().
Definition at line 532 of file pgEntry.I.
Referenced by get_type_event().
wstring PGEntry::get_wtext | ( | ) | const [inline] |
Returns the text currently displayed within the entry.
Definition at line 669 of file pgEntry.I.
References TextAssembler::get_wtext().
Referenced by get_text().
bool PGEntry::is_wtext | ( | ) | const |
Returns true if any of the characters in the string returned by get_wtext() are out of the range of an ASCII character (and, therefore, get_wtext() should be called in preference to get_text()).
Definition at line 767 of file pgEntry.cxx.
References TextAssembler::get_character(), and TextAssembler::get_num_characters().
void PGEntry::keystroke | ( | const MouseWatcherParameter & | param, |
bool | background | ||
) | [virtual] |
This is a callback hook function, called whenever the user types a key.
Reimplemented from PGItem.
Definition at line 337 of file pgEntry.cxx.
References TextAssembler::calc_r_c(), PGItem::get_active(), TextAssembler::get_character(), MouseWatcherParameter::get_keycode(), get_max_chars(), TextAssembler::get_num_characters(), TextAssembler::get_num_cols(), TextAssembler::get_num_rows(), get_overflow_mode(), TextAssembler::get_xpos(), MouseWatcherParameter::has_keycode(), overflow(), TextAssembler::set_wsubstr(), TextAssembler::set_wtext(), and type().
PandaNode * PGEntry::make_copy | ( | ) | const [virtual] |
void PGEntry::overflow | ( | const MouseWatcherParameter & | param | ) | [virtual] |
This is a callback hook function, called whenever the entry is overflowed because the user attempts to type too many characters, exceeding either set_max_chars() or set_max_width().
Definition at line 507 of file pgEntry.cxx.
References get_overflow_event(), and PGItem::play_sound().
Referenced by keystroke(), and press().
void PGEntry::press | ( | const MouseWatcherParameter & | param, |
bool | background | ||
) | [virtual] |
This is a callback hook function, called whenever a mouse or keyboard entry is depressed while the mouse is within the region.
Reimplemented from PGItem.
Definition at line 214 of file pgEntry.cxx.
References accept(), accept_failed(), erase(), MouseButton::five(), MouseButton::four(), PGItem::get_active(), PGItem::get_background_focus(), MouseWatcherParameter::get_button(), PGItem::get_focus(), ClockObject::get_frame_time(), ClockObject::get_global_clock(), TextAssembler::get_num_characters(), get_overflow_mode(), MouseWatcherParameter::has_button(), MouseButton::one(), overflow(), set_focus(), TextAssembler::set_wsubstr(), MouseButton::three(), MouseButton::two(), and type().
void PGEntry::set_accept_enabled | ( | bool | enabled | ) | [inline] |
void PGEntry::set_active | ( | bool | active | ) | [virtual] |
Toggles the active/inactive state of the entry.
In the case of a PGEntry, this also changes its visual appearance.
Reimplemented from PGItem.
Definition at line 738 of file pgEntry.cxx.
void PGEntry::set_blink_rate | ( | PN_stdfloat | blink_rate | ) | [inline] |
void PGEntry::set_candidate_active | ( | const string & | candidate_active | ) | [inline] |
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages.
Each candidate string represents one possible way to interpret the sequence of keys the user has just entered; it should not be considered typed yet, but it is important for the user to be able to see what he is considering entering.
This particular method sets the properties for the subset of the current candidate string that the user can actively scroll through.
void PGEntry::set_candidate_inactive | ( | const string & | candidate_inactive | ) | [inline] |
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages.
Each candidate string represents one possible way to interpret the sequence of keys the user has just entered; it should not be considered typed yet, but it is important for the user to be able to see what he is considering entering.
This particular method sets the properties for the subset of the current candidate string that the user is not actively scrolling through.
void PGEntry::set_cursor_keys_active | ( | bool | flag | ) | [inline] |
void PGEntry::set_cursor_position | ( | int | position | ) | [inline] |
Sets the current position of the cursor.
This is the position within the text at which the next letter typed by the user will be inserted; normally it is the same as the length of the text.
Definition at line 138 of file pgEntry.I.
References ClockObject::get_frame_time(), and ClockObject::get_global_clock().
Referenced by set_wtext().
void PGEntry::set_focus | ( | bool | focus | ) | [virtual] |
Toggles the focus state of the entry.
In the case of a PGEntry, this also changes its visual appearance.
Reimplemented from PGItem.
Definition at line 751 of file pgEntry.cxx.
References ClockObject::get_frame_time(), and ClockObject::get_global_clock().
void PGEntry::set_max_chars | ( | int | max_chars | ) | [inline] |
Sets the maximum number of characters that may be typed into the entry.
This is a limit on the number of characters, as opposed to the width of the entry; see also set_max_width().
If this is 0, there is no limit.
Definition at line 194 of file pgEntry.I.
Referenced by setup_minimal().
void PGEntry::set_max_width | ( | PN_stdfloat | max_width | ) | [inline] |
Sets the maximum width of all characters that may be typed into the entry.
This is a limit on the width of the formatted text, not a fixed limit on the number of characters; also set_max_chars().
If this is 0, there is no limit.
If _num_lines is more than 1, rather than being a fixed width on the whole entry, this becomes instead the wordwrap width (and the width limit on the entry is essentially _max_width * _num_lines).
Definition at line 228 of file pgEntry.I.
Referenced by setup_minimal().
void PGEntry::set_num_lines | ( | int | num_lines | ) | [inline] |
Sets the number of lines of text the PGEntry will use.
This only has meaning if _max_width is not 0; _max_width indicates the wordwrap width of each line.
Definition at line 255 of file pgEntry.I.
Referenced by setup_minimal().
void PGEntry::set_obscure_mode | ( | bool | flag | ) | [inline] |
Specifies whether obscure mode should be enabled.
In obscure mode, a string of asterisks is displayed instead of the literal text, e.g. for entering passwords.
In obscure mode, the width of the text is computed based on the width of the string of asterisks, not on the width of the actual text. This has implications on the maximum length of text that may be entered if max_width is in effect.
void PGEntry::set_overflow_mode | ( | bool | flag | ) | [inline] |
bool PGEntry::set_text | ( | const string & | text | ) | [inline] |
Changes the text currently displayed within the entry.
This uses the Unicode encoding currently specified for the "focus" TextNode; therefore, the TextNode must exist before calling set_text().
The return value is true if all the text is accepted, or false if some was truncated (see set_max_width(), etc.).
Definition at line 29 of file pgEntry.I.
References TextEncoder::decode_text(), get_text_def(), and set_wtext().
Referenced by setup_minimal().
void PGEntry::set_text_def | ( | int | state, |
TextNode * | node | ||
) |
Changes the TextNode that will be used to render the text within the entry when the entry is in the indicated state.
The default if nothing is specified is the same TextNode returned by PGItem::get_text_node().
Definition at line 698 of file pgEntry.cxx.
bool PGEntry::set_wtext | ( | const wstring & | wtext | ) | [inline] |
Changes the text currently displayed within the entry.
The return value is true if all the text is accepted, or false if some was truncated (see set_max_width(), etc.).
Definition at line 639 of file pgEntry.I.
References TextAssembler::get_num_characters(), set_cursor_position(), and TextAssembler::set_wtext().
Referenced by set_text().
void PGEntry::setup | ( | PN_stdfloat | width, |
int | num_lines | ||
) |
Sets up the entry for normal use.
The width is the maximum width of characters that will be typed, and num_lines is the integer number of lines of text of the entry. Both of these together determine the size of the entry, based on the TextNode in effect.
Definition at line 568 of file pgEntry.cxx.
References TextNode::get_line_height(), get_text_def(), LPoint3f::rfu(), LVector3f::right(), PGFrameStyle::set_color(), PGItem::set_frame(), PGItem::set_frame_style(), PGFrameStyle::set_type(), PGFrameStyle::set_width(), setup_minimal(), and LVector3f::up().
void PGEntry::setup_minimal | ( | PN_stdfloat | width, |
int | num_lines | ||
) |
Sets up the entry without creating any frame or other decoration.
Definition at line 658 of file pgEntry.cxx.
References NodePath::attach_new_node(), clear_cursor_def(), LineSegs::create(), LineSegs::draw_to(), get_cursor_def(), TextNode::get_line_height(), get_text_def(), PandaNode::ls(), LineSegs::move_to(), LineSegs::set_color(), set_max_chars(), set_max_width(), set_num_lines(), and set_text().
Referenced by setup().
void PGEntry::type | ( | const MouseWatcherParameter & | param | ) | [virtual] |
This is a callback hook function, called whenever the user extends the text by typing.
Definition at line 522 of file pgEntry.cxx.
References get_type_event(), and PGItem::play_sound().
Referenced by candidate(), keystroke(), and press().
void PGEntry::xform | ( | const LMatrix4 & | mat | ) | [virtual] |
Transforms the contents of this node by the indicated matrix, if it means anything to do so.
For most kinds of nodes, this does nothing.
Reimplemented from PGItem.
Definition at line 160 of file pgEntry.cxx.
References NodePath::get_mat(), and NodePath::set_mat().