Going private with the implementations

Although they’re still exported of course …
This commit is contained in:
Stefan Csomor
2020-09-17 23:13:44 +02:00
parent 552dbbe26e
commit 200c1af697
2 changed files with 23 additions and 15 deletions

View File

@@ -34,10 +34,13 @@
class WXDLLIMPEXP_FWD_CORE wxRadioButton; class WXDLLIMPEXP_FWD_CORE wxRadioButton;
wxRadioButton* wxGetNextButtonInGroup(wxRadioButton *btn); namespace wxPrivate
wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn); {
wxRadioButton* wxGetFirstButtonInGroup(wxRadioButton *btn); WXDLLIMPEXP_CORE wxRadioButton* wxGetNextButtonInGroup(wxRadioButton *btn);
wxRadioButton* wxGetLastButtonInGroup(wxRadioButton *btn); WXDLLIMPEXP_CORE wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn);
WXDLLIMPEXP_CORE wxRadioButton* wxGetFirstButtonInGroup(wxRadioButton *btn);
WXDLLIMPEXP_CORE wxRadioButton* wxGetLastButtonInGroup(wxRadioButton *btn);
} // namespace wxPrivate
template <class W> template <class W>
class WXDLLIMPEXP_CORE wxRadioButtonBase : public W class WXDLLIMPEXP_CORE wxRadioButtonBase : public W
@@ -49,22 +52,22 @@ public:
wxRadioButton* GetFirstInGroup() wxRadioButton* GetFirstInGroup()
{ {
return wxGetFirstButtonInGroup( static_cast<wxRadioButton*>(this)); return wxPrivate::wxGetFirstButtonInGroup( static_cast<wxRadioButton*>(this));
} }
wxRadioButton* GetLastInGroup() wxRadioButton* GetLastInGroup()
{ {
return wxGetLastButtonInGroup( static_cast<wxRadioButton*>(this)); return wxPrivate::wxGetLastButtonInGroup( static_cast<wxRadioButton*>(this));
} }
wxRadioButton* GetPreviousInGroup() wxRadioButton* GetPreviousInGroup()
{ {
return wxGetPreviousButtonInGroup( static_cast<wxRadioButton*>(this)); return wxPrivate::wxGetPreviousButtonInGroup( static_cast<wxRadioButton*>(this));
} }
wxRadioButton* GetNextInGroup() wxRadioButton* GetNextInGroup()
{ {
return wxGetNextButtonInGroup( static_cast<wxRadioButton*>(this)); return wxPrivate::wxGetNextButtonInGroup( static_cast<wxRadioButton*>(this));
} }
private: private:

View File

@@ -240,6 +240,9 @@ void wxControlContainer::SetLastFocus(wxWindow *win)
#if wxUSE_RADIOBTN #if wxUSE_RADIOBTN
namespace wxPrivate
{
wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn) wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn)
{ {
if ( btn->HasFlag(wxRB_GROUP) || btn->HasFlag(wxRB_SINGLE) ) if ( btn->HasFlag(wxRB_GROUP) || btn->HasFlag(wxRB_SINGLE) )
@@ -348,6 +351,8 @@ wxRadioButton* wxGetSelectedButtonInGroup(wxRadioButton *btn)
return NULL; return NULL;
} }
} // namespace wxPrivate
#endif // wxUSE_RADIOBTN #endif // wxUSE_RADIOBTN
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -468,7 +473,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
// If we are in a radio button group, start from the first item in the // If we are in a radio button group, start from the first item in the
// group // group
if ( event.IsFromTab() && wxIsKindOf(winFocus, wxRadioButton ) ) if ( event.IsFromTab() && wxIsKindOf(winFocus, wxRadioButton ) )
winFocus = wxGetFirstButtonInGroup((wxRadioButton*)winFocus); winFocus = wxPrivate::wxGetFirstButtonInGroup((wxRadioButton*)winFocus);
#endif // USE_RADIOBTN_NAV #endif // USE_RADIOBTN_NAV
// ok, we found the focus - now is it our child? // ok, we found the focus - now is it our child?
start_node = children.Find( winFocus ); start_node = children.Find( winFocus );
@@ -564,7 +569,7 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
if ( child->HasFlag(wxRB_GROUP) ) if ( child->HasFlag(wxRB_GROUP) )
{ {
// need to tab into the active button within a group // need to tab into the active button within a group
wxRadioButton *rb = wxGetSelectedButtonInGroup((wxRadioButton*)child); wxRadioButton *rb = wxPrivate::wxGetSelectedButtonInGroup((wxRadioButton*)child);
if ( rb ) if ( rb )
child = rb; child = rb;
} }
@@ -586,20 +591,20 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event )
// find the correct radio button to focus // find the correct radio button to focus
if ( forward ) if ( forward )
{ {
child = wxGetNextButtonInGroup(lastBtn); child = wxPrivate::wxGetNextButtonInGroup(lastBtn);
if ( !child ) if ( !child )
{ {
// no next button in group, set it to the first button // no next button in group, set it to the first button
child = wxGetFirstButtonInGroup(lastBtn); child = wxPrivate::wxGetFirstButtonInGroup(lastBtn);
} }
} }
else else
{ {
child = wxGetPreviousButtonInGroup(lastBtn); child = wxPrivate::wxGetPreviousButtonInGroup(lastBtn);
if ( !child ) if ( !child )
{ {
// no previous button in group, set it to the last button // no previous button in group, set it to the last button
child = wxGetLastButtonInGroup(lastBtn); child = wxPrivate::wxGetLastButtonInGroup(lastBtn);
} }
} }
@@ -764,7 +769,7 @@ bool wxSetFocusToChild(wxWindow *win, wxWindow **childLastFocused)
wxRadioButton* btn = wxDynamicCast(child, wxRadioButton); wxRadioButton* btn = wxDynamicCast(child, wxRadioButton);
if (btn) if (btn)
{ {
wxRadioButton* selected = wxGetSelectedButtonInGroup(btn); wxRadioButton* selected = wxPrivate::wxGetSelectedButtonInGroup(btn);
if (selected) if (selected)
child = selected; child = selected;
} }