summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2009-11-18 14:40:22 +0200
committerVadim Savchuk <vsavchuk@productengine.com>2009-11-18 14:40:22 +0200
commit9fdae4414f7307f4599d395cfed912cec1d825bd (patch)
tree22a4996dd57fb98306e8b3c250372db9b49bbbcd /indra/llui
parent215b95eb64ebea58d6f2bda5f90e307836aca093 (diff)
parent125b779fb63cafe4e5df4d601542def1b4bc05f3 (diff)
Merge from default branch
--HG-- branch : product-engine
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.cpp26
-rw-r--r--indra/llui/llcombobox.h7
-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, 29 insertions, 20 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..f29e8785eb 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -102,14 +102,14 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p)
mMaxChars(p.max_chars),
mPrearrangeCallback(p.prearrange_callback()),
mTextEntryCallback(p.text_entry_callback()),
- mSelectionCallback(p.selection_callback()),
mListPosition(p.list_position),
mLastSelectedIndex(-1)
{
// 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 +140,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 +648,7 @@ void LLComboBox::hideList()
}
}
-void LLComboBox::onButtonDown()
+void LLComboBox::onButtonMouseDown()
{
if (!mList->getVisible())
{
@@ -670,6 +674,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 +687,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
@@ -706,12 +720,6 @@ void LLComboBox::onItemSelected(const LLSD& data)
// commit does the reverse, asserting the value in the list
onCommit();
-
- // call the callback if it exists
- if(mSelectionCallback)
- {
- mSelectionCallback(this, data);
- }
}
BOOL LLComboBox::handleToolTip(S32 x, S32 y, MASK mask)
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 6285ca5170..4f27588467 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -82,8 +82,7 @@ public:
allow_new_values;
Optional<S32> max_chars;
Optional<commit_callback_t> prearrange_callback,
- text_entry_callback,
- selection_callback;
+ text_entry_callback;
Optional<EPreferredPosition, PreferredPositionValues> list_position;
@@ -200,11 +199,11 @@ public:
void setPrearrangeCallback( commit_callback_t cb ) { mPrearrangeCallback = cb; }
void setTextEntryCallback( commit_callback_t cb ) { mTextEntryCallback = cb; }
- void setSelectionCallback( commit_callback_t cb ) { mSelectionCallback = cb; }
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;