void LLPanelGroup::changed(LLGroupChange gc) { updateTabVisibility(); // Notify the currently active panel that group manager information has changed. LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); if (panelp) { panelp->update(gc); } }
LLPanelGroup::~LLPanelGroup() { LLGroupMgr::getInstance()->removeObserver(this); for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); if ( panelp ) panelp->removeObserver(this); } }
void LLPanelGroup::updateTabVisibility() { for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getPanelByIndex(i); BOOL visible = panelp->isVisibleByAgent(&gAgent) || gAgent.isGodlike(); mTabContainer->enableTabButton(i, visible); if ( !visible && mCurrentTab == panelp ) { //we are disabling the currently selected tab //select the previous one mTabContainer->selectPrevTab(); mCurrentTab = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); } } }
bool LLPanelGroup::apply() { // Pass this along to the currently visible tab. if (!mTabContainer) return false; LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); if (!panelp) return false; std::string mesg; if ( !panelp->needsApply(mesg) ) { // We don't need to apply anything. // We're done. return true; } // Ignore the needs apply message. // Try to do the actual apply. std::string apply_mesg; if ( panelp->apply( apply_mesg ) ) { // Force updating agent data. This should trigger updates // of the group data. gAgent.sendAgentDataUpdateRequest(); // Everything worked. We're done. return true; } // There was a problem doing the actual apply. // Inform the user. if ( !apply_mesg.empty() ) { LLSD args; args["MESSAGE"] = apply_mesg; LLNotifications::instance().add("GenericAlert", args); } return false; }
bool LLPanelGroup::apply() { // Pass this along to the currently visible tab. if (!mTabContainer) return false; LLPanelGroupTab* panelp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); if (!panelp) return false; std::string mesg; if ( !panelp->needsApply(mesg) ) { // We don't need to apply anything. // We're done. return true; } // Ignore the needs apply message. // Try to do the actual apply. std::string apply_mesg; if ( panelp->apply( apply_mesg ) ) { // Everything worked. We're done. return true; } // There was a problem doing the actual apply. // Inform the user. if ( !apply_mesg.empty() ) { LLStringUtil::format_map_t args; args["[MESSAGE]"] = apply_mesg; gViewerWindow->alertXml("GenericAlert", args); } return false; }
BOOL LLPanelGroup::postBuild() { mTabContainer = getChild<LLTabContainer>("group_tab_container"); if (mTabContainer) { // Select the initial tab specified via constructor const BOOL recurse = TRUE; LLPanelGroupTab* tabp = getChild<LLPanelGroupTab>(mInitialTab, recurse); if (!tabp) { //our initial tab selection was invalid, just select the //first tab then or default to selecting the initial //selected tab specified in the layout file tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); //no tab was initially selected through constructor //or the XML, select the first tab if (!tabp) { mTabContainer->selectFirstTab(); tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); } } else { mTabContainer->selectTabPanel(tabp); } mCurrentTab = tabp; // Add click callbacks. S32 i; S32 tab_count = mTabContainer->getTabCount(); for (i = tab_count - 1; i >=0; --i) { LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack // Pass on whether or not to allow edit to tabs. panelp->setAllowEdit(mAllowEdit); panelp->addObserver(this); mTabContainer->setTabChangeCallback(panelp, onClickTab); mTabContainer->setTabUserData(panelp, this); } updateTabVisibility(); // Act as though this tab was just activated. mCurrentTab->activate(); } mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); LLButton* button = getChild<LLButton>("btn_ok"); if (button) { button->setClickedCallback(onBtnOK); button->setCallbackUserData(this); button->setVisible(mAllowEdit); } button = getChild<LLButton>("btn_cancel"); if (button) { button->setClickedCallback(onBtnCancel); button->setCallbackUserData(this); button->setVisible(mAllowEdit); } button = getChild<LLButton>("btn_apply"); if (button) { button->setClickedCallback(onBtnApply); button->setVisible(mAllowEdit); button->setEnabled(FALSE); mApplyBtn = button; } button = getChild<LLButton>("btn_refresh"); if (button) { button->setClickedCallback(onBtnRefresh); button->setCallbackUserData(this); button->setVisible(mAllowEdit); } return TRUE; }
// static void LLPanelGroupTab::onClickHelp(void* user_data) { LLPanelGroupTab* self = static_cast<LLPanelGroupTab*>(user_data); self->handleClickHelp(); }
BOOL LLPanelGroup::postBuild() { mTabContainer = getChild<LLTabContainer>("group_tab_container"); if (mTabContainer) { //our initial tab selection was invalid, just select the //first tab then or default to selecting the initial //selected tab specified in the layout file LLPanelGroupTab* tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); //no tab was initially selected through constructor //or the XML, select the first tab if (!tabp) { mTabContainer->selectFirstTab(); tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel(); } mCurrentTab = tabp; // Add click callbacks. for (int i = mTabContainer->getTabCount() - 1; i >=0; --i) { LLPanel* tab_panel = mTabContainer->getPanelByIndex(i); LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack // Pass on whether or not to allow edit to tabs. panelp->setAllowEdit(mAllowEdit); panelp->addObserver(this); } mTabContainer->setCommitCallback(boost::bind(&LLPanelGroup::handleClickTab,this)); updateTabVisibility(); // Act as though this tab was just activated. mCurrentTab->activate(); } mDefaultNeedsApplyMesg = getString("default_needs_apply_text"); mWantApplyMesg = getString("want_apply_text"); LLButton* button = getChild<LLButton>("btn_ok"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnOK,this)); button->setVisible(mAllowEdit); } button = getChild<LLButton>("btn_cancel"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnCancel,this)); button->setEnabled(mAllowEdit); // Cancel should always be enabled for standalone group floater, this is expected behavior and may be used for simply closing } button = getChild<LLButton>("btn_apply"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnApply,this)); button->setEnabled(FALSE); mApplyBtn = button; } button = getChild<LLButton>("btn_refresh"); if (button) { button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnRefresh,this)); } return TRUE; }