summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-11-16 12:52:25 -0800
committerJames Cook <james@lindenlab.com>2009-11-16 12:52:25 -0800
commit7cc233b3a83bd82f7a42bf1f64901d2578beaf2c (patch)
tree272ae2be67ebb6f100ee0fa87767735f5dd76d51
parentd5efbfcd2874dd7045baabe33944da37e738872e (diff)
EXT-772 Dropbox widget needs "pressed" state - currently shows wrong art
Reviewed with Richard.
-rw-r--r--indra/llui/llcombobox.cpp19
-rw-r--r--indra/llui/llcombobox.h3
-rw-r--r--indra/newview/skins/default/textures/textures.xml1
-rw-r--r--indra/newview/skins/default/xui/en/widgets/button.xml4
-rw-r--r--indra/newview/skins/default/xui/en/widgets/combo_box.xml4
5 files changed, 27 insertions, 4 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 36e309d639..803978bfa2 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -109,7 +109,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
// Text label button
LLButton::Params button_params = (mAllowTextEntry ? p.combo_button : p.drop_down_button);
- button_params.mouse_down_callback.function(boost::bind(&LLComboBox::onButtonDown, this));
+ button_params.mouse_down_callback.function(
+ boost::bind(&LLComboBox::onButtonMouseDown, this));
button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT);
button_params.rect(p.rect);
@@ -140,6 +141,10 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mList = LLUICtrlFactory::create<LLScrollListCtrl>(params);
addChild(mList);
+ // Mouse-down on button will transfer mouse focus to the list
+ // Grab the mouse-up event and make sure the button state is correct
+ mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this));
+
for (LLInitParam::ParamIterator<ItemParams>::const_iterator it = p.items().begin();
it != p.items().end();
++it)
@@ -644,7 +649,7 @@ void LLComboBox::hideList()
}
}
-void LLComboBox::onButtonDown()
+void LLComboBox::onButtonMouseDown()
{
if (!mList->getVisible())
{
@@ -670,6 +675,10 @@ void LLComboBox::onButtonDown()
if (mButton->hasMouseCapture())
{
gFocusMgr.setMouseCapture(mList);
+
+ // But keep the "pressed" look, which buttons normally lose when they
+ // lose focus
+ mButton->setForcePressedState(true);
}
}
else
@@ -679,6 +688,12 @@ void LLComboBox::onButtonDown()
}
+void LLComboBox::onListMouseUp()
+{
+ // In some cases this is the termination of a mouse click that started on
+ // the button, so clear its pressed state
+ mButton->setForcePressedState(false);
+}
//------------------------------------------------------------------
// static functions
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 6285ca5170..11acdb9b8f 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -204,7 +204,8 @@ public:
void setButtonVisible(BOOL visible);
- void onButtonDown();
+ void onButtonMouseDown();
+ void onListMouseUp();
void onItemSelected(const LLSD& data);
void onTextCommit(const LLSD& data);
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index d5293bdbb5..8af65b25e9 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -106,6 +106,7 @@
<texture name="DropDown_Press" file_name="widgets/DropDown_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
<texture name="DropDown_Selected" file_name="widgets/DropDown_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
<texture name="DropDown_Off" file_name="widgets/DropDown_Off.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
+ <texture name="DropDown_On" file_name="widgets/DropDown_On.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
<texture name="DropTarget" file_name="widgets/DropTarget.png" preload="false" />
diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml
index 5bb48ef5aa..6b11e72247 100644
--- a/indra/newview/skins/default/xui/en/widgets/button.xml
+++ b/indra/newview/skins/default/xui/en/widgets/button.xml
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- Additional attributes:
+ image_pressed
+ image_pressed_selected
+ -->
<button image_unselected="PushButton_Off"
image_selected="PushButton_Selected"
image_disabled_selected="PushButton_Selected_Disabled"
diff --git a/indra/newview/skins/default/xui/en/widgets/combo_box.xml b/indra/newview/skins/default/xui/en/widgets/combo_box.xml
index fa3cb9275e..132bd24bca 100644
--- a/indra/newview/skins/default/xui/en/widgets/combo_box.xml
+++ b/indra/newview/skins/default/xui/en/widgets/combo_box.xml
@@ -16,7 +16,9 @@
scale_image="true"
pad_right="24"
image_unselected="DropDown_Off"
- image_selected="DropDown_Selected"
+ image_selected="DropDown_On"
+ image_pressed="DropDown_Press"
+ image_pressed_selected="DropDown_Press"
image_disabled="DropDown_Disabled" />
<combo_box.combo_list bg_writeable_color="MenuDefaultBgColor"
background_visible="true"