summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Linden <none@none>2011-10-16 23:37:55 -0700
committerRichard Linden <none@none>2011-10-16 23:37:55 -0700
commit6d1ae4e0d6668983dc9386903155e426bd2912a3 (patch)
tree8cb851b3f50bee8c5c38b9f00d83eba22272adc1 /indra
parent7335136cbbe4343dadaee5e029f678e16c9d2062 (diff)
wip on dragging disabled toolbar buttons
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llbutton.h4
-rw-r--r--indra/llui/lltoolbar.cpp37
-rw-r--r--indra/llui/lltoolbar.h11
-rw-r--r--indra/newview/skins/default/xui/en/widgets/toolbar.xml4
4 files changed, 50 insertions, 6 deletions
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 7d9adcd892..1aa58ed9aa 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -94,6 +94,7 @@ public:
image_color,
image_color_disabled,
image_overlay_color,
+ image_overlay_disabled_color,
flash_color;
// layout
@@ -286,11 +287,9 @@ protected:
S32 mButtonFlashCount;
F32 mButtonFlashRate;
-private:
void drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size);
void resetMouseDownTimer();
-private:
commit_signal_t* mMouseDownSignal;
commit_signal_t* mMouseUpSignal;
commit_signal_t* mHeldDownSignal;
@@ -306,6 +305,7 @@ private:
LLPointer<LLUIImage> mImageOverlay;
LLFontGL::HAlign mImageOverlayAlignment;
LLUIColor mImageOverlayColor;
+ LLUIColor mImageOverlayDisabledColor;
LLPointer<LLUIImage> mImageUnselected;
LLUIString mUnselectedLabel;
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 226a218e47..4d88c37fda 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -692,7 +692,7 @@ void LLToolBar::draw()
{
const bool button_command_enabled = (*btn->mIsEnabledSignal)(btn, command->isEnabledParameters());
// TODO: make button appear disabled but have it still respond to drag and drop
- btn->setEnabled(button_command_enabled);
+ btn->setEnabled(false);//button_command_enabled);
}
if (command && btn->mIsRunningSignal)
@@ -901,7 +901,14 @@ LLToolBarButton::LLToolBarButton(const Params& p)
mIsStartingSignal(NULL),
mIsDragged(false),
mStartDragItemCallback(NULL),
- mHandleDragItemCallback(NULL)
+ mHandleDragItemCallback(NULL),
+ mOriginalImageSelected(p.image_selected),
+ mOriginalImageUnselected(p.image_unselected),
+ mOriginalImagePressed(p.image_pressed),
+ mOriginalImagePressedSelected(p.image_pressed_selected),
+ mOriginalLabelColor(p.label_color),
+ mOriginalLabelColorSelected(p.label_color_selected),
+ mOriginalImageOverlayColor(p.image_overlay_color)
{
mButtonFlashRate = 0.0;
mButtonFlashCount = 0;
@@ -980,6 +987,32 @@ void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent)
LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent);
}
+void LLToolBarButton::setEnabled(BOOL enabled)
+{
+ if (enabled)
+ {
+ mImageSelected = mOriginalImageSelected;
+ mImageUnselected = mOriginalImageUnselected;
+ mImagePressed = mOriginalImagePressed;
+ mImagePressedSelected = mOriginalImagePressedSelected;
+ mUnselectedLabelColor = mOriginalLabelColor;
+ mSelectedLabelColor = mOriginalLabelColorSelected;
+ mImageOverlayColor = mOriginalImageOverlayColor;
+ }
+
+ else
+ {
+ mImageSelected = mImageDisabledSelected;
+ mImageUnselected = mImageDisabled;
+ mImagePressed = mImageDisabled;
+ mImagePressedSelected = mImageDisabledSelected;
+ mUnselectedLabelColor = mDisabledLabelColor;
+ mSelectedLabelColor = mDisabledSelectedLabelColor;
+ mImageOverlayColor = mImageOverlayDisabledColor;
+ }
+}
+
+
const std::string LLToolBarButton::getToolTip() const
{
std::string tooltip;
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index f7ec318652..47af039d52 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -48,7 +48,7 @@ public:
struct Params : public LLInitParam::Block<Params, LLButton::Params>
{
Optional<LLUI::RangeS32::Params> button_width;
- Optional<S32> desired_height;
+ Optional<S32> desired_height;
Params()
: button_width("button_width"),
@@ -63,7 +63,7 @@ public:
BOOL handleMouseDown(S32 x, S32 y, MASK mask);
BOOL handleHover(S32 x, S32 y, MASK mask);
void reshape(S32 width, S32 height, BOOL called_from_parent = true);
-
+ void setEnabled(BOOL enabled);
void setCommandId(const LLCommandId& id) { mId = id; }
void setStartDragCallback(tool_startdrag_callback_t cb) { mStartDragItemCallback = cb; }
@@ -89,6 +89,13 @@ private:
enable_signal_t* mIsEnabledSignal;
enable_signal_t* mIsRunningSignal;
enable_signal_t* mIsStartingSignal;
+ LLPointer<LLUIImage> mOriginalImageSelected,
+ mOriginalImageUnselected,
+ mOriginalImagePressed,
+ mOriginalImagePressedSelected;
+ LLUIColor mOriginalLabelColor,
+ mOriginalLabelColorSelected,
+ mOriginalImageOverlayColor;
};
diff --git a/indra/newview/skins/default/xui/en/widgets/toolbar.xml b/indra/newview/skins/default/xui/en/widgets/toolbar.xml
index be5dfaf18c..7e7a9c61cf 100644
--- a/indra/newview/skins/default/xui/en/widgets/toolbar.xml
+++ b/indra/newview/skins/default/xui/en/widgets/toolbar.xml
@@ -18,6 +18,8 @@
image_pressed="PushButton_Press"
image_pressed_selected="PushButton_Selected_Press"
image_selected="PushButton_Selected_Press"
+ image_disabled_selected="PushButton_Selected_Disabled"
+ image_disabled="PushButton_Disabled"
button_width.min="70"
button_width.max="140"
desired_height="24"
@@ -36,6 +38,8 @@
image_pressed="PushButton_Press"
image_pressed_selected="PushButton_Selected_Press"
image_selected="PushButton_Selected_Press"
+ image_disabled_selected="PushButton_Selected_Disabled"
+ image_disabled="PushButton_Disabled"
desired_height="38"
button_width.min="38"
button_width.max="38"