From e2824864590ded669eac3c53efbfc60d04107ee4 Mon Sep 17 00:00:00 2001
From: AlexanderP ProductEngine <apaschenko@productengine.com>
Date: Tue, 15 May 2012 22:19:20 +0300
Subject: [PATCH] CHUI-105 WIP Hide an additional close button for undocked
 state of an IM floater

---
 indra/newview/llimfloater.cpp | 10 ++++++++++
 indra/newview/llimfloater.h   |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index cb489627fbe..1ca3545aae7 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -391,6 +391,12 @@ BOOL LLIMFloater::postBuild()
 	}
 }
 
+void LLIMFloater::onTearOffClicked(LLIMFloater* self)
+{
+	onClickTearOff(self);
+	updateTitleButtons();
+}
+
 void LLIMFloater::boundVoiceChannel()
 {
 	LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
@@ -1377,6 +1383,7 @@ void LLIMFloater::updateTitleButtons()
 	}
 
 	bool is_hosted = getHost() != NULL;
+
 	if (is_hosted) ///< floater is hosted
 	{
 		for (S32 i = 0; i < BUTTON_COUNT; i++)
@@ -1391,6 +1398,7 @@ void LLIMFloater::updateTitleButtons()
 		}
 
 		mExpandCollapseBtn->setImageOverlay(getString("collapse_icon"));
+
 	}
 	else ///< floater is torn off
 	{
@@ -1403,6 +1411,8 @@ void LLIMFloater::updateTitleButtons()
 		}
 	}
 
+	getChild<LLButton>("close_btn")->setVisible(is_hosted);
+
 	LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID);
 	if (session)
 	{
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 60b392952f3..03f52fb3160 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -93,6 +93,7 @@ class LLIMFloater
 
 	// called when docked floater's position has been set by chiclet
 	void setPositioned(bool b) { mPositioned = b; };
+
 	void onVisibilityChange(const LLSD& new_visibility);
 
 	// Implements LLVoiceClientStatusObserver::onChange() to enable the call
@@ -139,6 +140,8 @@ class LLIMFloater
 	/* virtual */ void onFocusLost();
 	/* virtual */ void onFocusReceived();
 
+	void onTearOffClicked(LLIMFloater *self);
+
 	// Update the window title, input field help text, etc.
 	void updateSessionName(const std::string& ui_title, const std::string& ui_label);
 
-- 
GitLab