summaryrefslogtreecommitdiff
path: root/indra/newview/llflyoutcombobtn.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-09-04 23:43:39 +0100
committerGraham Linden <graham@lindenlab.com>2018-09-04 23:43:39 +0100
commita65afc30a968c752f1e252258e6917554a78f56a (patch)
treebb711036e634883453cd48140dd1478c761f2f71 /indra/newview/llflyoutcombobtn.cpp
parent32631f09a57548c2bbf7e09211a2053ff2e4e47d (diff)
parent0a78e9271c524c92cb8b1965e9a6081d4f700437 (diff)
Merge
Diffstat (limited to 'indra/newview/llflyoutcombobtn.cpp')
-rw-r--r--indra/newview/llflyoutcombobtn.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp
index d1a8b46c92..b008ee13be 100644
--- a/indra/newview/llflyoutcombobtn.cpp
+++ b/indra/newview/llflyoutcombobtn.cpp
@@ -29,14 +29,21 @@
#include "llflyoutcombobtn.h"
#include "llviewermenu.h"
-LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file) :
- mParent(parent),
+LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent,
+ const std::string &action_button,
+ const std::string &flyout_button,
+ const std::string &menu_file,
+ bool apply_immediately) :
+ mParent(parent),
mActionButton(action_button),
- mFlyoutButton(flyout_button)
+ mFlyoutButton(flyout_button),
+ mApplyImmediately(apply_immediately)
{
- // register action mapping before creating menu
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
+ // register action mapping before creating menu
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar save_registar;
save_registar.add("FlyoutCombo.Button.Action", [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutItemSelected(ctrl, data); });
+ LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enabled_rgistar;
+ enabled_rgistar.add("FlyoutCombo.Button.Check", [this](LLUICtrl *ctrl, const LLSD &data) { return onFlyoutItemCheck(ctrl, data); });
mParent->childSetAction(flyout_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutButton(ctrl, data); });
mParent->childSetAction(action_button, [this](LLUICtrl *ctrl, const LLSD &data) { onFlyoutAction(ctrl, data); });
@@ -119,7 +126,24 @@ void LLFlyoutComboBtnCtrl::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data
LLMenuItemGL *pmenuitem = static_cast<LLMenuItemGL*>(ctrl);
setSelectedItem(pmenuitem);
- onFlyoutAction(pmenuitem, data);
+ if (mApplyImmediately)
+ {
+ onFlyoutAction(pmenuitem, data);
+ }
+}
+
+bool LLFlyoutComboBtnCtrl::onFlyoutItemCheck(LLUICtrl *ctrl, const LLSD &data)
+{
+ if (mApplyImmediately)
+ {
+ return false;
+ }
+ else
+ {
+ LLMenuItemGL *pmenuitem = static_cast<LLMenuItemGL*>(ctrl);
+
+ return pmenuitem->getName() == mSelectedName;
+ }
}
void LLFlyoutComboBtnCtrl::onFlyoutAction(LLUICtrl *ctrl, const LLSD &data)