diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llcombobox.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 1 | ||||
-rw-r--r-- | indra/llui/lllineeditor.cpp | 5 | ||||
-rw-r--r-- | indra/llui/lllineeditor.h | 2 |
4 files changed, 16 insertions, 0 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 559895da1a..00a933a0bb 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -845,6 +845,14 @@ void LLComboBox::setTextEntry(const LLStringExplicit& text) } } +void LLComboBox::setKeystrokeOnEsc(BOOL enable) +{ + if (mTextEntry) + { + mTextEntry->setKeystrokeOnEsc(enable); + } +} + void LLComboBox::onTextEntry(LLLineEditor* line_editor) { if (mTextEntryCallback != NULL) diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index c9b1212b70..7d38c051a5 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -126,6 +126,7 @@ public: virtual LLSD getValue() const; void setTextEntry(const LLStringExplicit& text); + void setKeystrokeOnEsc(BOOL enable); LLScrollListItem* add(const std::string& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu LLScrollListItem* add(const std::string& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index bd6b00d38b..cfab6b7fc8 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -125,6 +125,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mTextLeftEdge(0), // computed in updateTextPadding() below mTextRightEdge(0), // computed in updateTextPadding() below mCommitOnFocusLost( p.commit_on_focus_lost ), + mKeystrokeOnEsc(FALSE), mRevertOnEsc( p.revert_on_esc ), mKeystrokeCallback( p.keystroke_callback() ), mIsSelecting( FALSE ), @@ -1494,6 +1495,10 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) { setText(mPrevText); // Note, don't set handled, still want to loose focus (won't commit becase text is now unchanged) + if (mKeystrokeOnEsc) + { + onKeystroke(); + } } break; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 88468503df..287837a15c 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -214,6 +214,7 @@ public: void setCommitOnFocusLost( BOOL b ) { mCommitOnFocusLost = b; } void setRevertOnEsc( BOOL b ) { mRevertOnEsc = b; } + void setKeystrokeOnEsc(BOOL b) { mKeystrokeOnEsc = b; } void setCursorColor(const LLColor4& c) { mCursorColor = c; } const LLColor4& getCursorColor() const { return mCursorColor.get(); } @@ -338,6 +339,7 @@ protected: BOOL mCommitOnFocusLost; BOOL mRevertOnEsc; + BOOL mKeystrokeOnEsc; keystroke_callback_t mKeystrokeCallback; |