Go to the documentation of this file.
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;
static Pipeline * get_render_pipeline()
Returns a pointer to the global render pipeline.
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...
static std::string get_overflow_prefix()
Returns the prefix that is used to define the overflow event for all PGEntries.
PN_stdfloat get_cursor_Y() const
Returns the node position y of the cursor.
std::string get_type_event() const
Returns the event name that will be thrown whenever the user extends the text by typing.
const std::string & get_id() const
Returns the unique ID assigned to this PGItem.
PN_stdfloat get_max_width() const
Returns the current maximum width of the characters that may be typed into the entry,...
std::wstring get_plain_wtext() const
Returns the text currently displayed within the entry, without any embedded properties characters.
Similar to MutexHolder, but for a light reentrant mutex.
const TextGraphic * get_graphic(int n) const
Returns the graphic object at the indicated position in the pre-wordwrapped string.
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 get_cursor_keys_active() const
Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_ke...
NodePath get_cursor_def()
Returns the Node that will be rendered to represent the cursor.
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.
static ClockObject * get_global_clock()
Returns a pointer to the global ClockObject.
void clear_cursor_def()
Removes all the children from the cursor_def node, in preparation for adding a new definition.
std::string get_accept_event(const ButtonHandle &button) const
Returns the event name that will be thrown when the entry is accepted normally.
static std::string get_type_prefix()
Returns the prefix that is used to define the type event for all PGEntries.
The primary interface to this module.
This defines the set of visual properties that may be assigned to the individual characters of the te...
void set_max_width(PN_stdfloat max_width)
Sets the maximum width of all characters that may be typed into the entry.
bool set_wtext(const std::wstring &wtext)
Accepts a new text string and associated properties structure, and precomputes the wordwrapping layou...
void set_overflow_mode(bool flag)
Specifies whether overflow mode should be enabled.
std::wstring get_wtext() const
Returns the text currently displayed within the entry.
int get_num_characters() const
Returns the number of characters of text in the entry.
This defines a special model that has been constructed for the purposes of embedding an arbitrary gra...
int get_max_chars() const
Returns the current maximum number of characters that may be typed into the entry,...
std::string get_plain_text() const
Returns the text currently displayed within the entry, without any embedded properties characters.
bool set_wtext(const std::wstring &wtext)
Changes the text currently displayed within the entry.
static std::string get_accept_prefix()
Returns the prefix that is used to define the accept event for all PGEntries.
std::wstring get_wtext() const
Returns a wstring that represents the contents of the text.
const std::string & get_candidate_inactive() const
See set_candidate_inactive().
std::string get_cursormove_event() const
Returns the event name that will be thrown whenever the cursor moves.
void set_accept_enabled(bool enabled)
Sets whether the input may be accepted–use to disable submission by the user.
bool get_obscure_mode() const
Specifies whether obscure mode is enabled.
int get_cursor_position() const
Returns the current position of the cursor.
void set_max_chars(int max_chars)
Sets the maximum number of characters that may be typed into the entry.
PN_stdfloat get_cursor_X() const
Returns the node position x of the cursor.
void set_num_lines(int num_lines)
Sets the number of lines of text the PGEntry will use.
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_cursor_position(int position)
Sets the current position of the cursor.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
std::string get_erase_event() const
Returns the event name that will be thrown whenever the user erases characters in the text.
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.
get_properties
Returns the default TextProperties that are applied to the text in the absence of any nested property...
get_frame_time
Returns the time in seconds as of the last time tick() was called (typically, this will be as of the ...
bool get_overflow_mode() const
Specifies whether overflow mode is enabled.
int get_num_lines() const
Returns the number of lines of text the PGEntry will use, if _max_width is not 0.
wchar_t get_character(int n) const
Returns the character at the indicated position in the pre-wordwrapped string.
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...
int get_num_characters() const
Returns the number of characters of text, before wordwrapping.
bool set_text(const std::string &text)
Changes the text currently displayed within the entry.
const std::string & get_candidate_active() const
See set_candidate_active().
void set_obscure_mode(bool flag)
Specifies whether obscure mode should be enabled.
std::string encode_wtext(const std::wstring &wtext) const
Encodes a wide-text string into a single-char string, according to the current encoding.
static std::string get_accept_failed_prefix()
Returns the prefix that is used to define the accept failed event for all PGEntries.
const TextProperties & get_properties(int n) const
Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped ...
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_cursormove_prefix()
Returns the prefix that is used to define the cursor event for all PGEntries.
std::string get_text() const
Returns the text currently displayed within the entry.
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_keys_active(bool flag)
Sets whether the arrow keys (and home/end) control movement of the cursor.
static std::string get_erase_prefix()
Returns the prefix that is used to define the erase event for all PGEntries.
std::wstring decode_text(const std::string &text) const
Returns the given wstring decoded to a single-byte string, via the current encoding system.
wchar_t get_character(int n) const
Returns the character at the indicated position in the entry.
std::wstring get_plain_wtext() const
Returns a wstring that represents the contents of the text, without any embedded properties character...
void remove_node(Thread *current_thread=Thread::get_current_thread())
Disconnects the referenced node from the scene graph.
const TextGraphic * get_graphic(int n) const
Returns the graphic object at the indicated position in the pre-wordwrapped string.