mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -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 {
|
||||
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();
|
||||
if (button == KeyboardButton::enter()) {
|
||||
// Enter. Accept the entry.
|
||||
if (_accept_enabled) {
|
||||
accept(param);
|
||||
}
|
||||
|
||||
} else if (button == KeyboardButton::backspace()) {
|
||||
// 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_num_lines(num_lines);
|
||||
|
||||
_accept_enabled = true;
|
||||
|
||||
TextNode *text_node = get_text_def(S_focus);
|
||||
float line_height = text_node->get_line_height();
|
||||
|
||||
|
@ -122,6 +122,7 @@ PUBLISHED:
|
||||
|
||||
INLINE void set_wtext(const wstring &wtext);
|
||||
INLINE const wstring &get_wtext() const;
|
||||
INLINE void set_accept_enabled(bool enabled);
|
||||
bool is_wtext() const;
|
||||
|
||||
|
||||
@ -148,6 +149,8 @@ private:
|
||||
float _max_width;
|
||||
int _num_lines;
|
||||
|
||||
bool _accept_enabled;
|
||||
|
||||
string _candidate_active;
|
||||
string _candidate_inactive;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user