summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorRamzi Linden <ramzi@lindenlab.com>2009-11-18 03:15:30 +0800
committerRamzi Linden <ramzi@lindenlab.com>2009-11-18 03:15:30 +0800
commit2365dbcd459b37942ddacbcb7010232113a126c1 (patch)
treea1d02f23ce30af86f5c202aa440b1d5a15fdfedc /indra/llui
parentd6bbc652def68b5b8b67ef4049a1250aefdde7cb (diff)
parent6253e2611d3ecf4ff5c778d0e53f34aed06f35da (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp2
-rw-r--r--indra/llui/llbutton.h4
-rw-r--r--indra/llui/llcombobox.cpp19
-rw-r--r--indra/llui/llcombobox.h3
-rw-r--r--indra/llui/llmenubutton.cpp4
-rw-r--r--indra/llui/lltextbase.cpp2
-rw-r--r--indra/llui/lltooltip.cpp3
-rw-r--r--indra/llui/lltooltip.h1
8 files changed, 28 insertions, 10 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index bbaf908d2e..b65f248db2 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -146,7 +146,7 @@ LLButton::LLButton(const LLButton::Params& p)
mHoverGlowStrength(p.hover_glow_amount),
mCommitOnReturn(p.commit_on_return),
mFadeWhenDisabled(FALSE),
- mForcePressedState(FALSE),
+ mForcePressedState(false),
mLastDrawCharsCount(0)
{
static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 08f289092f..3c1b57c4be 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -238,7 +238,7 @@ public:
static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname);
static void showHelp(LLUICtrl* ctrl, const LLSD& sdname);
- void setForcePressedState(BOOL b) { mForcePressedState = b; }
+ void setForcePressedState(bool b) { mForcePressedState = b; }
protected:
LLPointer<LLUIImage> getImageUnselected() const { return mImageUnselected; }
@@ -315,7 +315,7 @@ private:
BOOL mNeedsHighlight;
BOOL mCommitOnReturn;
BOOL mFadeWhenDisabled;
- BOOL mForcePressedState;
+ bool mForcePressedState;
LLFrameTimer mFlashingTimer;
};
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/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp
index a657ed039a..cdbd17e4dc 100644
--- a/indra/llui/llmenubutton.cpp
+++ b/indra/llui/llmenubutton.cpp
@@ -133,11 +133,11 @@ void LLMenuButton::draw()
if (mMenuVisibleLastFrame)
{
- setForcePressedState(TRUE);
+ setForcePressedState(true);
}
LLButton::draw();
- setForcePressedState(FALSE);
+ setForcePressedState(false);
}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index a06b7e237b..caaf47240f 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1509,7 +1509,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c
std::string font_name = LLFontGL::nameFromFont(style_params.font());
std::string font_size = LLFontGL::sizeFromFont(style_params.font());
link_params.font.name(font_name);
- link_params.font.size(font_name);
+ link_params.font.size(font_size);
link_params.font.style("UNDERLINE");
link_params.link_href = match.getUrl();
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index bb85177811..959313a5b6 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -163,6 +163,7 @@ LLToolTip::Params::Params()
visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )),
sticky_rect("sticky_rect"),
image("image"),
+ text_color("text_color"),
time_based_media("time_based_media", false),
web_based_media("web_based_media", false),
media_playing("media_playing", false)
@@ -186,7 +187,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
params.h_pad = 0;
params.v_pad = 0;
params.mouse_opaque = false;
- params.text_color = LLUIColorTable::instance().getColor( "ToolTipTextColor" );
+ params.text_color = p.text_color;
params.bg_visible = false;
params.font = p.font;
params.use_ellipses = true;
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h
index 8c8fdf0a4c..7978b6a583 100644
--- a/indra/llui/lltooltip.h
+++ b/indra/llui/lltooltip.h
@@ -88,6 +88,7 @@ public:
Optional<LLRect> sticky_rect;
Optional<const LLFontGL*> font;
Optional<LLUIImage*> image;
+ Optional<LLUIColor> text_color;
Optional<bool> time_based_media,
web_based_media,
media_playing;