summaryrefslogtreecommitdiff
path: root/indra/llui/llmenugl.cpp
diff options
context:
space:
mode:
authorMark Palange <palange@lindenlab.com>2008-03-14 23:21:38 +0000
committerMark Palange <palange@lindenlab.com>2008-03-14 23:21:38 +0000
commit04611efae8a3291ceba8a29dd920bdae0d404830 (patch)
tree43966566a1eeb42cf546a638310348f0585fc395 /indra/llui/llmenugl.cpp
parentc0c5bdbbb90e0bcdab558ec22ea352c9d08dc078 (diff)
[NOTE: This was an erroneous commit, and was reverted in the next revision]
QAR-369 - viewer-cleanup2-7 81916 merged into release.
Diffstat (limited to 'indra/llui/llmenugl.cpp')
-rw-r--r--indra/llui/llmenugl.cpp101
1 files changed, 34 insertions, 67 deletions
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 00b4c37bb0..8c62a10f2b 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -827,57 +827,33 @@ void LLMenuItemCallGL::setEnabledControl(LLString enabled_control, LLView *conte
// Register new listener
if (!enabled_control.empty())
{
- LLControlBase *control = context->findControl(enabled_control);
- if (control)
- {
- LLSD state = control->registerListener(this, "ENABLED");
- setEnabled(state);
- }
- else
+ LLControlVariable *control = context->findControl(enabled_control);
+ if (!control)
{
context->addBoolControl(enabled_control, getEnabled());
control = context->findControl(enabled_control);
- control->registerListener(this, "ENABLED");
+ llassert_always(control);
}
+ control->getSignal()->connect(boost::bind(&LLView::controlListener, _1, getHandle(), std::string("enabled")));
+ setEnabled(control->getValue());
}
}
-void LLMenuItemCallGL::setVisibleControl(LLString enabled_control, LLView *context)
+void LLMenuItemCallGL::setVisibleControl(LLString visible_control, LLView *context)
{
// Register new listener
- if (!enabled_control.empty())
+ if (!visible_control.empty())
{
- LLControlBase *control = context->findControl(enabled_control);
- if (control)
+ LLControlVariable *control = context->findControl(visible_control);
+ if (!control)
{
- LLSD state = control->registerListener(this, "VISIBLE");
- setVisible(state);
+ context->addBoolControl(visible_control, getVisible());
+ control = context->findControl(visible_control);
+ llassert_always(control);
}
- else
- {
- context->addBoolControl(enabled_control, getEnabled());
- control = context->findControl(enabled_control);
- control->registerListener(this, "VISIBLE");
- }
- }
-}
-
-// virtual
-bool LLMenuItemCallGL::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
-{
- if (userdata.asString() == "ENABLED" && event->desc() == "value_changed")
- {
- LLSD state = event->getValue();
- setEnabled(state);
- return TRUE;
+ control->getSignal()->connect(boost::bind(&LLView::controlListener, _1, getHandle(), std::string("visible")));
+ setVisible(control->getValue());
}
- if (userdata.asString() == "VISIBLE" && event->desc() == "value_changed")
- {
- LLSD state = event->getValue();
- setVisible(state);
- return TRUE;
- }
- return LLMenuItemGL::handleEvent(event, userdata);
}
// virtual
@@ -1000,44 +976,35 @@ LLMenuItemCheckGL::LLMenuItemCheckGL ( const LLString& name,
setControlName(control_name, context);
}
-void LLMenuItemCheckGL::setCheckedControl(LLString checked_control, LLView *context)
+//virtual
+void LLMenuItemCheckGL::setValue(const LLSD& value)
{
- // Register new listener
- if (!checked_control.empty())
+ mChecked = value.asBoolean();
+ if(mChecked)
{
- LLControlBase *control = context->findControl(checked_control);
- if (control)
- {
- LLSD state = control->registerListener(this, "CHECKED");
- mChecked = state;
- }
- else
- {
- context->addBoolControl(checked_control, mChecked);
- control = context->findControl(checked_control);
- control->registerListener(this, "CHECKED");
- }
+ mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
+ }
+ else
+ {
+ mDrawBoolLabel.clear();
}
}
-// virtual
-bool LLMenuItemCheckGL::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+void LLMenuItemCheckGL::setCheckedControl(LLString checked_control, LLView *context)
{
- if (userdata.asString() == "CHECKED" && event->desc() == "value_changed")
+ // Register new listener
+ if (!checked_control.empty())
{
- LLSD state = event->getValue();
- mChecked = state;
- if(mChecked)
+ LLControlVariable *control = context->findControl(checked_control);
+ if (!control)
{
- mDrawBoolLabel = BOOLEAN_TRUE_PREFIX;
- }
- else
- {
- mDrawBoolLabel.clear();
+ context->addBoolControl(checked_control, mChecked);
+ control = context->findControl(checked_control);
+ llassert_always(control);
}
- return TRUE;
+ control->getSignal()->connect(boost::bind(&LLView::controlListener, _1, getHandle(), std::string("value")));
+ mChecked = control->getValue();
}
- return LLMenuItemCallGL::handleEvent(event, userdata);
}
// virtual
@@ -1946,7 +1913,7 @@ void LLMenuGL::parseChildXML(LLXMLNodePtr child, LLView *parent, LLUICtrlFactory
{
continue;
}
- LLControlBase *control = parent->findControl(control_name);
+ LLControlVariable *control = parent->findControl(control_name);
if (!control)
{
parent->addBoolControl(control_name, FALSE);