summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp5
-rw-r--r--indra/llui/llbutton.h1
-rw-r--r--indra/llui/lltooltip.cpp46
-rw-r--r--indra/llui/lltooltip.h3
4 files changed, 41 insertions, 14 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index fd369730d6..a7946cacf5 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -486,6 +486,11 @@ void LLButton::onMouseLeave(S32 x, S32 y, MASK mask)
mNeedsHighlight = FALSE;
}
+void LLButton::setHighlight(bool b)
+{
+ mNeedsHighlight = b;
+}
+
BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
{
if (!childrenHandleHover(x, y, mask))
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 7fc4997133..839b196466 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -176,6 +176,7 @@ public:
BOOL getToggleState() const;
void setToggleState(BOOL b);
+ void setHighlight(bool b);
void setFlashing( BOOL b );
BOOL getFlashing() const { return mFlashing; }
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index 93a4adc9b6..2a30eb4b5b 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -170,7 +170,10 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
: LLPanel(p),
mMaxWidth(p.max_width),
mHasClickCallback(p.click_callback.isProvided()),
- mPadding(p.padding)
+ mPadding(p.padding),
+ mTextBox(NULL),
+ mInfoButton(NULL),
+ mPlayMediaButton(NULL)
{
LLTextBox::Params params;
params.initial_value = "tip_text";
@@ -194,25 +197,26 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
S32 TOOLTIP_PLAYBUTTON_SIZE = 0;
if (p.image.isProvided())
{
- LLIconCtrl::Params icon_params;
- icon_params.name = "tooltip_icon";
+ LLButton::Params icon_params;
+ icon_params.name = "tooltip_info";
LLRect icon_rect;
LLUIImage* imagep = p.image;
TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16);
icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
icon_params.rect = icon_rect;
- icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
- icon_params.image = p.image;
- icon_params.mouse_opaque = false;
- LLIconCtrl* tooltip_icon = LLUICtrlFactory::create<LLIconCtrl>(icon_params);
- addChild(tooltip_icon);
-
- // move text over to fit image in
- mTextBox->translate(TOOLTIP_ICON_SIZE + mPadding, 0);
+ //icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
+ icon_params.image_unselected(imagep);
+ icon_params.scale_image(true);
+ icon_params.flash_color(icon_params.highlight_color());
+ mInfoButton = LLUICtrlFactory::create<LLButton>(icon_params);
if (p.click_callback.isProvided())
{
- tooltip_icon->setMouseUpCallback(boost::bind(p.click_callback()));
+ mInfoButton->setCommitCallback(boost::bind(p.click_callback()));
}
+ addChild(mInfoButton);
+
+ // move text over to fit image in
+ mTextBox->translate(TOOLTIP_ICON_SIZE + mPadding, 0);
}
if (p.time_based_media.isProvided() && p.time_based_media == true)
@@ -221,11 +225,12 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
p_button.name(std::string("play_media"));
TOOLTIP_PLAYBUTTON_SIZE = 16;
LLRect button_rect;
- button_rect.setOriginAndSize((mPadding +TOOLTIP_ICON_SIZE),mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
+ button_rect.setOriginAndSize((mPadding +TOOLTIP_ICON_SIZE+ mPadding ), mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE);
p_button.rect = button_rect;
p_button.image_selected.name("button_anim_pause.tga");
p_button.image_unselected.name("button_anim_play.tga");
p_button.scale_image(true);
+
mPlayMediaButton = LLUICtrlFactory::create<LLButton>(p_button);
if(p.click_playmedia_callback.isProvided())
{
@@ -240,6 +245,11 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p)
// move text over to fit image in
mTextBox->translate(TOOLTIP_PLAYBUTTON_SIZE + mPadding, 0);
}
+
+ if (p.click_callback.isProvided())
+ {
+ setMouseUpCallback(boost::bind(p.click_callback()));
+ }
}
void LLToolTip::setValue(const LLSD& value)
@@ -286,6 +296,9 @@ void LLToolTip::setVisible(BOOL visible)
BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask)
{
+ //mInfoButton->setFlashing(true);
+ mInfoButton->setHighlight(true);
+
LLPanel::handleHover(x, y, mask);
if (mHasClickCallback)
{
@@ -294,6 +307,13 @@ BOOL LLToolTip::handleHover(S32 x, S32 y, MASK mask)
return TRUE;
}
+void LLToolTip::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+ //mInfoButton->setFlashing(true);
+ mInfoButton->setHighlight(false);
+ LLUICtrl::onMouseLeave(x, y, mask);
+}
+
void LLToolTip::draw()
{
F32 alpha = 1.f;
diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h
index fa30d5554a..a81876eac1 100644
--- a/indra/llui/lltooltip.h
+++ b/indra/llui/lltooltip.h
@@ -94,7 +94,7 @@ public:
};
/*virtual*/ void draw();
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
-
+ /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask);
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ void setVisible(BOOL visible);
@@ -106,6 +106,7 @@ public:
private:
class LLTextBox* mTextBox;
+ class LLButton* mInfoButton;
class LLButton* mPlayMediaButton;
LLFrameTimer mFadeTimer;
LLFrameTimer mVisibleTimer;