summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/button.hxx10
-rw-r--r--sfx2/source/sidebar/TabItem.cxx2
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx2
-rw-r--r--vcl/source/control/button.cxx10
-rw-r--r--vcl/source/window/dlgctrl.cxx2
5 files changed, 19 insertions, 7 deletions
diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index 14c936f0ddee..d9e2106ea6d5 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -283,6 +283,7 @@ private:
bool mbChecked;
bool mbRadioCheck;
bool mbStateChanged;
+ bool mbUsesExplicitGroup;
Link<RadioButton&,void> maToggleHdl;
SAL_DLLPRIVATE void ImplInitRadioButtonData();
SAL_DLLPRIVATE WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle );
@@ -317,7 +318,14 @@ protected:
void ImplAdjustNWFSizes() override;
public:
- explicit RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 );
+ /*
+ bUsesExplicitGroup of true means that group() is used to set what radiobuttons are part of a group
+ while false means that contiguous radiobuttons are considered part of a group where WB_GROUP designates
+ the start of the group and all contiguous radiobuttons without WB_GROUP set form the rest of the group.
+
+ true is fairly straightforward, false leads to trick situations and is the legacy case
+ */
+ explicit RadioButton(vcl::Window* pParent, bool bUsesExplicitGroup = true, WinBits nWinStyle = 0);
virtual ~RadioButton() override;
virtual void dispose() override;
diff --git a/sfx2/source/sidebar/TabItem.cxx b/sfx2/source/sidebar/TabItem.cxx
index e37f028d8b47..dcf00532044f 100644
--- a/sfx2/source/sidebar/TabItem.cxx
+++ b/sfx2/source/sidebar/TabItem.cxx
@@ -31,7 +31,7 @@ using namespace css::uno;
namespace sfx2::sidebar {
TabItem::TabItem (vcl::Window* pParentWindow)
- : RadioButton(pParentWindow, 0)
+ : RadioButton(pParentWindow, false, 0)
, mbIsLeftButtonDown(false)
{
SetStyle(GetStyle() | WB_TABSTOP | WB_DIALOGCONTROL | WB_NOPOINTERFOCUS);
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 77935fb7ac41..d39a70659161 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1599,7 +1599,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
*ppNewComp = new VCLXMessageBox;
break;
case WindowType::RADIOBUTTON:
- pNewWindow = VclPtr<RadioButton>::Create( pParent, nWinBits );
+ pNewWindow = VclPtr<RadioButton>::Create(pParent, false, nWinBits);
*ppNewComp = new VCLXRadioButton;
// by default, disable RadioCheck
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)