summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-28 17:29:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-28 22:27:31 +0200
commitc3ea8e1d7922b93285dac930eb37f67eec19a21e (patch)
tree11f9edf48a779ee12d9e5f34824c336106612c05 /vcl
parentee3a23978da998b4d5ebac89c422cd78f7b31c3a (diff)
toggle should trigger only through ui
Change-Id: I15619dad2189f81a074f8b9649c4e8b756120f2c Reviewed-on: https://gerrit.libreoffice.org/54944 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2c6fdac648ae..1579aae20222 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -991,6 +991,7 @@ class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::Ra
{
private:
VclPtr<::RadioButton> m_xRadioButton;
+ bool m_bBlockNotify;
DECL_LINK(ToggleHdl, ::RadioButton&, void);
@@ -998,13 +999,16 @@ public:
SalInstanceRadioButton(::RadioButton* pButton, bool bTakeOwnership)
: SalInstanceButton(pButton, bTakeOwnership)
, m_xRadioButton(pButton)
+ , m_bBlockNotify(false)
{
m_xRadioButton->SetToggleHdl(LINK(this, SalInstanceRadioButton, ToggleHdl));
}
virtual void set_active(bool active) override
{
+ m_bBlockNotify = true;
m_xRadioButton->Check(active);
+ m_bBlockNotify = false;
}
virtual bool get_active() const override
@@ -1030,6 +1034,8 @@ public:
IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void)
{
+ if (m_bBlockNotify)
+ return;
signal_toggled();
}
@@ -1037,6 +1043,7 @@ class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::T
{
private:
VclPtr<PushButton> m_xToggleButton;
+ bool m_bBlockNotify;
DECL_LINK(ToggleListener, VclWindowEvent&, void);
@@ -1044,6 +1051,7 @@ public:
SalInstanceToggleButton(PushButton* pButton, bool bTakeOwnership)
: SalInstanceButton(pButton, bTakeOwnership)
, m_xToggleButton(pButton)
+ , m_bBlockNotify(false)
{
}
@@ -1056,7 +1064,9 @@ public:
virtual void set_active(bool active) override
{
+ m_bBlockNotify = true;
m_xToggleButton->Check(active);
+ m_bBlockNotify = false;
}
virtual bool get_active() const override
@@ -1066,7 +1076,9 @@ public:
virtual void set_inconsistent(bool inconsistent) override
{
+ m_bBlockNotify = false;
m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
+ m_bBlockNotify = true;
}
virtual bool get_inconsistent() const override
@@ -1083,6 +1095,8 @@ public:
IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void)
{
+ if (m_bBlockNotify)
+ return;
if (rEvent.GetId() == VclEventId::PushbuttonToggle)
signal_toggled();
}
@@ -1091,19 +1105,23 @@ class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::Ch
{
private:
VclPtr<CheckBox> m_xCheckButton;
+ bool m_bBlockNotify;
DECL_LINK(ToggleHdl, CheckBox&, void);
public:
SalInstanceCheckButton(CheckBox* pButton, bool bTakeOwnership)
: SalInstanceButton(pButton, bTakeOwnership)
, m_xCheckButton(pButton)
+ , m_bBlockNotify(false)
{
m_xCheckButton->SetToggleHdl(LINK(this, SalInstanceCheckButton, ToggleHdl));
}
virtual void set_active(bool active) override
{
+ m_bBlockNotify = true;
m_xCheckButton->Check(active);
+ m_bBlockNotify = false;
}
virtual bool get_active() const override
@@ -1113,7 +1131,9 @@ public:
virtual void set_inconsistent(bool inconsistent) override
{
+ m_bBlockNotify = true;
m_xCheckButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
+ m_bBlockNotify = false;
}
virtual bool get_inconsistent() const override
@@ -1129,6 +1149,8 @@ public:
IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void)
{
+ if (m_bBlockNotify)
+ return;
signal_toggled();
}