summaryrefslogtreecommitdiff
path: root/indra/llui/llpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llpanel.cpp')
-rwxr-xr-x[-rw-r--r--]indra/llui/llpanel.cpp409
1 files changed, 145 insertions, 264 deletions
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 0cd052eefa..ee90574161 100644..100755
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -2,31 +2,25 @@
* @file llpanel.cpp
* @brief LLPanel base class
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -41,12 +35,11 @@
#include "llfontgl.h"
#include "llrect.h"
#include "llerror.h"
+#include "lldir.h"
#include "lltimer.h"
-#include "llaccordionctrltab.h"
#include "llbutton.h"
#include "llmenugl.h"
-//#include "llstatusbar.h"
#include "llui.h"
#include "llkeyboard.h"
#include "lllineeditor.h"
@@ -55,9 +48,10 @@
#include "lluictrl.h"
#include "lluictrlfactory.h"
#include "llviewborder.h"
-#include "lltabcontainer.h"
static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML);
+LLPanel::factory_stack_t LLPanel::sFactoryStack;
+
// Compiler optimization, generate extern template
template class LLPanel* LLView::getChild<class LLPanel>(
@@ -90,9 +84,9 @@ LLPanel::Params::Params()
filename("filename"),
class_name("class"),
help_topic("help_topic"),
- visible_callback("visible_callback")
+ visible_callback("visible_callback"),
+ accepts_badge("accepts_badge")
{
- name = "panel";
addSynonym(background_visible, "bg_visible");
addSynonym(has_border, "border_visible");
addSynonym(label, "title");
@@ -101,6 +95,7 @@ LLPanel::Params::Params()
LLPanel::LLPanel(const LLPanel::Params& p)
: LLUICtrl(p),
+ LLBadgeHolder(p.accepts_badge),
mBgVisible(p.background_visible),
mBgOpaque(p.background_opaque),
mBgOpaqueColor(p.bg_opaque_color()),
@@ -124,8 +119,6 @@ LLPanel::LLPanel(const LLPanel::Params& p)
{
addBorder(p.border);
}
-
- mPanelHandle.bind(this);
}
LLPanel::~LLPanel()
@@ -170,8 +163,8 @@ void LLPanel::removeBorder()
// virtual
void LLPanel::clearCtrls()
{
- LLView::ctrl_list_t ctrls = getCtrlList();
- for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
+ LLPanel::ctrl_list_t ctrls = getCtrlList();
+ for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
{
LLUICtrl* ctrl = *ctrl_it;
ctrl->setFocus( FALSE );
@@ -182,14 +175,29 @@ void LLPanel::clearCtrls()
void LLPanel::setCtrlsEnabled( BOOL b )
{
- LLView::ctrl_list_t ctrls = getCtrlList();
- for (LLView::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
+ LLPanel::ctrl_list_t ctrls = getCtrlList();
+ for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
{
LLUICtrl* ctrl = *ctrl_it;
ctrl->setEnabled( b );
}
}
+LLPanel::ctrl_list_t LLPanel::getCtrlList() const
+{
+ ctrl_list_t controls;
+ for(child_list_t::const_iterator it = getChildList()->begin(), end_it = getChildList()->end(); it != end_it; ++it)
+ {
+ LLView* viewp = *it;
+ if(viewp->isCtrl())
+ {
+ controls.push_back(static_cast<LLUICtrl*>(viewp));
+ }
+ }
+ return controls;
+}
+
+
void LLPanel::draw()
{
F32 alpha = getDrawContext().mAlpha;
@@ -197,6 +205,8 @@ void LLPanel::draw()
// draw background
if( mBgVisible )
{
+ alpha = getCurrentTransparency();
+
LLRect local_rect = getLocalRect();
if (mBgOpaque )
{
@@ -344,9 +354,9 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
return handled;
}
-void LLPanel::handleVisibilityChange ( BOOL new_visibility )
+void LLPanel::onVisibilityChange ( BOOL new_visibility )
{
- LLUICtrl::handleVisibilityChange ( new_visibility );
+ LLUICtrl::onVisibilityChange ( new_visibility );
if (mVisibleSignal)
(*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
@@ -374,7 +384,7 @@ void LLPanel::setBorderVisible(BOOL b)
}
}
-LLFastTimer::DeclareTimer FTM_PANEL_CONSTRUCTION("Panel Construction");
+LLTrace::BlockTimerStatHandle FTM_PANEL_CONSTRUCTION("Panel Construction");
LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_node)
{
@@ -386,21 +396,20 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
LLPanel* panelp = NULL;
- {
- LLFastTimer timer(FTM_PANEL_CONSTRUCTION);
+ { LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION);
if(!class_attr.empty())
{
panelp = LLRegisterPanelClass::instance().createPanelClass(class_attr);
if (!panelp)
{
- llwarns << "Panel class \"" << class_attr << "\" not registered." << llendl;
+ LL_WARNS() << "Panel class \"" << class_attr << "\" not registered." << LL_ENDL;
}
}
if (!panelp)
{
- panelp = LLUICtrlFactory::getInstance()->createFactoryPanel(name);
+ panelp = createFactoryPanel(name);
llassert(panelp);
if (!panelp)
@@ -413,20 +422,20 @@ LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLXMLNodePtr output_
// factory panels may have registered their own factory maps
if (!panelp->getFactoryMap().empty())
{
- LLUICtrlFactory::instance().pushFactoryFunctions(&panelp->getFactoryMap());
+ sFactoryStack.push_back(&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->initPanelXML(node, parent, output_node, LLUICtrlFactory::getDefaultParams<LLPanel>());
panelp->mCommitCallbackRegistrar.popScope();
panelp->mEnableCallbackRegistrar.popScope();
if (!panelp->getFactoryMap().empty())
{
- LLUICtrlFactory::instance().popFactoryFunctions();
+ sFactoryStack.pop_back();
}
return panelp;
@@ -438,7 +447,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
//and LLView::initFromParams will use them to set visible and enabled
setVisible(p.visible);
setEnabled(p.enabled);
-
+ setFocusRoot(p.focus_root);
setSoundFlags(p.sound_flags);
// control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible
@@ -450,8 +459,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
setVisibleCallback(initCommitCallback(p.visible_callback));
}
- for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin();
- it != p.strings().end();
+ for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings.begin();
+ it != p.strings.end();
++it)
{
mUIStrings[it->name] = it->value;
@@ -487,19 +496,19 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
mBgAlphaImage = p.bg_alpha_image();
mBgOpaqueImageOverlay = p.bg_opaque_image_overlay;
mBgAlphaImageOverlay = p.bg_alpha_image_overlay;
+
+ setAcceptsBadge(p.accepts_badge);
}
-static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup");
-static LLFastTimer::DeclareTimer FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference");
-static LLFastTimer::DeclareTimer FTM_PANEL_POSTBUILD("Panel PostBuild");
+static LLTrace::BlockTimerStatHandle FTM_PANEL_SETUP("Panel Setup");
+static LLTrace::BlockTimerStatHandle FTM_EXTERNAL_PANEL_LOAD("Load Extern Panel Reference");
+static LLTrace::BlockTimerStatHandle FTM_PANEL_POSTBUILD("Panel PostBuild");
-BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node)
+BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params)
{
- const LLPanel::Params& default_params(LLUICtrlFactory::getDefaultParams<LLPanel>());
Params params(default_params);
-
{
- LLFastTimer timer(FTM_PANEL_SETUP);
+ LL_RECORD_BLOCK_TIME(FTM_PANEL_SETUP);
LLXMLNodePtr referenced_xml;
std::string xml_filename = mXMLFilename;
@@ -508,56 +517,59 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
if (xml_filename.empty())
{
node->getAttributeString("filename", xml_filename);
+ setXMLFilename(xml_filename);
}
+ LLXUIParser parser;
+
if (!xml_filename.empty())
{
- LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD);
if (output_node)
{
//if we are exporting, we want to export the current xml
//not the referenced xml
- LLXUIParser::instance().readXUI(node, params, xml_filename);
+ parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
return TRUE;
}
+ LLUICtrlFactory::instance().pushFileName(xml_filename);
+
+ LL_RECORD_BLOCK_TIME(FTM_EXTERNAL_PANEL_LOAD);
if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml))
{
- llwarns << "Couldn't parse panel from: " << xml_filename << llendl;
+ LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL;
return FALSE;
}
- LLXUIParser::instance().readXUI(referenced_xml, params, xml_filename);
+ parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());
// add children using dimensions from referenced xml for consistent layout
setShape(params.rect);
LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance());
- setXMLFilename(xml_filename);
+ LLUICtrlFactory::instance().popFileName();
}
// ask LLUICtrlFactory for filename, since xml_filename might be empty
- LLXUIParser::instance().readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
+ parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
if (output_node)
{
Params output_params(params);
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
- LLXUIParser::instance().writeXUI(
- output_node, output_params, &default_params);
+ parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
}
params.from_xui = true;
applyXUILayout(params, parent);
{
- LLFastTimer timer(FTM_PANEL_CONSTRUCTION);
+ LL_RECORD_BLOCK_TIME(FTM_PANEL_CONSTRUCTION);
initFromParams(params);
}
@@ -574,7 +586,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
}
{
- LLFastTimer timer(FTM_PANEL_POSTBUILD);
+ LL_RECORD_BLOCK_TIME(FTM_PANEL_POSTBUILD);
postBuild();
}
}
@@ -599,11 +611,11 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
{
- llerrs << err_str << llendl;
+ LL_ERRS() << err_str << LL_ENDL;
}
else
{
- llwarns << err_str << llendl;
+ LL_WARNS() << err_str << LL_ENDL;
}
return LLStringUtil::null;
}
@@ -618,11 +630,11 @@ std::string LLPanel::getString(const std::string& name) const
std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
if(LLUI::sSettingGroups["config"]->getBOOL("QAMode"))
{
- llerrs << err_str << llendl;
+ LL_ERRS() << err_str << LL_ENDL;
}
else
{
- llwarns << err_str << llendl;
+ LL_WARNS() << err_str << LL_ENDL;
}
return LLStringUtil::null;
}
@@ -637,16 +649,6 @@ void LLPanel::childSetVisible(const std::string& id, bool visible)
}
}
-bool LLPanel::childIsVisible(const std::string& id) const
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- return (bool)child->getVisible();
- }
- return false;
-}
-
void LLPanel::childSetEnabled(const std::string& id, bool enabled)
{
LLView* child = findChild<LLView>(id);
@@ -656,55 +658,6 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled)
}
}
-void LLPanel::childSetTentative(const std::string& id, bool tentative)
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- child->setTentative(tentative);
- }
-}
-
-bool LLPanel::childIsEnabled(const std::string& id) const
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- return (bool)child->getEnabled();
- }
- return false;
-}
-
-
-void LLPanel::childSetToolTip(const std::string& id, const std::string& msg)
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- child->setToolTip(msg);
- }
-}
-
-void LLPanel::childSetRect(const std::string& id, const LLRect& rect)
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- child->setRect(rect);
- }
-}
-
-bool LLPanel::childGetRect(const std::string& id, LLRect& rect) const
-{
- LLView* child = findChild<LLView>(id);
- if (child)
- {
- rect = child->getRect();
- return true;
- }
- return false;
-}
-
void LLPanel::childSetFocus(const std::string& id, BOOL focus)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
@@ -740,15 +693,6 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
}
}
-void LLPanel::childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb)
-{
- LLUICtrl* child = findChild<LLUICtrl>(id);
- if (child)
- {
- child->setValidateBeforeCommit(cb);
- }
-}
-
void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
@@ -828,169 +772,106 @@ BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, co
return FALSE;
}
-BOOL LLPanel::childSetToolTipArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
{
- LLView* child = findChild<LLView>(id);
- if (child)
+ LLButton* button = findChild<LLButton>(id);
+ if (button)
{
- return child->setToolTipArg(key, text);
+ button->setClickedCallback(function);
}
- return FALSE;
}
-void LLPanel::childShowTab(const std::string& id, const std::string& tabname, bool visible)
+void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
{
- LLTabContainer* child = findChild<LLTabContainer>(id);
- if (child)
+ LLButton* button = findChild<LLButton>(id);
+ if (button)
{
- child->selectTabByName(tabname);
+ button->setClickedCallback(boost::bind(function, value));
}
}
-LLPanel *LLPanel::childGetVisibleTab(const std::string& id) const
+boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb )
{
- LLTabContainer* child = findChild<LLTabContainer>(id);
- if (child)
+ if (!mVisibleSignal)
{
- return child->getCurrentPanel();
+ mVisibleSignal = new commit_signal_t();
}
- return NULL;
+
+ return mVisibleSignal->connect(cb);
}
-static LLPanel *childGetVisibleTabWithHelp(LLView *parent)
+static LLTrace::BlockTimerStatHandle FTM_BUILD_PANELS("Build Panels");
+
+//-----------------------------------------------------------------------------
+// buildPanel()
+//-----------------------------------------------------------------------------
+BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params)
{
- LLView *child;
+ LL_RECORD_BLOCK_TIME(FTM_BUILD_PANELS);
+ BOOL didPost = FALSE;
+ LLXMLNodePtr root;
- // look through immediate children first for an active tab with help
- for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))
{
- 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;
- }
+ LL_WARNS() << "Couldn't parse panel from: " << filename << LL_ENDL;
+ return didPost;
}
- // then try a bit harder and recurse through all children
- for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+ // root must be called panel
+ if( !root->hasName("panel" ) )
{
- if (child->getVisible())
- {
- LLPanel* tab = ::childGetVisibleTabWithHelp(child);
- if (tab)
- {
- return tab;
- }
- }
+ LL_WARNS() << "Root node should be named panel in : " << filename << LL_ENDL;
+ return didPost;
}
- // couldn't find any active tabs with a help topic string
- return NULL;
-}
-
-LLPanel *LLPanel::childGetVisibleTabWithHelp()
-{
- // find a visible tab with a help topic (to determine help context)
- return ::childGetVisibleTabWithHelp(this);
-}
+ LL_DEBUGS() << "Building panel " << filename << LL_ENDL;
-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))
+ LLUICtrlFactory::instance().pushFileName(filename);
{
- // do we have a panel with a help topic?
- LLPanel *panel = dynamic_cast<LLPanel *>(child);
- if (panel && panel->getVisible() && !panel->getHelpTopic().empty())
+ if (!getFactoryMap().empty())
{
- return panel;
+ sFactoryStack.push_back(&getFactoryMap());
}
- }
+
+ // for local registry callbacks; define in constructor, referenced in XUI or postBuild
+ getCommitCallbackRegistrar().pushScope();
+ getEnableCallbackRegistrar().pushScope();
+
+ didPost = initPanelXML(root, NULL, NULL, default_params);
- // then try a bit harder and recurse through all children
- for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
- {
- if (child->getVisible())
+ getCommitCallbackRegistrar().popScope();
+ getEnableCallbackRegistrar().popScope();
+
+ setXMLFilename(filename);
+
+ if (!getFactoryMap().empty())
{
- LLPanel* panel = ::childGetVisiblePanelWithHelp(child);
- if (panel)
- {
- return panel;
- }
+ sFactoryStack.pop_back();
}
}
-
- // couldn't find any active panels with a help topic string
- return NULL;
-}
-
-LLPanel *LLPanel::childGetVisiblePanelWithHelp()
-{
- // find a visible tab with a help topic (to determine help context)
- return ::childGetVisiblePanelWithHelp(this);
-}
-
-void LLPanel::childSetPrevalidate(const std::string& id, bool (*func)(const LLWString &) )
-{
- LLLineEditor* child = findChild<LLLineEditor>(id);
- if (child)
- {
- child->setPrevalidate(func);
- }
-}
-
-
-void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
-{
- LLButton* button = findChild<LLButton>(id);
- if (button)
- {
- button->setClickedCallback(boost::bind(function, value));
- }
-}
-
-void LLPanel::childSetActionTextbox(const std::string& id, boost::function<void(void*)> function, void* value)
-{
- LLTextBox* textbox = findChild<LLTextBox>(id);
- if (textbox)
- {
- textbox->setClickedCallback(boost::bind(function, value));
- }
+ LLUICtrlFactory::instance().popFileName();
+ return didPost;
}
-void LLPanel::childSetControlName(const std::string& id, const std::string& control_name)
+//-----------------------------------------------------------------------------
+// createFactoryPanel()
+//-----------------------------------------------------------------------------
+LLPanel* LLPanel::createFactoryPanel(const std::string& name)
{
- LLUICtrl* view = findChild<LLUICtrl>(id);
- if (view)
+ std::deque<const LLCallbackMap::map_t*>::iterator itor;
+ for (itor = sFactoryStack.begin(); itor != sFactoryStack.end(); ++itor)
{
- view->setControlName(control_name, NULL);
- }
-}
+ const LLCallbackMap::map_t* factory_map = *itor;
-boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb )
-{
- if (!mVisibleSignal)
- {
- mVisibleSignal = new commit_signal_t();
+ // Look up this panel's name in the map.
+ LLCallbackMap::map_const_iter_t iter = factory_map->find( name );
+ if (iter != factory_map->end())
+ {
+ // Use the factory to create the panel, instead of using a default LLPanel.
+ LLPanel *ret = (LLPanel*) iter->second.mCallback( iter->second.mData );
+ return ret;
+ }
}
-
- return mVisibleSignal->connect(cb);
+ LLPanel::Params panel_p;
+ return LLUICtrlFactory::create<LLPanel>(panel_p);
}