summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcombobox.cpp12
-rw-r--r--indra/llui/llcombobox.h4
-rw-r--r--indra/llui/lldockablefloater.cpp34
-rw-r--r--indra/llui/lldockablefloater.h9
-rw-r--r--indra/llui/llfiltereditor.cpp1
-rw-r--r--indra/llui/lllineeditor.cpp3
-rw-r--r--indra/llui/lllineeditor.h1
-rw-r--r--indra/llui/llmenugl.cpp34
-rw-r--r--indra/llui/llmenugl.h4
-rw-r--r--indra/llui/llscrolllistctrl.h2
10 files changed, 96 insertions, 8 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index ef0d4c1c03..58aeb61728 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -78,6 +78,7 @@ LLComboBox::ItemParams::ItemParams()
LLComboBox::Params::Params()
: allow_text_entry("allow_text_entry", false),
+ allow_new_values("allow_new_values", false),
show_text_as_tentative("show_text_as_tentative", true),
max_chars("max_chars", 20),
list_position("list_position", BELOW),
@@ -97,6 +98,7 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mTextEntryTentative(p.show_text_as_tentative),
mHasAutocompletedText(false),
mAllowTextEntry(p.allow_text_entry),
+ mAllowNewValues(p.allow_new_values),
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
@@ -621,7 +623,15 @@ void LLComboBox::hideList()
if (mList->getVisible())
{
// assert selection in list
- mList->selectNthItem(mLastSelectedIndex);
+ if(mAllowNewValues)
+ {
+ // mLastSelectedIndex = -1 means that we entered a new value, don't select
+ // any of existing items in this case.
+ if(mLastSelectedIndex >= 0)
+ mList->selectNthItem(mLastSelectedIndex);
+ }
+ else
+ mList->selectNthItem(mLastSelectedIndex);
mButton->setToggleState(FALSE);
mList->setVisible(FALSE);
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 018d472d62..68cbfeeeeb 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -78,7 +78,8 @@ public:
: public LLInitParam::Block<Params, LLUICtrl::Params>
{
Optional<bool> allow_text_entry,
- show_text_as_tentative;
+ show_text_as_tentative,
+ allow_new_values;
Optional<S32> max_chars;
Optional<commit_callback_t> prearrange_callback,
text_entry_callback,
@@ -224,6 +225,7 @@ protected:
private:
BOOL mAllowTextEntry;
+ BOOL mAllowNewValues;
S32 mMaxChars;
BOOL mTextEntryTentative;
commit_callback_t mPrearrangeCallback;
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index 5243f67a76..29f78f6290 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -34,10 +34,14 @@
#include "lldockablefloater.h"
+//static
+LLDockableFloater* LLDockableFloater::instance = NULL;
+
LLDockableFloater::LLDockableFloater(LLDockControl* dockControl,
const LLSD& key, const Params& params) :
LLFloater(key, params), mDockControl(dockControl)
{
+ resetInstance();
}
LLDockableFloater::~LLDockableFloater()
@@ -51,12 +55,42 @@ BOOL LLDockableFloater::postBuild()
return LLView::postBuild();
}
+void LLDockableFloater::resetInstance()
+{
+ if (instance != this)
+ {
+ if (instance != NULL && instance->isDocked())
+ {
+ //closeFloater() is not virtual
+ if (instance->canClose())
+ {
+ instance->closeFloater();
+ }
+ else
+ {
+ instance->setVisible(FALSE);
+ }
+ }
+ instance = this;
+ }
+}
+
+void LLDockableFloater::setVisible(BOOL visible)
+{
+ if(visible && isDocked())
+ {
+ resetInstance();
+ }
+ LLFloater::setVisible(visible);
+}
+
void LLDockableFloater::setDocked(bool docked, bool pop_on_undock)
{
if (mDockControl.get() != NULL)
{
if (docked)
{
+ resetInstance();
mDockControl.get()->on();
}
else
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index da86889c33..b977888803 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -52,6 +52,14 @@ public:
/* virtula */BOOL postBuild();
/* virtual */void setDocked(bool docked, bool pop_on_undock = true);
/* virtual */void draw();
+ /*virtual*/ void setVisible(BOOL visible);
+
+private:
+ /**
+ * Provides unique of dockable floater.
+ * If dockable floater already exists it should be closed.
+ */
+ void resetInstance();
protected:
void setDockControl(LLDockControl* dockControl);
@@ -61,6 +69,7 @@ protected:
private:
std::auto_ptr<LLDockControl> mDockControl;
LLUIImagePtr mDockTongue;
+ static LLDockableFloater* instance;
};
#endif /* LL_DOCKABLEFLOATER_H */
diff --git a/indra/llui/llfiltereditor.cpp b/indra/llui/llfiltereditor.cpp
index 7d6a4007a2..26b5f2e182 100644
--- a/indra/llui/llfiltereditor.cpp
+++ b/indra/llui/llfiltereditor.cpp
@@ -44,6 +44,7 @@ LLFilterEditor::LLFilterEditor(const LLFilterEditor::Params& p)
line_editor_p.rect(getLocalRect());
line_editor_p.follows.flags(FOLLOWS_ALL);
line_editor_p.text_pad_right(getRect().getHeight());
+ line_editor_p.revert_on_esc(false);
line_editor_p.keystroke_callback(boost::bind(&LLUICtrl::onCommit, this));
mFilterEditor = LLUICtrlFactory::create<LLLineEditor>(line_editor_p);
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 5435b9ffbf..ede67ad17d 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -97,6 +97,7 @@ LLLineEditor::Params::Params()
background_image_focused("background_image_focused"),
select_on_focus("select_on_focus", false),
handle_edit_keys_directly("handle_edit_keys_directly", false),
+ revert_on_esc("revert_on_esc", true),
commit_on_focus_lost("commit_on_focus_lost", true),
ignore_tab("ignore_tab", true),
cursor_color("cursor_color"),
@@ -130,7 +131,7 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
mMinHPixels(0), // computed in updateTextPadding() below
mMaxHPixels(0), // computed in updateTextPadding() below
mCommitOnFocusLost( p.commit_on_focus_lost ),
- mRevertOnEsc( TRUE ),
+ mRevertOnEsc( p.revert_on_esc ),
mKeystrokeCallback( p.keystroke_callback() ),
mIsSelecting( FALSE ),
mSelectionStart( 0 ),
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 0986ce5a87..a024f48cc6 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -90,6 +90,7 @@ public:
Optional<bool> select_on_focus,
handle_edit_keys_directly,
+ revert_on_esc,
commit_on_focus_lost,
ignore_tab;
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 2bc4f009cc..e0bb6bd5d3 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3371,6 +3371,34 @@ BOOL LLMenuHolderGL::handleRightMouseUp( S32 x, S32 y, MASK mask )
return handled;
}
+BOOL LLMenuHolderGL::handleKey(KEY key, MASK mask, BOOL called_from_parent)
+{
+ BOOL handled = false;
+ LLMenuGL* const pMenu = dynamic_cast<LLMenuGL*>(getVisibleMenu());
+
+ if (pMenu)
+ {
+ //handle ESCAPE and RETURN key
+ handled = LLPanel::handleKey(key, mask, called_from_parent);
+ if (!handled)
+ {
+ if (pMenu->getHighlightedItem())
+ {
+ handled = pMenu->handleKey(key, mask, TRUE);
+ }
+ else
+ {
+ //highlight first enabled one
+ pMenu->highlightNextItem(NULL);
+ handled = true;
+ }
+ }
+ }
+
+ return handled;
+
+}
+
void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
{
if (width != getRect().getWidth() || height != getRect().getHeight())
@@ -3380,17 +3408,17 @@ void LLMenuHolderGL::reshape(S32 width, S32 height, BOOL called_from_parent)
LLView::reshape(width, height, called_from_parent);
}
-BOOL LLMenuHolderGL::hasVisibleMenu() const
+LLView* const LLMenuHolderGL::getVisibleMenu() const
{
for ( child_list_const_iter_t child_it = getChildList()->begin(); child_it != getChildList()->end(); ++child_it)
{
LLView* viewp = *child_it;
if (viewp->getVisible() && dynamic_cast<LLMenuBarGL*>(viewp) == NULL)
{
- return TRUE;
+ return viewp;
}
}
- return FALSE;
+ return NULL;
}
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 0bf6301f93..8309fedf7f 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -772,8 +772,10 @@ public:
// Close context menus on right mouse up not handled by menus.
/*virtual*/ BOOL handleRightMouseUp( S32 x, S32 y, MASK mask );
+ virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
virtual const LLRect getMenuRect() const { return getLocalRect(); }
- virtual BOOL hasVisibleMenu() const;
+ LLView*const getVisibleMenu() const;
+ virtual BOOL hasVisibleMenu() const {return getVisibleMenu() != NULL;}
static void setActivatedItem(LLMenuItemGL* item);
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index bbf8e86660..49a49499ef 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -350,7 +350,7 @@ public:
void sortOnce(S32 column, BOOL ascending);
// manually call this whenever editing list items in place to flag need for resorting
- void setNeedsSort() { mSorted = false; }
+ void setNeedsSort(bool val = true) { mSorted = !val; }
void dirtyColumns(); // some operation has potentially affected column layout or ordering
protected: