26 nassertr(text_node !=
nullptr,
false);
41 nassertr(text_node !=
nullptr, std::string());
54 nassertr(text_node !=
nullptr, std::string());
112 if (_cursor_position != position) {
113 _cursor_position = position;
114 _cursor_stale =
true;
117#ifdef THREADED_PIPELINE
131 return _cursor_position;
141 return _cursor_def.get_x();
151 return _cursor_def.get_y();
165 _max_chars = max_chars;
192 _max_width = max_width;
193 _text_geom_stale =
true;
195#ifdef THREADED_PIPELINE
221 nassertv(num_lines >= 1);
222 if (_num_lines != num_lines) {
223 _num_lines = num_lines;
224 _text_geom_stale =
true;
227#ifdef THREADED_PIPELINE
254 _blink_rate = blink_rate;
295 _cursor_keys_active = flag;
305 return _cursor_keys_active;
321 if (_obscure_mode != flag) {
322 _obscure_mode = flag;
323 _text_geom_stale =
true;
325#ifdef THREADED_PIPELINE
340 return _obscure_mode;
352 if (_overflow_mode != flag) {
353 _overflow_mode = flag;
354 _text_geom_stale =
true;
355 _cursor_stale =
true;
357#ifdef THREADED_PIPELINE
372 return _overflow_mode;
390 _candidate_active = candidate_active;
399 return _candidate_active;
417 _candidate_inactive = candidate_inactive;
426 return _candidate_inactive;
446 return "acceptfailed-";
485 return "cursormove-";
555 _text_geom_stale =
true;
556#ifdef THREADED_PIPELINE
591 _accept_enabled = enabled;
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
Similar to MutexHolder, but for a light reentrant mutex.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
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...
const std::string & get_candidate_active() const
See set_candidate_active().
PN_stdfloat get_cursor_X() const
Returns the node position x of the cursor.
std::string get_plain_text() const
Returns the text currently displayed within the entry, without any embedded properties characters.
std::string get_overflow_event() const
Returns the event name that will be thrown when too much text is attempted to be entered into the PGE...
void set_candidate_active(const std::string &candidate_active)
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be us...
void set_cursor_position(int position)
Sets the current position of the cursor.
std::wstring get_wtext() const
Returns the text currently displayed within the entry.
const std::string & get_candidate_inactive() const
See set_candidate_inactive().
const TextProperties & get_properties(int n) const
Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped ...
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...
std::string get_type_event() const
Returns the event name that will be thrown whenever the user extends the text by typing.
NodePath get_cursor_def()
Returns the Node that will be rendered to represent the cursor.
void set_cursor_keys_active(bool flag)
Sets whether the arrow keys (and home/end) control movement of the cursor.
void set_max_chars(int max_chars)
Sets the maximum number of characters that may be typed into the entry.
void set_overflow_mode(bool flag)
Specifies whether overflow mode should be enabled.
std::string get_accept_failed_event(const ButtonHandle &button) const
Returns the event name that will be thrown when the entry cannot accept an input.
void set_num_lines(int num_lines)
Sets the number of lines of text the PGEntry will use.
PN_stdfloat get_cursor_Y() const
Returns the node position y of 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_ke...
int get_num_characters() const
Returns the number of characters of text in the entry.
std::string get_cursormove_event() const
Returns the event name that will be thrown whenever the cursor moves.
std::string get_text() const
Returns the text currently displayed within the entry.
static std::string get_cursormove_prefix()
Returns the prefix that is used to define the cursor event for all PGEntries.
wchar_t get_character(int n) const
Returns the character at the indicated position in the entry.
void set_max_width(PN_stdfloat max_width)
Sets the maximum width of all characters that may be typed into the entry.
static std::string get_accept_failed_prefix()
Returns the prefix that is used to define the accept failed event for all PGEntries.
void set_candidate_inactive(const std::string &candidate_inactive)
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be us...
bool set_wtext(const std::wstring &wtext)
Changes the text currently displayed within the entry.
std::string get_erase_event() const
Returns the event name that will be thrown whenever the user erases characters in the text.
PN_stdfloat get_max_width() const
Returns the current maximum width of the characters that may be typed into the entry,...
bool get_overflow_mode() const
Specifies whether overflow mode is enabled.
static std::string get_accept_prefix()
Returns the prefix that is used to define the accept event for all PGEntries.
void set_obscure_mode(bool flag)
Specifies whether obscure mode should be enabled.
static std::string get_overflow_prefix()
Returns the prefix that is used to define the overflow event for all PGEntries.
int get_num_lines() const
Returns the number of lines of text the PGEntry will use, if _max_width is not 0.
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.
bool set_text(const std::string &text)
Changes the text currently displayed within the entry.
int get_cursor_position() const
Returns the current position of the cursor.
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.
static std::string get_type_prefix()
Returns the prefix that is used to define the type event for all PGEntries.
std::string get_accept_event(const ButtonHandle &button) const
Returns the event name that will be thrown when the entry is accepted normally.
const TextGraphic * get_graphic(int n) const
Returns the graphic object at the indicated position in the pre-wordwrapped string.
bool get_obscure_mode() const
Specifies whether obscure mode is enabled.
static std::string get_erase_prefix()
Returns the prefix that is used to define the erase event for all PGEntries.
int get_max_chars() const
Returns the current maximum number of characters that may be typed into the entry,...
void clear_cursor_def()
Removes all the children from the cursor_def node, in preparation for adding a new definition.
std::wstring get_plain_wtext() const
Returns the text currently displayed within the entry, without any embedded properties characters.
void set_accept_enabled(bool enabled)
Sets whether the input may be accepted–use to disable submission by the user.
const std::string & get_id() const
Returns the unique ID assigned to this PGItem.
static Pipeline * get_render_pipeline()
Returns a pointer to the global render pipeline.
bool set_wtext(const std::wstring &wtext)
Accepts a new text string and associated properties structure, and precomputes the wordwrapping layou...
std::wstring get_wtext() const
Returns a wstring that represents the contents of the text.
get_properties
Returns the default TextProperties that are applied to the text in the absence of any nested property...
int get_num_characters() const
Returns the number of characters of text, before wordwrapping.
const TextGraphic * get_graphic(int n) const
Returns the graphic object at the indicated position in the pre-wordwrapped string.
wchar_t get_character(int n) const
Returns the character at the indicated position in the pre-wordwrapped string.
std::wstring get_plain_wtext() const
Returns a wstring that represents the contents of the text, without any embedded properties character...
std::wstring decode_text(const std::string &text) const
Returns the given wstring decoded to a single-byte string, via the current encoding system.
std::string encode_wtext(const std::wstring &wtext) const
Encodes a wide-text string into a single-char string, according to the current encoding.
This defines a special model that has been constructed for the purposes of embedding an arbitrary gra...
The primary interface to this module.
This defines the set of visual properties that may be assigned to the individual characters of the te...