diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/button.hxx | 10 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 20 |
2 files changed, 15 insertions, 15 deletions
diff --git a/vcl/inc/vcl/button.hxx b/vcl/inc/vcl/button.hxx index d47abe219c5c..f7d05f41b0d4 100644 --- a/vcl/inc/vcl/button.hxx +++ b/vcl/inc/vcl/button.hxx @@ -393,14 +393,14 @@ public: or giving up the SolarMutex may mean events get executed that lead to the pointers getting invalid. - @param io_rGroup - gets cleared on entering the function. on return contains the <code>RadioButton</code>s - in the same group as this <code>RadioButton</code>. - @param bIncludeThis defines whether <code>this</code> is contained in the returned list + + @return + on return contains the <code>RadioButton</code>s + in the same group as this <code>RadioButton</code>. */ - void GetRadioButtonGroup( std::vector<RadioButton*>& io_rGroup, bool bIncludeThis ) const; + std::vector<RadioButton*> GetRadioButtonGroup(bool bIncludeThis = true) const; virtual bool set_property(const rtl::OString &rKey, const rtl::OString &rValue); void group(RadioButton &rOther); diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 93b4065a3e5e..e49debd5e831 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2316,25 +2316,24 @@ void RadioButton::group(RadioButton &rOther) // .----------------------------------------------------------------------- -void RadioButton::GetRadioButtonGroup( std::vector< RadioButton* >& io_rGroup, bool bIncludeThis ) const +std::vector< RadioButton* > RadioButton::GetRadioButtonGroup(bool bIncludeThis) const { - // empty the list - io_rGroup.clear(); + std::vector< RadioButton* > aGroup; if (m_xGroup) { for (std::set<RadioButton*>::iterator aI = m_xGroup->begin(), aEnd = m_xGroup->end(); aI != aEnd; ++aI) { RadioButton *pRadioButton = *aI; - if (pRadioButton == this) + if (!bIncludeThis && pRadioButton == this) continue; - io_rGroup.push_back(pRadioButton); + aGroup.push_back(pRadioButton); } - return; + return aGroup; } //old-school - SAL_WARN("vcl", "No group set on radiobutton"); + SAL_WARN("vcl", "No new-style group set on radiobutton, using old-style digging around"); // go back to first in group; Window* pFirst = const_cast<RadioButton*>(this); @@ -2352,10 +2351,12 @@ void RadioButton::GetRadioButtonGroup( std::vector< RadioButton* >& io_rGroup, b if( pFirst->GetType() == WINDOW_RADIOBUTTON ) { if( pFirst != this || bIncludeThis ) - io_rGroup.push_back( static_cast<RadioButton*>(pFirst) ); + aGroup.push_back( static_cast<RadioButton*>(pFirst) ); } pFirst = pFirst->GetWindow( WINDOW_NEXT ); } while( pFirst && ( ( pFirst->GetStyle() & WB_GROUP ) == 0 ) ); + + return aGroup; } // ----------------------------------------------------------------------- @@ -2364,8 +2365,7 @@ void RadioButton::ImplUncheckAllOther() { mpWindowImpl->mnStyle |= WB_TABSTOP; - std::vector<RadioButton*> aGroup; - GetRadioButtonGroup(aGroup, false); + std::vector<RadioButton*> aGroup(GetRadioButtonGroup(false)); // iterate over radio button group and checked buttons for (std::vector<RadioButton*>::iterator aI = aGroup.begin(), aEnd = aGroup.end(); aI != aEnd; ++aI) { |