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;
wxRadioButton* wxGetNextButtonInGroup(wxRadioButton *btn);
wxRadioButton* wxGetPreviousButtonInGroup(wxRadioButton *btn);
wxRadioButton* wxGetFirstButtonInGroup(wxRadioButton *btn);
wxRadioButton* wxGetLastButtonInGroup(wxRadioButton *btn);
namespace wxPrivate
{
WXDLLIMPEXP_CORE wxRadioButton* wxGetNextButtonInGroup(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>
class WXDLLIMPEXP_CORE wxRadioButtonBase : public W
@@ -49,22 +52,22 @@ public:
wxRadioButton* GetFirstInGroup()
{
return wxGetFirstButtonInGroup( static_cast<wxRadioButton*>(this));
return wxPrivate::wxGetFirstButtonInGroup( static_cast<wxRadioButton*>(this));
}
wxRadioButton* GetLastInGroup()
{
return wxGetLastButtonInGroup( static_cast<wxRadioButton*>(this));
return wxPrivate::wxGetLastButtonInGroup( static_cast<wxRadioButton*>(this));
}
wxRadioButton* GetPreviousInGroup()
{
return wxGetPreviousButtonInGroup( static_cast<wxRadioButton*>(this));
return wxPrivate::wxGetPreviousButtonInGroup( static_cast<wxRadioButton*>(this));
}
wxRadioButton* GetNextInGroup()
{
return wxGetNextButtonInGroup( static_cast<wxRadioButton*>(this));
return wxPrivate::wxGetNextButtonInGroup( static_cast<wxRadioButton*>(this));
}
private:

View File

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