summaryrefslogtreecommitdiff
path: root/indra/llui/llpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llpanel.cpp')
-rw-r--r--indra/llui/llpanel.cpp128
1 files changed, 53 insertions, 75 deletions
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index d580566b13..db314cae0f 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -55,7 +55,7 @@ LLPanel::factory_stack_t LLPanel::sFactoryStack;
// Compiler optimization, generate extern template
template class LLPanel* LLView::getChild<class LLPanel>(
- const std::string& name, BOOL recurse) const;
+ std::string_view name, bool recurse) const;
LLPanel::LocalizedString::LocalizedString()
: name("name"),
@@ -127,9 +127,9 @@ LLPanel::~LLPanel()
}
// virtual
-BOOL LLPanel::isPanel() const
+bool LLPanel::isPanel() const
{
- return TRUE;
+ return true;
}
void LLPanel::addBorder(LLViewBorder::Params p)
@@ -167,13 +167,13 @@ void LLPanel::clearCtrls()
for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
{
LLUICtrl* ctrl = *ctrl_it;
- ctrl->setFocus( FALSE );
- ctrl->setEnabled( FALSE );
+ ctrl->setFocus( false );
+ ctrl->setEnabled( false );
ctrl->clear();
}
}
-void LLPanel::setCtrlsEnabled( BOOL b )
+void LLPanel::setCtrlsEnabled( bool b )
{
LLPanel::ctrl_list_t ctrls = getCtrlList();
for (LLPanel::ctrl_list_t::iterator ctrl_it = ctrls.begin(); ctrl_it != ctrls.end(); ++ctrl_it)
@@ -242,42 +242,20 @@ void LLPanel::draw()
void LLPanel::updateDefaultBtn()
{
- if( mDefaultBtn)
- {
- if (gFocusMgr.childHasKeyboardFocus( this ) && mDefaultBtn->getEnabled())
- {
- LLButton* buttonp = dynamic_cast<LLButton*>(gFocusMgr.getKeyboardFocus());
- BOOL focus_is_child_button = buttonp && buttonp->getCommitOnReturn();
- // only enable default button when current focus is not a return-capturing button
- mDefaultBtn->setBorderEnabled(!focus_is_child_button);
- }
- else
- {
- mDefaultBtn->setBorderEnabled(FALSE);
- }
- }
}
void LLPanel::refresh()
{
// do nothing by default
- // but is automatically called in setFocus(TRUE)
+ // but is automatically called in setFocus(true)
}
void LLPanel::setDefaultBtn(LLButton* btn)
{
- if (mDefaultBtn && mDefaultBtn->getEnabled())
- {
- mDefaultBtn->setBorderEnabled(FALSE);
- }
mDefaultBtn = btn;
- if (mDefaultBtn)
- {
- mDefaultBtn->setBorderEnabled(TRUE);
- }
}
-void LLPanel::setDefaultBtn(const std::string& id)
+void LLPanel::setDefaultBtn(std::string_view id)
{
LLButton *button = getChild<LLButton>(id);
if (button)
@@ -290,17 +268,17 @@ void LLPanel::setDefaultBtn(const std::string& id)
}
}
-BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
+bool LLPanel::handleKeyHere( KEY key, MASK mask )
{
- BOOL handled = FALSE;
+ bool handled = false;
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
// handle user hitting ESC to defocus
if (key == KEY_ESCAPE)
{
- setFocus(FALSE);
- return TRUE;
+ setFocus(false);
+ return true;
}
else if( (mask == MASK_SHIFT) && (KEY_TAB == key))
{
@@ -310,7 +288,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
if (focus_root)
{
- handled = focus_root->focusPrevItem(FALSE);
+ handled = focus_root->focusPrevItem(false);
}
}
}
@@ -322,7 +300,7 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
LLUICtrl* focus_root = cur_focus->findRootMostFocusRoot();
if (focus_root)
{
- handled = focus_root->focusNextItem(FALSE);
+ handled = focus_root->focusNextItem(false);
}
}
}
@@ -335,38 +313,38 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
{
// current focus is a return-capturing button,
// let *that* button handle the return key
- handled = FALSE;
+ handled = false;
}
else if (mDefaultBtn && mDefaultBtn->getVisible() && mDefaultBtn->getEnabled())
{
// If we have a default button, click it when return is pressed
mDefaultBtn->onCommit();
- handled = TRUE;
+ handled = true;
}
else if (cur_focus->acceptsTextInput())
{
// call onCommit for text input handling control
cur_focus->onCommit();
- handled = TRUE;
+ handled = true;
}
}
return handled;
}
-void LLPanel::onVisibilityChange ( BOOL new_visibility )
+void LLPanel::onVisibilityChange ( bool new_visibility )
{
LLUICtrl::onVisibilityChange ( new_visibility );
if (mVisibleSignal)
- (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
+ (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass bool as LLSD
}
-void LLPanel::setFocus(BOOL b)
+void LLPanel::setFocus(bool b)
{
if( b && !hasFocus())
{
// give ourselves focus preemptively, to avoid infinite loop
- LLUICtrl::setFocus(TRUE);
+ LLUICtrl::setFocus(true);
// then try to pass to first valid child
focusFirstItem();
}
@@ -376,7 +354,7 @@ void LLPanel::setFocus(BOOL b)
}
}
-void LLPanel::setBorderVisible(BOOL b)
+void LLPanel::setBorderVisible(bool b)
{
if (mBorder)
{
@@ -490,8 +468,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
setBackgroundVisible(p.background_visible);
setBackgroundOpaque(p.background_opaque);
- setBackgroundColor(p.bg_opaque_color().get());
- setTransparentColor(p.bg_alpha_color().get());
+ setBackgroundColor(p.bg_opaque_color);
+ setTransparentColor(p.bg_alpha_color);
mBgOpaqueImage = p.bg_opaque_image();
mBgAlphaImage = p.bg_alpha_image();
mBgOpaqueImageOverlay = p.bg_opaque_image_overlay;
@@ -504,7 +482,7 @@ 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, const LLPanel::Params& default_params)
+bool LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params)
{
Params params(default_params);
{
@@ -533,7 +511,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
setupParamsForExport(output_params, parent);
output_node->setName(node->getName()->mString);
parser.writeXUI(output_node, output_params, LLInitParam::default_parse_rules(), &default_params);
- return TRUE;
+ return true;
}
LLUICtrlFactory::instance().pushFileName(xml_filename);
@@ -543,7 +521,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
{
LL_WARNS() << "Couldn't parse panel from: " << xml_filename << LL_ENDL;
- return FALSE;
+ return false;
}
parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());
@@ -590,15 +568,15 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu
postBuild();
}
}
- return TRUE;
+ return true;
}
-bool LLPanel::hasString(const std::string& name)
+bool LLPanel::hasString(std::string_view name)
{
return mUIStrings.find(name) != mUIStrings.end();
}
-std::string LLPanel::getString(const std::string& name, const LLStringUtil::format_map_t& args) const
+std::string LLPanel::getString(std::string_view name, const LLStringUtil::format_map_t& args) const
{
ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
if (found_it != mUIStrings.end())
@@ -608,7 +586,7 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
formatted_string.setArgList(args);
return formatted_string.getString();
}
- std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
+ std::string err_str("Failed to find string " + std::string(name) + " in panel " + getName()); //*TODO: Translate
if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
@@ -620,14 +598,14 @@ std::string LLPanel::getString(const std::string& name, const LLStringUtil::form
return LLStringUtil::null;
}
-std::string LLPanel::getString(const std::string& name) const
+std::string LLPanel::getString(std::string_view name) const
{
ui_string_map_t::const_iterator found_it = mUIStrings.find(name);
if (found_it != mUIStrings.end())
{
return found_it->second;
}
- std::string err_str("Failed to find string " + name + " in panel " + getName()); //*TODO: Translate
+ std::string err_str("Failed to find string " + std::string(name) +" in panel " + getName()); //*TODO: Translate
if(LLUI::getInstance()->mSettingGroups["config"]->getBOOL("QAMode"))
{
LL_ERRS() << err_str << LL_ENDL;
@@ -640,7 +618,7 @@ std::string LLPanel::getString(const std::string& name) const
}
-void LLPanel::childSetVisible(const std::string& id, bool visible)
+void LLPanel::childSetVisible(std::string_view id, bool visible)
{
LLView* child = findChild<LLView>(id);
if (child)
@@ -649,7 +627,7 @@ void LLPanel::childSetVisible(const std::string& id, bool visible)
}
}
-void LLPanel::childSetEnabled(const std::string& id, bool enabled)
+void LLPanel::childSetEnabled(std::string_view id, bool enabled)
{
LLView* child = findChild<LLView>(id);
if (child)
@@ -658,7 +636,7 @@ void LLPanel::childSetEnabled(const std::string& id, bool enabled)
}
}
-void LLPanel::childSetFocus(const std::string& id, BOOL focus)
+void LLPanel::childSetFocus(std::string_view id, bool focus)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -667,7 +645,7 @@ void LLPanel::childSetFocus(const std::string& id, BOOL focus)
}
}
-BOOL LLPanel::childHasFocus(const std::string& id)
+bool LLPanel::childHasFocus(std::string_view id)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -676,7 +654,7 @@ BOOL LLPanel::childHasFocus(const std::string& id)
}
else
{
- return FALSE;
+ return false;
}
}
@@ -684,7 +662,7 @@ BOOL LLPanel::childHasFocus(const std::string& id)
// Prefer getChild<LLUICtrl>("foo")->setCommitCallback(boost:bind(...)),
// which takes a generic slot. Or use mCommitCallbackRegistrar.add() with
// a named callback and reference it in XML.
-void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
+void LLPanel::childSetCommitCallback(std::string_view id, boost::function<void (LLUICtrl*,void*)> cb, void* data)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -693,7 +671,7 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
}
}
-void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
+void LLPanel::childSetColor(std::string_view id, const LLUIColor& color)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -702,7 +680,7 @@ void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
}
}
-LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string& id) const
+LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -712,7 +690,7 @@ LLCtrlSelectionInterface* LLPanel::childGetSelectionInterface(const std::string&
return NULL;
}
-LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const
+LLCtrlListInterface* LLPanel::childGetListInterface(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -722,7 +700,7 @@ LLCtrlListInterface* LLPanel::childGetListInterface(const std::string& id) const
return NULL;
}
-LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) const
+LLCtrlScrollInterface* LLPanel::childGetScrollInterface(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -732,7 +710,7 @@ LLCtrlScrollInterface* LLPanel::childGetScrollInterface(const std::string& id) c
return NULL;
}
-void LLPanel::childSetValue(const std::string& id, LLSD value)
+void LLPanel::childSetValue(std::string_view id, LLSD value)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -741,7 +719,7 @@ void LLPanel::childSetValue(const std::string& id, LLSD value)
}
}
-LLSD LLPanel::childGetValue(const std::string& id) const
+LLSD LLPanel::childGetValue(std::string_view id) const
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
@@ -752,27 +730,27 @@ LLSD LLPanel::childGetValue(const std::string& id) const
return LLSD();
}
-BOOL LLPanel::childSetTextArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+bool LLPanel::childSetTextArg(std::string_view id, const std::string& key, const LLStringExplicit& text)
{
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
{
return child->setTextArg(key, text);
}
- return FALSE;
+ return false;
}
-BOOL LLPanel::childSetLabelArg(const std::string& id, const std::string& key, const LLStringExplicit& text)
+bool LLPanel::childSetLabelArg(std::string_view id, const std::string& key, const LLStringExplicit& text)
{
LLView* child = findChild<LLView>(id);
if (child)
{
return child->setLabelArg(key, text);
}
- return FALSE;
+ return false;
}
-void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_type& function)
+void LLPanel::childSetAction(std::string_view id, const commit_signal_t::slot_type& function)
{
LLButton* button = findChild<LLButton>(id);
if (button)
@@ -781,7 +759,7 @@ void LLPanel::childSetAction(const std::string& id, const commit_signal_t::slot_
}
}
-void LLPanel::childSetAction(const std::string& id, boost::function<void(void*)> function, void* value)
+void LLPanel::childSetAction(std::string_view id, boost::function<void(void*)> function, void* value)
{
LLButton* button = findChild<LLButton>(id);
if (button)
@@ -803,10 +781,10 @@ boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::
//-----------------------------------------------------------------------------
// buildPanel()
//-----------------------------------------------------------------------------
-BOOL LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params)
+bool LLPanel::buildFromFile(const std::string& filename, const LLPanel::Params& default_params)
{
LL_PROFILE_ZONE_SCOPED;
- BOOL didPost = FALSE;
+ bool didPost = false;
LLXMLNodePtr root;
if (!LLUICtrlFactory::getLayeredXMLNode(filename, root))