summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychatbar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r--indra/newview/llnearbychatbar.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index b4224e30e6..00ff81724c 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -34,6 +34,7 @@
#include "llfirstuse.h"
#include "llnearbychatbar.h"
+#include "llnearbychatbarlistener.h"
#include "llagent.h"
#include "llgesturemgr.h"
#include "llmultigesture.h"
@@ -80,6 +81,7 @@ LLNearbyChatBar::LLNearbyChatBar(const LLSD& key)
mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT)
{
mSpeakerMgr = LLLocalSpeakerMgr::getInstance();
+ mListener.reset(new LLNearbyChatBarListener(*this));
}
//virtual
@@ -103,15 +105,17 @@ BOOL LLNearbyChatBar::postBuild()
mNearbyChat = getChildView("nearby_chat");
- LLUICtrl* show_btn = getChild<LLUICtrl>("show_nearby_chat");
+ gSavedSettings.declareBOOL("nearbychat_history_visibility", mNearbyChat->getVisible(), "Visibility state of nearby chat history", TRUE);
+ BOOL show_nearby_chat = gSavedSettings.getBOOL("nearbychat_history_visibility");
+
+ LLButton* show_btn = getChild<LLButton>("show_nearby_chat");
show_btn->setCommitCallback(boost::bind(&LLNearbyChatBar::onToggleNearbyChatPanel, this));
+ show_btn->setToggleState(show_nearby_chat);
mOutputMonitor = getChild<LLOutputMonitorCtrl>("chat_zone_indicator");
mOutputMonitor->setVisible(FALSE);
- gSavedSettings.declareBOOL("nearbychat_history_visibility", mNearbyChat->getVisible(), "Visibility state of nearby chat history", TRUE);
-
- mNearbyChat->setVisible(gSavedSettings.getBOOL("nearbychat_history_visibility"));
+ showNearbyChatPanel(show_nearby_chat);
// Register for font change notifications
LLViewerChat::setFontChangedCallback(boost::bind(&LLNearbyChatBar::onChatFontChange, this, _1));
@@ -392,26 +396,23 @@ void LLNearbyChatBar::sendChat( EChatType type )
}
}
-
-void LLNearbyChatBar::onToggleNearbyChatPanel()
+void LLNearbyChatBar::showNearbyChatPanel(bool show)
{
- LLView* nearby_chat = getChildView("nearby_chat");
-
- if (nearby_chat->getVisible())
+ if (!show)
{
- if (!isMinimized())
+ if (mNearbyChat->getVisible() && !isMinimized())
{
mExpandedHeight = getRect().getHeight();
}
setResizeLimits(getMinWidth(), COLLAPSED_HEIGHT);
- nearby_chat->setVisible(FALSE);
+ mNearbyChat->setVisible(FALSE);
reshape(getRect().getWidth(), COLLAPSED_HEIGHT);
enableResizeCtrls(true, true, false);
storeRectControl();
}
else
{
- nearby_chat->setVisible(TRUE);
+ mNearbyChat->setVisible(TRUE);
setResizeLimits(getMinWidth(), EXPANDED_MIN_HEIGHT);
reshape(getRect().getWidth(), mExpandedHeight);
enableResizeCtrls(true);
@@ -421,6 +422,11 @@ void LLNearbyChatBar::onToggleNearbyChatPanel()
gSavedSettings.setBOOL("nearbychat_history_visibility", mNearbyChat->getVisible());
}
+void LLNearbyChatBar::onToggleNearbyChatPanel()
+{
+ showNearbyChatPanel(!mNearbyChat->getVisible());
+}
+
void LLNearbyChatBar::setMinimized(BOOL b)
{
LLNearbyChat* nearby_chat = getChild<LLNearbyChat>("nearby_chat");