mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
setAcceptEnabled added to allow us to disable submission of input
This commit is contained in:
parent
38dfa82743
commit
96bdfac9cc
@ -448,3 +448,14 @@ INLINE const wstring &PGEntry::
|
|||||||
get_wtext() const {
|
get_wtext() const {
|
||||||
return _wtext;
|
return _wtext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: PGEntry::set_accept_enabled
|
||||||
|
// Access: Published
|
||||||
|
// Description: Sets whether the input may be accepted--use to
|
||||||
|
// disable submission by the user
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void PGEntry::
|
||||||
|
set_accept_enabled(bool enabled) {
|
||||||
|
_accept_enabled = enabled;
|
||||||
|
}
|
||||||
|
@ -207,7 +207,9 @@ press(const MouseWatcherParameter ¶m, bool background) {
|
|||||||
_blink_start = ClockObject::get_global_clock()->get_frame_time();
|
_blink_start = ClockObject::get_global_clock()->get_frame_time();
|
||||||
if (button == KeyboardButton::enter()) {
|
if (button == KeyboardButton::enter()) {
|
||||||
// Enter. Accept the entry.
|
// Enter. Accept the entry.
|
||||||
|
if (_accept_enabled) {
|
||||||
accept(param);
|
accept(param);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (button == KeyboardButton::backspace()) {
|
} else if (button == KeyboardButton::backspace()) {
|
||||||
// Backspace. Remove the character to the left of the cursor.
|
// Backspace. Remove the character to the left of the cursor.
|
||||||
@ -526,6 +528,8 @@ setup(float width, int num_lines) {
|
|||||||
set_max_width(width);
|
set_max_width(width);
|
||||||
set_num_lines(num_lines);
|
set_num_lines(num_lines);
|
||||||
|
|
||||||
|
_accept_enabled = true;
|
||||||
|
|
||||||
TextNode *text_node = get_text_def(S_focus);
|
TextNode *text_node = get_text_def(S_focus);
|
||||||
float line_height = text_node->get_line_height();
|
float line_height = text_node->get_line_height();
|
||||||
|
|
||||||
|
@ -122,6 +122,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
INLINE void set_wtext(const wstring &wtext);
|
INLINE void set_wtext(const wstring &wtext);
|
||||||
INLINE const wstring &get_wtext() const;
|
INLINE const wstring &get_wtext() const;
|
||||||
|
INLINE void set_accept_enabled(bool enabled);
|
||||||
bool is_wtext() const;
|
bool is_wtext() const;
|
||||||
|
|
||||||
|
|
||||||
@ -148,6 +149,8 @@ private:
|
|||||||
float _max_width;
|
float _max_width;
|
||||||
int _num_lines;
|
int _num_lines;
|
||||||
|
|
||||||
|
bool _accept_enabled;
|
||||||
|
|
||||||
string _candidate_active;
|
string _candidate_active;
|
||||||
string _candidate_inactive;
|
string _candidate_inactive;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user