From 4aa0ebe8922b1382cc9067fa18c4bf173fa8b0e4 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Thu, 19 Nov 2009 13:44:44 +0000 Subject: [PATCH] Apply proper qualifier use for operator+= templates and their specializations. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2225 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/include/Utilities/pxCheckBox.h | 14 +------ common/include/Utilities/pxStaticText.h | 15 +------- common/include/Utilities/wxGuiTools.h | 49 ++++++++----------------- common/src/Utilities/pxCheckBox.cpp | 6 +++ common/src/Utilities/pxStaticText.cpp | 6 +++ common/src/Utilities/wxGuiTools.cpp | 27 ++++++++++++++ 6 files changed, 57 insertions(+), 60 deletions(-) diff --git a/common/include/Utilities/pxCheckBox.h b/common/include/Utilities/pxCheckBox.h index c4bb3da640..96330d6059 100644 --- a/common/include/Utilities/pxCheckBox.h +++ b/common/include/Utilities/pxCheckBox.h @@ -56,22 +56,10 @@ protected: void Init( const wxString& label, const wxString& subtext ); }; -static void operator+=( wxSizer& target, pxCheckBox* src ) -{ - if( !pxAssert( src != NULL ) ) return; - target.Add( src, wxSF.Expand() ); -} +extern void operator+=( wxSizer& target, pxCheckBox* src ); -#ifdef __LINUX__ template<> void operator+=( wxSizer& target, const pxWindowAndFlags& src ) { target.Add( src.window, src.flags ); } -#else -template<> -static void operator+=( wxSizer& target, const pxWindowAndFlags& src ) -{ - target.Add( src.window, src.flags ); -} -#endif diff --git a/common/include/Utilities/pxStaticText.h b/common/include/Utilities/pxStaticText.h index 682192c152..aed0deee5c 100644 --- a/common/include/Utilities/pxStaticText.h +++ b/common/include/Utilities/pxStaticText.h @@ -84,25 +84,14 @@ protected: void _setLabel(); }; -static void operator+=( wxSizer& target, pxStaticText* src ) -{ - if( !pxAssert( src != NULL ) ) return; - src->AddTo( target ); -} +extern void operator+=( wxSizer& target, pxStaticText* src ); -#ifdef __LINUX__ template<> void operator+=( wxSizer& target, const pxWindowAndFlags& src ) { target.Add( src.window, src.flags ); } -#else -template<> -static void operator+=( wxSizer& target, const pxWindowAndFlags& src ) -{ - target.Add( src.window, src.flags ); -} -#endif + // -------------------------------------------------------------------------------------- // pxStaticHeading // -------------------------------------------------------------------------------------- diff --git a/common/include/Utilities/wxGuiTools.h b/common/include/Utilities/wxGuiTools.h index 9da15e8874..5aea51946a 100644 --- a/common/include/Utilities/wxGuiTools.h +++ b/common/include/Utilities/wxGuiTools.h @@ -88,65 +88,46 @@ static pxWindowAndFlags operator | ( const wxSizerFlags& _flgs, WinType // is added to the dialog/panel's toplevel sizer (wxPanel.GetSizer() is used). If the panel // has no sizer set via SetSizer(), an assertion is generated. // + +extern void operator+=( wxSizer& target, wxWindow* src ); +extern void operator+=( wxSizer& target, wxSizer* src ); + +extern void operator+=( wxSizer& target, int spacer ); +extern void operator+=( wxPanel& target, int spacer ); +extern void operator+=( wxDialog& target, int spacer ); + template< typename WinType > -static void operator+=( wxSizer& target, const pxWindowAndFlags& src ) +void operator+=( wxSizer& target, const pxWindowAndFlags& src ) { target.Add( src.window, src.flags ); } -static void operator+=( wxSizer& target, wxWindow* src ) -{ - target.Add( src ); -} - -static void operator+=( wxSizer& target, wxSizer* src ) -{ - target.Add( src ); -} - -static void operator+=( wxSizer& target, int spacer ) -{ - target.AddSpacer( spacer ); -} - template< typename WinType > -static void operator+=( wxPanel& target, const pxWindowAndFlags& src ) +void operator+=( wxPanel& target, const pxWindowAndFlags& src ) { if( !pxAssert( target.GetSizer() != NULL ) ) return; *target.GetSizer() += src; } template< typename WinType > -static void operator+=( wxPanel& target, WinType* src ) -{ - if( !pxAssert( target.GetSizer() != NULL ) ) return; - *target.GetSizer() += src; -} - -static void operator+=( wxPanel& target, int spacer ) -{ - if( !pxAssert( target.GetSizer() != NULL ) ) return; - target.GetSizer()->AddSpacer( spacer ); -} - -template< typename WinType > -static void operator+=( wxDialog& target, const pxWindowAndFlags& src ) +void operator+=( wxPanel& target, WinType* src ) { if( !pxAssert( target.GetSizer() != NULL ) ) return; *target.GetSizer() += src; } template< typename WinType > -static void operator+=( wxDialog& target, WinType* src ) +void operator+=( wxDialog& target, const pxWindowAndFlags& src ) { if( !pxAssert( target.GetSizer() != NULL ) ) return; *target.GetSizer() += src; } -static void operator+=( wxDialog& target, int spacer ) +template< typename WinType > +void operator+=( wxDialog& target, WinType* src ) { if( !pxAssert( target.GetSizer() != NULL ) ) return; - target.GetSizer()->AddSpacer( spacer ); + *target.GetSizer() += src; } diff --git a/common/src/Utilities/pxCheckBox.cpp b/common/src/Utilities/pxCheckBox.cpp index 0796670210..15eb2058f6 100644 --- a/common/src/Utilities/pxCheckBox.cpp +++ b/common/src/Utilities/pxCheckBox.cpp @@ -70,3 +70,9 @@ bool pxCheckBox::GetValue() const { return m_checkbox->GetValue(); } + +void operator+=( wxSizer& target, pxCheckBox* src ) +{ + if( !pxAssert( src != NULL ) ) return; + target.Add( src, wxSF.Expand() ); +} diff --git a/common/src/Utilities/pxStaticText.cpp b/common/src/Utilities/pxStaticText.cpp index 28abe4d39c..9bace14fb1 100644 --- a/common/src/Utilities/pxStaticText.cpp +++ b/common/src/Utilities/pxStaticText.cpp @@ -120,3 +120,9 @@ pxStaticHeading::pxStaticHeading( wxWindow* parent, const wxString& label, int s { m_centerPadding = 0.18; } + +void operator+=( wxSizer& target, pxStaticText* src ) +{ + if( !pxAssert( src != NULL ) ) return; + src->AddTo( target ); +} diff --git a/common/src/Utilities/wxGuiTools.cpp b/common/src/Utilities/wxGuiTools.cpp index d59d78b36a..62606f794d 100644 --- a/common/src/Utilities/wxGuiTools.cpp +++ b/common/src/Utilities/wxGuiTools.cpp @@ -98,6 +98,33 @@ wxSizerFlags pxSizerFlags::Checkbox() return StdExpand(); } +void operator+=( wxSizer& target, wxWindow* src ) +{ + target.Add( src ); +} + +void operator+=( wxSizer& target, wxSizer* src ) +{ + target.Add( src ); +} + +void operator+=( wxSizer& target, int spacer ) +{ + target.AddSpacer( spacer ); +} + +void operator+=( wxPanel& target, int spacer ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + target.GetSizer()->AddSpacer( spacer ); +} + +void operator+=( wxDialog& target, int spacer ) +{ + if( !pxAssert( target.GetSizer() != NULL ) ) return; + target.GetSizer()->AddSpacer( spacer ); +} + // -------------------------------------------------------------------------------------- // pxTextWrapper / pxTextWrapperBase Implementations // --------------------------------------------------------------------------------------