Commits

Richard Linden  committed 6ecbd2c

wip on dragging disabled toolbar buttons

  • Participants
  • Parent commits 7338e5d

Comments (0)

Files changed (4)

File indra/llui/llbutton.h

 								image_color,
 								image_color_disabled,
 								image_overlay_color,
+								image_overlay_disabled_color,
 								flash_color;
 
 		// layout
 	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;
 	LLPointer<LLUIImage>		mImageOverlay;
 	LLFontGL::HAlign			mImageOverlayAlignment;
 	LLUIColor					mImageOverlayColor;
+	LLUIColor					mImageOverlayDisabledColor;
 
 	LLPointer<LLUIImage>		mImageUnselected;
 	LLUIString					mUnselectedLabel;

File indra/llui/lltoolbar.cpp

 			{
 				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)
 	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;
 	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;

File indra/llui/lltoolbar.h

 	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"),
 	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; }
 	enable_signal_t*	mIsEnabledSignal;
 	enable_signal_t*	mIsRunningSignal;
 	enable_signal_t*	mIsStartingSignal;
+	LLPointer<LLUIImage>	mOriginalImageSelected,
+							mOriginalImageUnselected,
+							mOriginalImagePressed,
+							mOriginalImagePressedSelected;
+	LLUIColor				mOriginalLabelColor,
+							mOriginalLabelColorSelected,
+							mOriginalImageOverlayColor;
 };
 
 

File indra/newview/skins/default/xui/en/widgets/toolbar.xml

                         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"
                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"