summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-05-06 14:41:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-05-06 21:21:00 +0200
commit229ae93385e28e0dee407d9386809fa0595578bc (patch)
treef5ddacc0bb74eb08ea5c0ba464a0c8a07b651f93 /vcl
parent7223d7312368bf9c917ef055830a3217eb49f9fd (diff)
Resolves: tdf#132581 allow disabling the auto-group RadioButton feature
the older way of doing things is to dig around contiguous radiobuttons to see what is part of the group, while the contemporary one is to explicitly use group() to set the members. A problem of the legacy way of doing it is that the results during setup and teardown of a collection of radiobuttons can be misleading. Change-Id: I6c590d0fb6fc6db3f5e5ba4397a62930a5c8f3f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93567 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/button.cxx10
-rw-r--r--vcl/source/window/dlgctrl.cxx2
2 files changed, 8 insertions, 4 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e9533fec6ff4..829b390a31f7 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2150,6 +2150,10 @@ std::vector< VclPtr<RadioButton> > RadioButton::GetRadioButtonGroup(bool bInclud
return aGroup;
}
+ std::vector<VclPtr<RadioButton>> aGroup;
+ if (mbUsesExplicitGroup)
+ return aGroup;
+
//old-school
// go back to first in group;
@@ -2162,7 +2166,6 @@ std::vector< VclPtr<RadioButton> > RadioButton::GetRadioButtonGroup(bool bInclud
else
break;
}
- std::vector< VclPtr<RadioButton> > aGroup;
// insert radiobuttons up to next group
do
{
@@ -2223,8 +2226,9 @@ void RadioButton::ImplCallClick( bool bGrabFocus, GetFocusFlags nFocusFlags )
mbStateChanged = false;
}
-RadioButton::RadioButton( vcl::Window* pParent, WinBits nStyle ) :
- Button( WindowType::RADIOBUTTON )
+RadioButton::RadioButton(vcl::Window* pParent, bool bUsesExplicitGroup, WinBits nStyle)
+ : Button(WindowType::RADIOBUTTON)
+ , mbUsesExplicitGroup(bUsesExplicitGroup)
{
ImplInitRadioButtonData();
ImplInit( pParent, nStyle );
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 45582a7a4e50..1c7fb30f4f99 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -600,7 +600,7 @@ namespace
{
std::vector<VclPtr<RadioButton> > aGroup(pSourceWindow->GetRadioButtonGroup());
- if (aGroup.size() == 1) //only one button in group
+ if (aGroup.size() < 2) // have to have at last 2 buttons to be a useful group
return false;
if (bBackward)