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 ); 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 );
extern void operator+=( wxSizer* target, pxCheckBox& src );
template<> template<>
inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxCheckBox>& src ) 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 ); 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: protected:
wxString m_label; wxString m_label;
wxString m_wrappedLabel; wxString m_wrappedLabel;
wxAlignment m_align; wxAlignment m_align;
bool m_autowrap; bool m_autowrap;
int m_wrappedWidth; int m_wrappedWidth;
@ -56,7 +56,7 @@ protected:
bool AcceptsFocus() const { return false; } bool AcceptsFocus() const { return false; }
bool HasTransparentBackground() { return true; } bool HasTransparentBackground() { return true; }
void DoSetSize(int x, int y, int w, int h, int sizeFlags = wxSIZE_AUTO); void DoSetSize(int x, int y, int w, int h, int sizeFlags = wxSIZE_AUTO);
public: public:
pxStaticText( wxWindow* parent, const wxString& label, wxAlignment align=wxALIGN_CENTRE_HORIZONTAL ); pxStaticText( wxWindow* parent, const wxString& label, wxAlignment align=wxALIGN_CENTRE_HORIZONTAL );
pxStaticText( wxWindow* parent, int heightInLines, 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(); void SetPaddingDefaults();
}; };
extern void operator+=( wxSizer& target, pxStaticText* src );
extern void operator+=( wxSizer& target, pxStaticText& src ); extern void operator+=( wxSizer& target, pxStaticText& src );
extern void operator+=( wxSizer* target, pxStaticText& src );
template<> template<>
inline void operator+=( wxSizer& target, const pxWindowAndFlags<pxStaticText>& src ) 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 ); 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 ); 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() BEGIN_DECLARE_EVENT_TYPES()

View File

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

View File

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