pcsx2: remove template and pointer on overload function from wxGuiTools

Fixed clang build.

Note from Gregory:
C++ requests that at least 1 parameters is a class, an enumeration, or a
reference to those objects. Probably to avoid to screw basic type operation.
For example: *p += 4;

The realy buggy code was this one because T could be an int!
template T
f(*ptr, T)

To avoid any issue in the future the Team decide to drop all overload that use pointers.
This commit is contained in:
Forrest McDonald 2014-07-15 19:47:51 -07:00 committed by Gregory Hainaut
parent da93a960af
commit 81458912f9
5 changed files with 14 additions and 54 deletions

View File

@ -68,9 +68,7 @@ protected:
void OnSubtextClicked( wxCommandEvent& evt );
};
extern void operator+=( wxSizer& target, pxCheckBox* src );
extern void operator+=( wxSizer& target, pxCheckBox& src );
extern void operator+=( wxSizer* target, pxCheckBox& src );
template<>
inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxCheckBox>& src )
@ -78,8 +76,3 @@ inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxCheckBox>& src
target.Add( src.window, src.flags );
}
template<>
inline void operator+=( wxSizer* target, const pxWindowAndFlags<pxCheckBox>& src )
{
target->Add( src.window, src.flags );
}

View File

@ -38,7 +38,7 @@ class pxStaticText : public wxControl
protected:
wxString m_label;
wxString m_wrappedLabel;
wxAlignment m_align;
bool m_autowrap;
int m_wrappedWidth;
@ -56,7 +56,7 @@ protected:
bool AcceptsFocus() const { return false; }
bool HasTransparentBackground() { return true; }
void DoSetSize(int x, int y, int w, int h, int sizeFlags = wxSIZE_AUTO);
public:
pxStaticText( wxWindow* parent, const wxString& label, wxAlignment align=wxALIGN_CENTRE_HORIZONTAL );
pxStaticText( wxWindow* parent, int heightInLines, const wxString& label, wxAlignment align=wxALIGN_CENTRE_HORIZONTAL );
@ -115,9 +115,7 @@ protected:
void SetPaddingDefaults();
};
extern void operator+=( wxSizer& target, pxStaticText* src );
extern void operator+=( wxSizer& target, pxStaticText& src );
extern void operator+=( wxSizer* target, pxStaticText& src );
template<>
inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxStaticText>& src )
@ -125,8 +123,3 @@ inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxStaticText>& s
target.Add( src.window, src.flags );
}
template<>
inline void operator+=( wxSizer* target, const pxWindowAndFlags<pxStaticText>& src )
{
target->Add( src.window, src.flags );
}

View File

@ -270,32 +270,6 @@ void operator+=( wxSizer& target, const pxWindowAndFlags<WinType>& src )
target.Add( src.window, src.flags );
}
// ----------------------------------------------------------------------------
// Pointer Versions! (note that C++ requires one of the two operator params be a
// "proper" object type (non-pointer), so that's why some of these are missing.
template< typename WinType >
void operator+=( wxWindow* target, WinType& src )
{
if( !pxAssert( target != NULL ) ) return;
if( !pxAssert( target->GetSizer() != NULL ) ) return;
*target->GetSizer() += src;
}
template< typename WinType >
void operator+=( wxWindow* target, const pxWindowAndFlags<WinType>& src )
{
if( !pxAssert( target != NULL ) ) return;
if( !pxAssert( target->GetSizer() != NULL ) ) return;
*target->GetSizer() += src;
}
template< typename WinType >
void operator+=( wxSizer* target, const pxWindowAndFlags<WinType>& src )
{
if( !pxAssert( target != NULL ) ) return;
target->Add( src.window, src.flags );
}
BEGIN_DECLARE_EVENT_TYPES()

View File

@ -21,8 +21,8 @@ CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxS
, ThisSizer( *new wxStaticBoxSizer( orientation, this ) )
, ThisToggle( *new wxCheckBox( this, wxID_ANY, title, wxPoint( 8, 0 ) ) )
{
this += ThisToggle;
this += ThisSizer | pxExpand;
*this += ThisToggle;
*this += ThisSizer | pxExpand;
// Ensure that the right-side of the static group box isn't too cozy:
SetMinWidth( ThisToggle.GetSize().GetWidth() + 32 );
@ -72,6 +72,6 @@ bool CheckedStaticBox::Enable( bool enable )
if( current != &ThisToggle )
current->Enable( val );
}
return true;
}

View File

@ -57,7 +57,7 @@ public:
{
m_parent = parent;
m_parent->AllowApplyActivation( false );
m_apply = m_parent->FindWindow( wxID_APPLY );
m_ok = m_parent->FindWindow( wxID_OK );
m_cancel = m_parent->FindWindow( wxID_CANCEL );
@ -77,7 +77,7 @@ public:
{
m_apply = m_ok = m_cancel = NULL;
}
virtual ~ScopedOkButtonDisabler() throw()
{
if (m_apply) m_apply ->Enable();
@ -137,7 +137,7 @@ Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, con
SetMinWidth( idealWidth );
m_listbook = NULL;
m_allowApplyActivation = true;
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnOk_Click ) );
Connect( wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnCancel_Click ) );
Connect( wxID_APPLY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnApply_Click ) );
@ -166,14 +166,14 @@ Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, con
ConnectSomethingChanged( SPINCTRL_UPDATED );
ConnectSomethingChanged( SLIDER_UPDATED );
ConnectSomethingChanged( DIRPICKER_CHANGED );
Connect( pxEvt_SomethingChanged, wxCommandEventHandler( BaseConfigurationDialog::OnSomethingChanged ) );
}
void Dialogs::BaseConfigurationDialog::AddListbook( wxSizer* sizer )
{
if( !sizer ) sizer = GetSizer();
sizer += m_listbook | pxExpand.Border( wxLEFT | wxRIGHT, 2 );
*sizer += m_listbook | pxExpand.Border( wxLEFT | wxRIGHT, 2 );
}
void Dialogs::BaseConfigurationDialog::CreateListbook( wxImageList& bookicons )
@ -202,9 +202,9 @@ Dialogs::BaseConfigurationDialog::~BaseConfigurationDialog() throw()
void Dialogs::BaseConfigurationDialog::OnSetSettingsPage( wxCommandEvent& evt )
{
if( !m_listbook ) return;
size_t pages = m_labels.GetCount();
for( size_t i=0; i<pages; ++i )
{
if( evt.GetString() == m_labels[i] )
@ -275,7 +275,7 @@ void Dialogs::BaseConfigurationDialog::OnApply_Click( wxCommandEvent& evt )
if( m_listbook ) GetConfSettingsTabName() = m_labels[m_listbook->GetSelection()];
AppSaveSettings();
SomethingChanged_StateModified_IsChanged();
}
@ -319,4 +319,4 @@ void Dialogs::BaseConfigurationDialog::OnSettingsApplied( wxCommandEvent& evt )
{
evt.Skip();
MSW_ListView_SetIconSpacing( m_listbook, GetClientSize().GetWidth() );
}
}