38class EXPCL_PANDA_PGUI PGEntry :
public PGItem {
40 explicit PGEntry(
const std::string &name);
44 PGEntry(
const PGEntry ©);
48 virtual void xform(
const LMatrix4 &mat);
69 void setup(PN_stdfloat width,
int num_lines);
72 INLINE
bool set_text(
const std::string &text);
136 INLINE
bool set_wtext(
const std::wstring &wtext);
144 void slot_text_def(
int state);
146 void update_cursor();
147 void show_hide_cursor(
bool visible);
152 int _cursor_position;
154 bool _cursor_visible;
156 std::wstring _candidate_wtext;
157 size_t _candidate_highlight_start;
158 size_t _candidate_highlight_end;
159 size_t _candidate_cursor_pos;
162 PN_stdfloat _max_width;
165 bool _accept_enabled;
167 std::string _candidate_active;
168 std::string _candidate_inactive;
170 typedef pvector< PT(
TextNode) > TextDefs;
174 NodePath _text_render_root;
178 NodePath _current_text;
180 bool _text_geom_stale;
181 bool _text_geom_flattened;
186 NodePath _cursor_scale;
187 NodePath _cursor_def;
192 bool _cursor_keys_active;
196 PN_stdfloat _current_padding;
202 static void init_type() {
205 PGItem::get_class_type());
208 return get_class_type();
210 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
This is sent along as a parameter to most events generated for a region to indicate the mouse and but...
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...
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this node by the indicated matrix, if it means anything to do so.
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.
virtual void type(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the user extends the text by typing.
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.
bool is_wtext() const
Returns true if any of the characters in the string returned by get_wtext() are out of the range of a...
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...
void setup_minimal(PN_stdfloat width, int num_lines)
Sets up the entry without creating any frame or other decoration.
int get_num_characters() const
Returns the number of characters of text in the entry.
virtual void erase(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the user erase characters in the text.
std::string get_cursormove_event() const
Returns the event name that will be thrown whenever the cursor moves.
virtual void cursormove()
This is a callback hook function, called 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.
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
void setup(PN_stdfloat width, int num_lines)
Sets up the entry for normal use.
void set_candidate_inactive(const std::string &candidate_inactive)
Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be us...
virtual void accept(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the entry is accepted by the user pressing Enter no...
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.
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 i...
virtual void overflow(const MouseWatcherParameter ¶m)
This is a callback hook function, called whenever the entry is overflowed because the user attempts t...
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,...
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
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.
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 inpu...
virtual void press(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever a mouse or keyboard button is depressed while the m...
virtual void keystroke(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever the user presses a key.
virtual void set_focus(bool focus)
Sets whether the PGItem currently has keyboard focus.
virtual void candidate(const MouseWatcherParameter ¶m, bool background)
This is a callback hook function, called whenever the user highlights an option in the IME window.
virtual void set_active(bool active)
Sets whether the PGItem is active for mouse watching.
This class is not normally used directly by user code, but is used by the TextNode to lay out a block...
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...
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.