BOOL LLFloaterLuaConsole::postBuild() { childSetAction("Send", onClickSend, this); childSetAction("Clear", onClickClear, this); childSetAction("Abort", onClickAbort, this); childSetAction("Reset", onClickReset, this); //childDisable("Send"); LLButton * sendp = getChild<LLButton>("Send"); LLPanel * luap = getChild<LLPanel>("lua_panel"); if(sendp && luap) { luap->setDefaultBtn(sendp); } LLLineEditor * editorp = getChild<LLLineEditor>("Lua Editor", TRUE); if(editorp) { editorp->setCommitOnFocusLost(FALSE); editorp->setRevertOnEsc(FALSE); editorp->setEnableLineHistory(TRUE); editorp->setFocusReceivedCallback( &onInputEditorGainFocus, this ); } getChild<LLViewerTextEditor>("Lua Output Editor",TRUE); return TRUE; }
void LLFloaterAvatarPicker::draw() { LLFloater::draw(); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e // TODO-RLVa: this code needs revisiting if (rlv_handler_t::isEnabled()) { LLPanel* pNearMePanel = getChild<LLPanel>("NearMePanel"); if ( (pNearMePanel) && (childGetVisibleTab("ResidentChooserTabs") == pNearMePanel) ) { if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { if (mNearMeListComplete) { getChild<LLScrollListCtrl>("NearMe")->deleteAllItems(); childSetEnabled("Select", false); } mNearMeListComplete = FALSE; pNearMePanel->setCtrlsEnabled(FALSE); return; } pNearMePanel->setCtrlsEnabled(TRUE); } } // [/RLVa:KB] if (!mNearMeListComplete && childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("NearMePanel")) { populateNearMe(); } }
//static LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater() { if (!LLVoiceClient::getInstance()->voiceEnabled()) { return NULL; } if (LLVoiceChannelProximal::getInstance() == LLVoiceChannel::getCurrentVoiceChannel()) { // show near me tab if in proximal channel return LLFloaterChat::getInstance(LLSD()); } else { LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance(LLSD()); // iterator over all IM tabs (skip friends and near me) for (S32 i = 0; i < floater->getFloaterCount(); i++) { LLPanel* panelp = floater->mTabContainer->getPanelByIndex(i); if (panelp->getName() == "im_floater") { // only LLFloaterIMPanels are called "im_floater" LLFloaterIMPanel* im_floaterp = (LLFloaterIMPanel*)panelp; if (im_floaterp->getVoiceChannel() == LLVoiceChannel::getCurrentVoiceChannel()) { return im_floaterp; } } } } return NULL; }
//virtual LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse, BOOL create_if_missing) const { tuple_list_t::const_iterator itor; for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) { LLPanel *panel = (*itor)->mTabPanel; if (panel->getName() == name) { return panel; } } if (recurse) { for (itor = mTabList.begin(); itor != mTabList.end(); ++itor) { LLPanel *panel = (*itor)->mTabPanel; LLView *child = panel->getChildView(name, recurse, FALSE); if (child) { return child; } } } return LLView::getChildView(name, recurse, create_if_missing); }
LLPanel* LLFloaterSidePanelContainer::openChildPanel(const std::string& panel_name, const LLSD& params) { LLView* view = findChildView(panel_name, true); if (!view) return NULL; if (!getVisible()) { openFloater(); } LLPanel* panel = NULL; LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); if (container) { LLSD new_params = params; new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; container->onOpen(new_params); panel = container->getCurrentPanel(); } else if ((panel = dynamic_cast<LLPanel*>(view)) != NULL) { panel->onOpen(params); } return panel; }
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory) { std::string name("panel"); node->getAttributeString("name", name); LLPanel* panelp = factory->createFactoryPanel(name); // Fall back on a default panel, if there was no special factory. if (!panelp) { LLRect rect; createRect(node, rect, parent, LLRect()); // create a new panel without a border, by default panelp = new LLPanel(name, rect, FALSE); panelp->initPanelXML(node, parent, factory); // preserve panel's width and height, but override the location const LLRect& panelrect = panelp->getRect(); S32 w = panelrect.getWidth(); S32 h = panelrect.getHeight(); rect.setLeftTopAndSize(rect.mLeft, rect.mTop, w, h); panelp->setRect(rect); } else { panelp->initPanelXML(node, parent, factory); } return panelp; }
/** * Activate tab with "panel_name" panel * if no such tab - return false, otherwise true. * TODO* In some cases a pointer to a panel of * a specific class may be needed so this method * would need to use templates. */ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params) { //arrange tabs child_vector_const_iter_t child_it; for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) { LLView* view = (*child_it)->findChildView(panel_name,true); if(view) { selectTabByName ((*child_it)->getName()); if(mCollapsed) expandSideBar(); LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); if(container) { LLSD new_params = params; new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; container->onOpen(new_params); return container->getCurrentPanel(); } LLPanel* panel = dynamic_cast<LLPanel*>(view); if(panel) { panel->onOpen(params); } return panel; } } return NULL; }
void LLFloaterGodTools::showPanel(const LLString& panel_name) { childShowTab("GodTools Tabs", panel_name); open(); /*Flawfinder: ignore*/ LLPanel *panel = childGetVisibleTab("GodTools Tabs"); if (panel) panel->setFocus(TRUE); }
static LLPanel *childGetVisiblePanelWithHelp(LLView *parent) { LLView *child; // look through immediate children first for an active panel with help for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { // do we have a panel with a help topic? LLPanel *panel = dynamic_cast<LLPanel *>(child); if (panel && panel->getVisible() && !panel->getHelpTopic().empty()) { return panel; } } // then try a bit harder and recurse through all children for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { if (child->getVisible()) { LLPanel* panel = ::childGetVisiblePanelWithHelp(child); if (panel) { return panel; } } } // couldn't find any active panels with a help topic string return NULL; }
bool LLFlatListView::selectAll() { if (!mAllowSelection) return false; mSelectedItemPairs.clear(); for (pairs_const_iterator_t it= mItemPairs.begin(); it != mItemPairs.end(); ++it) { item_pair_t* item_pair = *it; mSelectedItemPairs.push_back(item_pair); //a way of notifying panel of selection state changes LLPanel* item = item_pair->first; item->setValue(SELECTED_EVENT); } if (mCommitOnSelectionChange) { onCommit(); } // Stretch selected item rect to ensure it won't be clipped mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); return true; }
bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select) { llassert(item_pair); if (!mAllowSelection && select) return false; if (isSelected(item_pair) == select) return true; //already in specified selection state if (select) { mSelectedItemPairs.push_back(item_pair); } else { mSelectedItemPairs.remove(item_pair); } //a way of notifying panel of selection state changes LLPanel* item = item_pair->first; item->setValue(select ? SELECTED_EVENT : UNSELECTED_EVENT); if (mCommitOnSelectionChange) { onCommit(); } // Stretch selected item rect to ensure it won't be clipped mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); return true; }
void LLPanelMarketplaceListings::onTabChange() { // Find active panel LLInventoryPanel* panel = (LLInventoryPanel*)getChild<LLTabContainer>("marketplace_filter_tabs")->getCurrentPanel(); if (panel) { // If the panel doesn't allow drop on root, it doesn't allow the creation of new folder on root either LLButton* add_btn = getChild<LLButton>("add_btn"); add_btn->setEnabled(panel->getAllowDropOnRoot()); // Set filter string on active panel panel->setFilterSubString(mFilterSubString); // Show/hide the drop zone and resize the inventory tabs panel accordingly LLPanel* drop_zone = (LLPanel*)getChild<LLPanel>("marketplace_drop_zone"); bool drop_zone_visible = drop_zone->getVisible(); bool allow_drop_on_root = panel->getAllowDropOnRoot() && gSavedSettings.getBOOL("LiruEnableWIPUI"); if (drop_zone_visible != allow_drop_on_root) { LLPanel* tabs = (LLPanel*)getChild<LLPanel>("tab_container_panel"); S32 delta_height = drop_zone->getRect().getHeight(); delta_height = (drop_zone_visible ? delta_height : -delta_height); tabs->reshape(tabs->getRect().getWidth(),tabs->getRect().getHeight() + delta_height); tabs->translate(0,-delta_height); } drop_zone->setVisible(allow_drop_on_root); } }
// static void LLFloaterGodTools::onTabChanged(void* data, bool from_click) { LLPanel* panel = (LLPanel*)data; if (panel) { panel->setFocus(TRUE); } }
void LLFloaterGodTools::showPanel(const std::string& panel_name) { getChild<LLTabContainer>("GodTools Tabs")->selectTabByName(panel_name); openFloater(); LLPanel *panel = getChild<LLTabContainer>("GodTools Tabs")->getCurrentPanel(); if (panel) panel->setFocus(TRUE); }
void LLFloaterGodTools::showPanel(const std::string& panel_name) { childShowTab("GodTools Tabs", panel_name); openFloater(); LLPanel *panel = childGetVisibleTab("GodTools Tabs"); if (panel) panel->setFocus(TRUE); }
void LLFloaterDirectory::focusCurrentPanel() { LLTabContainerCommon* tabs = LLUICtrlFactory::getTabContainerByName(this, "Directory Tabs"); if (!tabs) return; LLPanel* panel = tabs->getCurrentPanel(); if (!panel) return; panel->setFocus(TRUE); }
void LLFloaterDirectory::focusCurrentPanel() { LLTabContainer* tabs = getChild<LLTabContainer>("Directory Tabs"); if (!tabs) return; LLPanel* panel = tabs->getCurrentPanel(); if (!panel) return; panel->setFocus(TRUE); }
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_node) { std::string name("panel"); node->getAttributeString("name", name); std::string class_attr; node->getAttributeString("class", class_attr); LLPanel* panelp = NULL; { LLFastTimer timer(FTM_PANEL_CONSTRUCTION); if(!class_attr.empty()) { panelp = LLRegisterPanelClass::instance().createPanelClass(class_attr); if (!panelp) { llwarns << "Panel class \"" << class_attr << "\" not registered." << llendl; } } if (!panelp) { panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name); llassert(panelp); if (!panelp) { return NULL; // :( } } } // factory panels may have registered their own factory maps if (!panelp->getFactoryMap().empty()) { LLUICtrlFactory::instance().pushFactoryFunctions(&panelp->getFactoryMap()); } // for local registry callbacks; define in constructor, referenced in XUI or postBuild panelp->mCommitCallbackRegistrar.pushScope(); panelp->mEnableCallbackRegistrar.pushScope(); panelp->initPanelXML(node, parent, output_node); panelp->mCommitCallbackRegistrar.popScope(); panelp->mEnableCallbackRegistrar.popScope(); if (!panelp->getFactoryMap().empty()) { LLUICtrlFactory::instance().popFactoryFunctions(); } return panelp; }
// static void LLFloaterDirectory::onTabChanged(void* data, bool from_click) { LLFloaterDirectory* self = (LLFloaterDirectory*)data; if (!self) return; LLPanel *panel = self->childGetVisibleTab("Directory Tabs"); if (panel) { gSavedSettings.setString("LastFindPanel", panel->getName()); } }
LLPanel *LLTabContainer::getPanelByName(const std::string& name) { for (S32 index = 0 ; index < (S32)mTabList.size(); index++) { LLPanel *panel = mTabList[index]->mTabPanel; if (name == panel->getName()) { return panel; } } return NULL; }
void LLAccordionCtrl::onOpen (const LLSD& key) { for(size_t i=0;i<mAccordionTabs.size();++i) { LLAccordionCtrlTab* accordion_tab = dynamic_cast<LLAccordionCtrlTab*>(mAccordionTabs[i]); LLPanel* panel = dynamic_cast<LLPanel*>(accordion_tab->getAccordionView()); if(panel!=NULL) { panel->onOpen(key); } } }
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory) { std::string name("panel"); node->getAttributeString("name", name); LLPanel* panelp = factory->createFactoryPanel(name); LLFastTimer _(FTM_PANEL_CONSTRUCTION); // Fall back on a default panel, if there was no special factory. if (!panelp) { LLRect rect; createRect(node, rect, parent, LLRect()); // create a new panel without a border, by default panelp = new LLPanel(name, rect, FALSE); // for local registry callbacks; define in constructor, referenced in XUI or postBuild panelp->mCommitCallbackRegistrar.pushScope(); panelp->mEnableCallbackRegistrar.pushScope(); panelp->initPanelXML(node, parent, factory); panelp->mCommitCallbackRegistrar.popScope(); panelp->mEnableCallbackRegistrar.popScope(); // preserve panel's width and height, but override the location const LLRect& panelrect = panelp->getRect(); S32 w = panelrect.getWidth(); S32 h = panelrect.getHeight(); rect.setLeftTopAndSize(rect.mLeft, rect.mTop, w, h); panelp->setRect(rect); } else { if(!factory->builtPanel(panelp)) { // for local registry callbacks; define in constructor, referenced in XUI or postBuild panelp->mCommitCallbackRegistrar.pushScope(); panelp->mEnableCallbackRegistrar.pushScope(); panelp->initPanelXML(node, parent, factory); panelp->mCommitCallbackRegistrar.popScope(); panelp->mEnableCallbackRegistrar.popScope(); } else { LLRect new_rect = panelp->getRect(); // override rectangle with embedding parameters as provided panelp->createRect(node, new_rect, parent); panelp->setOrigin(new_rect.mLeft, new_rect.mBottom); panelp->setShape(new_rect); // optionally override follows flags from including nodes panelp->parseFollowsFlags(node); } } return panelp; }
// static void LLFloaterGodTools::show(void *) { LLFloaterGodTools* god_tools = instance(); god_tools->open(); LLPanel *panel = god_tools->childGetVisibleTab("GodTools Tabs"); if (panel) panel->setFocus(TRUE); if (god_tools->mPanelObjectTools) god_tools->mPanelObjectTools->setTargetAvatar(LLUUID::null); if (gAgent.getRegionHost() != god_tools->mCurrentHost) { // we're in a new region god_tools->sendRegionInfoRequest(); } }
void LLToast::reshapeToPanel() { LLPanel* panel = getPanel(); if(!panel) return; LLRect panel_rect = panel->getLocalRect(); panel->setShape(panel_rect); LLRect toast_rect = getRect(); toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth() + getRightPad(), panel_rect.getHeight() + getTopPad()); setShape(toast_rect); }
LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel_name, const LLSD& params) { LLView* view = tab->findChildView(panel_name, true); if (!view) return NULL; std::string tab_name = tab->getName(); bool tab_attached = isTabAttached(tab_name); if (tab_attached && LLUI::sSettingGroups["config"]->getBOOL("OpenSidePanelsInFloaters")) { tab->toggleTabDocked(); tab_attached = false; } // Select tab and expand Side Tray only when a tab is attached. if (tab_attached) { selectTabByName(tab_name); if (mCollapsed) expandSideBar(); } else { LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); if (!floater_tab) return NULL; floater_tab->openFloater(tab_name); } LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); if (container) { LLSD new_params = params; new_params[LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME] = panel_name; container->onOpen(new_params); return container->getCurrentPanel(); } LLPanel* panel = dynamic_cast<LLPanel*>(view); if (panel) { panel->onOpen(params); } return panel; }
void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view) { LLPanel* parent = dynamic_cast<LLPanel*>(getParent()); if (!parent) { llwarns << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << llendl; return; } if (move_view != NULL) { llassert(move_view != parent); // sanity check // Save our original container. if (!mOriginalParent.get()) mOriginalParent = parent->getHandle(); // Attach to movement controls. parent->removeChild(this); move_view->addChild(this); // Origin must be set by movement controls. mAttached = true; } else { if (!mOriginalParent.get()) { llwarns << "Original parent of the stand / stop flying panel not found" << llendl; return; } // Detach from movement controls. parent->removeChild(this); mOriginalParent.get()->addChild(this); // update parent with self visibility (it is changed in setVisible()). EXT-4743 mOriginalParent.get()->setVisible(getVisible()); mAttached = false; updatePosition(); // don't defer until next draw() to avoid flicker } // <FS:Zi> Make sure to resize the panel to fit the new parent. Important for // proper layouting of the buttons. Skins should adapt the parent container. if(getParent()) reshape(getParent()->getRect().getWidth(),getParent()->getRect().getHeight(),FALSE); // </FS:Zi> }
static LLPanel *childGetVisibleTabWithHelp(LLView *parent) { LLView *child; // look through immediate children first for an active tab with help for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { LLPanel *curTabPanel = NULL; // do we have a tab container? LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child); if (tab && tab->getVisible()) { curTabPanel = tab->getCurrentPanel(); } // do we have an accordion tab? LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child); if (accordion && accordion->getDisplayChildren()) { curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView()); } // if we found a valid tab, does it have a help topic? if (curTabPanel && !curTabPanel->getHelpTopic().empty()) { return curTabPanel; } } // then try a bit harder and recurse through all children for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child)) { if (child->getVisible()) { LLPanel* tab = ::childGetVisibleTabWithHelp(child); if (tab) { return tab; } } } // couldn't find any active tabs with a help topic string return NULL; }
void LLFloaterAvatarPicker::draw() { // sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars). // lets check this via mOkButtonValidateSignal callback periodically. static LLFrameTimer timer; if (timer.hasExpired()) { timer.setTimerExpirySec(0.33f); // three times per second should be enough. // simulate list changes. onList(); timer.start(); } LLFloater::draw(); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e // TODO-RLVa: this code needs revisiting if (rlv_handler_t::isEnabled()) { LLPanel* pNearMePanel = getChild<LLPanel>("NearMePanel"); if ( (pNearMePanel) && (childGetVisibleTab("ResidentChooserTabs") == pNearMePanel) ) { if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { if (mNearMeListComplete) { getChild<LLScrollListCtrl>("NearMe")->deleteAllItems(); childSetEnabled("Select", false); } mNearMeListComplete = FALSE; pNearMePanel->setCtrlsEnabled(FALSE); return; } pNearMePanel->setCtrlsEnabled(TRUE); } } // [/RLVa:KB] if (!mNearMeListComplete && getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel() == getChild<LLPanel>("NearMePanel")) { populateNearMe(); } }
//----------------------------------------------------------------------------- // rebuild() //----------------------------------------------------------------------------- void LLUICtrlFactory::rebuild() { built_panel_t built_panels = mBuiltPanels; mBuiltPanels.clear(); built_panel_t::iterator built_panel_it; for (built_panel_it = built_panels.begin(); built_panel_it != built_panels.end(); ++built_panel_it) { std::string filename = built_panel_it->second; LLPanel* panelp = built_panel_it->first.get(); if (!panelp) { continue; } llinfos << "Rebuilding UI panel " << panelp->getName() << " from " << filename << llendl; BOOL visible = panelp->getVisible(); panelp->setVisible(FALSE); panelp->setFocus(FALSE); panelp->deleteAllChildren(); buildPanel(panelp, filename.c_str(), &panelp->getFactoryMap()); panelp->setVisible(visible); } built_floater_t::iterator built_floater_it; for (built_floater_it = mBuiltFloaters.begin(); built_floater_it != mBuiltFloaters.end(); ++built_floater_it) { LLFloater* floaterp = built_floater_it->first.get(); if (!floaterp) { continue; } std::string filename = built_floater_it->second; llinfos << "Rebuilding UI floater " << floaterp->getName() << " from " << filename << llendl; BOOL visible = floaterp->getVisible(); floaterp->setVisible(FALSE); floaterp->setFocus(FALSE); floaterp->deleteAllChildren(); gFloaterView->removeChild(floaterp); buildFloater(floaterp, filename, &floaterp->getFactoryMap()); floaterp->setVisible(visible); } }
void LLPanelStandStopFlying::reparent(LLFloaterMove* move_view) { LLPanel* parent = dynamic_cast<LLPanel*>(getParent()); if (!parent) { llwarns << "Stand/stop flying panel parent is unset, already attached?: " << mAttached << ", new parent: " << (move_view == NULL ? "NULL" : "Move Floater") << llendl; return; } if (move_view != NULL) { llassert(move_view != parent); // sanity check // Save our original container. if (!mOriginalParent.get()) mOriginalParent = parent->getHandle(); // Attach to movement controls. parent->removeChild(this); move_view->addChild(this); // Origin must be set by movement controls. mAttached = true; } else { if (!mOriginalParent.get()) { llwarns << "Original parent of the stand / stop flying panel not found" << llendl; return; } // Detach from movement controls. parent->removeChild(this); mOriginalParent.get()->addChild(this); // update parent with self visibility (it is changed in setVisible()). EXT-4743 mOriginalParent.get()->setVisible(getVisible()); mAttached = false; updatePosition(); // don't defer until next draw() to avoid flicker } }