diff options
Diffstat (limited to 'indra/newview/llfloaternotificationsconsole.cpp')
-rw-r--r-- | indra/newview/llfloaternotificationsconsole.cpp | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp index e6250063f7..f2dff55044 100644 --- a/indra/newview/llfloaternotificationsconsole.cpp +++ b/indra/newview/llfloaternotificationsconsole.cpp @@ -36,9 +36,9 @@ #include "lluictrlfactory.h" #include "llbutton.h" #include "llscrolllistctrl.h" +#include "llscrolllistitem.h" #include "llpanel.h" #include "llcombobox.h" -#include "llviewertexteditor.h" const S32 NOTIFICATION_PANEL_HEADER_HEIGHT = 20; const S32 HEADER_PADDING = 38; @@ -59,11 +59,12 @@ private: }; LLNotificationChannelPanel::LLNotificationChannelPanel(const std::string& channel_name) - : LLPanel(channel_name) + : LLPanel() { mChannelPtr = LLNotifications::instance().getChannel(channel_name); mChannelRejectsPtr = LLNotificationChannelPtr( - LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(), !boost::bind(mChannelPtr->getFilter(), _1))); + LLNotificationChannel::buildChannel(channel_name + "rejects", mChannelPtr->getParentChannelName(), + !boost::bind(mChannelPtr->getFilter(), _1))); LLUICtrlFactory::instance().buildPanel(this, "panel_notifications_channel.xml"); } @@ -77,13 +78,11 @@ BOOL LLNotificationChannelPanel::postBuild() mChannelRejectsPtr->connectChanged(boost::bind(&LLNotificationChannelPanel::update, this, _1, false)); LLScrollListCtrl* scroll = getChild<LLScrollListCtrl>("notifications_list"); - scroll->setDoubleClickCallback(onClickNotification); - scroll->setCallbackUserData(this); - + scroll->setDoubleClickCallback(onClickNotification, this); + scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); scroll = getChild<LLScrollListCtrl>("notification_rejects_list"); - scroll->setDoubleClickCallback(onClickNotificationReject); - scroll->setCallbackUserData(this); - + scroll->setDoubleClickCallback(onClickNotificationReject, this); + scroll->setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mRight, 0)); return TRUE; } @@ -161,17 +160,13 @@ bool LLNotificationChannelPanel::update(const LLSD& payload, bool passed_filter) // LLFloaterNotificationConsole // LLFloaterNotificationConsole::LLFloaterNotificationConsole(const LLSD& key) +: LLFloater(key) { - LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml"); -} + mCommitCallbackRegistrar.add("ClickAdd", boost::bind(&LLFloaterNotificationConsole::onClickAdd, this)); -void LLFloaterNotificationConsole::onClose(bool app_quitting) -{ - setVisible(FALSE); - //destroy(); + //LLUICtrlFactory::instance().buildFloater(this, "floater_notifications_console.xml"); } - BOOL LLFloaterNotificationConsole::postBuild() { // these are in the order of processing @@ -186,7 +181,7 @@ BOOL LLFloaterNotificationConsole::postBuild() addChannel("Notifications"); addChannel("NotificationTips"); - getChild<LLButton>("add_notification")->setClickedCallback(onClickAdd, this); +// getChild<LLButton>("add_notification")->setClickedCallback(onClickAdd, this); LLComboBox* notifications = getChild<LLComboBox>("notification_types"); LLNotifications::TemplateNames names = LLNotifications::instance().getTemplateNames(); @@ -216,12 +211,9 @@ void LLFloaterNotificationConsole::addChannel(const std::string& name, bool open void LLFloaterNotificationConsole::removeChannel(const std::string& name) { - LLPanel* panelp = getChild<LLPanel>(name, TRUE, FALSE); - if (panelp) - { - getChildRef<LLLayoutStack>("notification_channels").removePanel(panelp); - delete panelp; - } + LLPanel* panelp = getChild<LLPanel>(name); + getChildRef<LLLayoutStack>("notification_channels").removePanel(panelp); + delete panelp; updateResizeLimits(); } @@ -229,15 +221,15 @@ void LLFloaterNotificationConsole::removeChannel(const std::string& name) //static void LLFloaterNotificationConsole::updateResizeLimits() { + static LLUICachedControl<S32> floater_header_size ("UIFloaterHeaderSize", 0); + LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels"); - setResizeLimits(getMinWidth(), LLFLOATER_HEADER_SIZE + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); + setResizeLimits(getMinWidth(), floater_header_size + HEADER_PADDING + ((NOTIFICATION_PANEL_HEADER_HEIGHT + 3) * stack.getNumPanels())); } -void LLFloaterNotificationConsole::onClickAdd(void* user_data) +void LLFloaterNotificationConsole::onClickAdd() { - LLFloaterNotificationConsole* floater = (LLFloaterNotificationConsole*)user_data; - - std::string message_name = floater->getChild<LLComboBox>("notification_types")->getValue().asString(); + std::string message_name = getChild<LLComboBox>("notification_types")->getValue().asString(); if (!message_name.empty()) { LLNotifications::instance().add(message_name, LLSD()); @@ -247,15 +239,17 @@ void LLFloaterNotificationConsole::onClickAdd(void* user_data) //=============== LLFloaterNotification ================ -LLFloaterNotification::LLFloaterNotification(LLNotification* note) : mNote(note) +LLFloaterNotification::LLFloaterNotification(LLNotification* note) +: LLFloater(LLSD()), + mNote(note) { - LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml"); + LLUICtrlFactory::instance().buildFloater(this, "floater_notification.xml", NULL); } BOOL LLFloaterNotification::postBuild() { setTitle(mNote->getName()); - getChild<LLViewerTextEditor>("payload")->setText(mNote->getMessage()); + getChild<LLUICtrl>("payload")->setValue(mNote->getMessage()); LLComboBox* responses_combo = getChild<LLComboBox>("response"); LLCtrlListInterface* response_list = responses_combo->getListInterface(); @@ -265,8 +259,7 @@ BOOL LLFloaterNotification::postBuild() return TRUE; } - responses_combo->setCommitCallback(onCommitResponse); - responses_combo->setCallbackUserData(this); + responses_combo->setCommitCallback(onCommitResponse, this); LLSD form_sd = form->asLLSD(); |