From ec184e324214ea06f0c056ab626de5f32bcdad3b Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Mon, 11 Dec 2006 13:48:18 +0000
Subject: [PATCH] 1. Renamed Set/GetXXXVisible() to ShowXXX() and
 IsXXXVisible() 2. Moved wxSearchCtrlBase to wx/srchctrl.h to avoid
 duplicating it 3. Removed gcc #pragmas

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43924 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/srchctrl.tex       | 16 ++++++-------
 include/wx/generic/srchctlg.h    | 34 ++++----------------------
 include/wx/mac/carbon/srchctrl.h | 32 ++++---------------------
 include/wx/srchctrl.h            | 41 +++++++++++++++++++++++++-------
 samples/widgets/searchctrl.cpp   |  4 ++--
 src/generic/srchctlg.cpp         | 12 ++++------
 src/mac/carbon/srchctrl.cpp      | 16 +++++--------
 7 files changed, 60 insertions(+), 95 deletions(-)

diff --git a/docs/latex/wx/srchctrl.tex b/docs/latex/wx/srchctrl.tex
index 06ce285e8d..0d7b769ae3 100644
--- a/docs/latex/wx/srchctrl.tex
+++ b/docs/latex/wx/srchctrl.tex
@@ -120,9 +120,9 @@ Returns a pointer to the search control's menu object or NULL if there is no
 menu attached.
 
 
-\membersection{wxSearchCtrl::SetSearchButtonVisible}\label{wxsearchctrlsetsearchbuttonvisible}
+\membersection{wxSearchCtrl::ShowSearchButton}\label{wxsearchctrlshowsearchbutton}
 
-\func{virtual void}{SetSearchButtonVisible}{\param{bool }{ show}}
+\func{virtual void}{ShowSearchButton}{\param{bool }{ show}}
 
 Sets the search button visibility value on the search control.  
 If there is a menu attached, the search button will be visible regardless of the search
@@ -131,9 +131,9 @@ button visibility value.
 This has no effect in Mac OS X v10.3
 
 
-\membersection{wxSearchCtrl::GetSearchButtonVisible}\label{wxsearchctrlgetsearchbuttonvisible}
+\membersection{wxSearchCtrl::IsSearchButtonVisible}\label{wxsearchctrlissearchbuttonvisible}
 
-\func{virtual bool}{GetSearchButtonVisible}{\void}
+\func{virtual bool}{IsSearchButtonVisible}{\void}
 
 Returns the search button visibility value.  
 If there is a menu attached, the search button will be visible regardless of the search
@@ -142,15 +142,15 @@ button visibility value.
 This always returns false in Mac OS X v10.3
 
 
-\membersection{wxSearchCtrl::SetCancelButtonVisible}\label{wxsearchctrlsetcancelbuttonvisible}
+\membersection{wxSearchCtrl::ShowCancelButton}\label{wxsearchctrlshowcancelbutton}
 
-\func{virtual void}{SetCancelButtonVisible}{\param{bool }{ show}}
+\func{virtual void}{ShowCancelButton}{\param{bool }{ show}}
 
 Shows or hides the cancel button.
 
 
-\membersection{wxSearchCtrl::GetCancelButtonVisible}\label{wxsearchctrlgetcancelbuttonvisible}
+\membersection{wxSearchCtrl::IsCancelButtonVisible}\label{wxsearchctrliscancelbuttonvisible}
 
-\func{virtual bool}{GetCancelButtonVisible}{\void}
+\func{virtual bool}{IsCancelButtonVisible}{\void}
 
 Indicates whether the cancel button is visible.
diff --git a/include/wx/generic/srchctlg.h b/include/wx/generic/srchctlg.h
index b65ec18909..223ad39f31 100644
--- a/include/wx/generic/srchctlg.h
+++ b/include/wx/generic/srchctlg.h
@@ -14,37 +14,11 @@
 
 #if wxUSE_SEARCHCTRL
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma interface "srchctlg.h"
-#endif
-
 #include "wx/bitmap.h"
 
-// ----------------------------------------------------------------------------
-
 class WXDLLEXPORT wxSearchButton;
 class WXDLLEXPORT wxSearchTextCtrl;
 
-class WXDLLEXPORT wxSearchCtrlBase : public wxTextCtrlBase
-{
-public:
-    wxSearchCtrlBase() {}
-    virtual ~wxSearchCtrlBase() {}
-
-    // search control 
-    virtual void SetMenu( wxMenu* menu ) = 0;
-    virtual wxMenu* GetMenu() = 0;
-
-
-    // get/set options
-    virtual void SetSearchButtonVisible( bool show ) = 0;
-    virtual bool GetSearchButtonVisible() const = 0;
-
-    virtual void SetCancelButtonVisible( bool show ) = 0;
-    virtual bool GetCancelButtonVisible() const = 0;
-protected:
-};
-
 // ----------------------------------------------------------------------------
 // wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton
 // ----------------------------------------------------------------------------
@@ -81,11 +55,11 @@ public:
     
     // get/set search options
     // ----------------------
-    virtual void SetSearchButtonVisible( bool show );
-    virtual bool GetSearchButtonVisible() const;
+    virtual void ShowSearchButton( bool show );
+    virtual bool IsSearchButtonVisible() const;
 
-    virtual void SetCancelButtonVisible( bool show );
-    virtual bool GetCancelButtonVisible() const;
+    virtual void ShowCancelButton( bool show );
+    virtual bool IsCancelButtonVisible() const;
 
     // accessors
     // ---------
diff --git a/include/wx/mac/carbon/srchctrl.h b/include/wx/mac/carbon/srchctrl.h
index 84da5212d7..980b707594 100644
--- a/include/wx/mac/carbon/srchctrl.h
+++ b/include/wx/mac/carbon/srchctrl.h
@@ -14,30 +14,6 @@
 
 #if wxUSE_SEARCHCTRL
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma interface "srchctrl.h"
-#endif
-
-class WXDLLEXPORT wxSearchCtrlBase : public wxTextCtrl
-{
-public:
-    wxSearchCtrlBase() {}
-    virtual ~wxSearchCtrlBase() {}
-
-    // search control 
-    virtual void SetMenu( wxMenu* menu ) = 0;
-    virtual wxMenu* GetMenu() = 0;
-
-
-    // get/set options
-    virtual void SetSearchButtonVisible( bool show ) = 0;
-    virtual bool GetSearchButtonVisible() const = 0;
-
-    virtual void SetCancelButtonVisible( bool show ) = 0;
-    virtual bool GetCancelButtonVisible() const = 0;
-protected:
-};
-
 class wxMacSearchFieldControl;
 
 class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase
@@ -72,11 +48,11 @@ public:
     
     // get/set search options
     // ----------------------
-    virtual void SetSearchButtonVisible( bool show );
-    virtual bool GetSearchButtonVisible() const;
+    virtual void ShowSearchButton( bool show );
+    virtual bool IsSearchButtonVisible() const;
 
-    virtual void SetCancelButtonVisible( bool show );
-    virtual bool GetCancelButtonVisible() const;
+    virtual void ShowCancelButton( bool show );
+    virtual bool IsCancelButtonVisible() const;
 
     virtual wxInt32     MacSearchFieldSearchHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
     virtual wxInt32     MacSearchFieldCancelHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
diff --git a/include/wx/srchctrl.h b/include/wx/srchctrl.h
index 3fdf6ae227..a5ea78dd73 100644
--- a/include/wx/srchctrl.h
+++ b/include/wx/srchctrl.h
@@ -18,6 +18,19 @@
 
 #include "wx/textctrl.h"
 
+#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \
+        && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
+    // search control was introduced in Mac OS X 10.3 Panther
+    #define wxUSE_NATIVE_SEARCH_CONTROL 1
+
+    #define wxSearchCtrlBaseBaseClass wxTextCtrl
+#else
+    // no native version, use the generic one
+    #define wxUSE_NATIVE_SEARCH_CONTROL 0
+
+    #define wxSearchCtrlBaseBaseClass wxTextCtrlBase
+#endif
+
 // ----------------------------------------------------------------------------
 // constants
 // ----------------------------------------------------------------------------
@@ -34,16 +47,26 @@ END_DECLARE_EVENT_TYPES()
 // it is based on the MacOSX 10.3 control HISearchFieldCreate
 // ----------------------------------------------------------------------------
 
-// include the platform-dependent class implementation
-#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \
-        && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
-    // search control was introduced in Mac OS X 10.3 Panther
-    #define wxUSE_NATIVE_SEARCH_CONTROL 1
-#else
-    // no native version, use the generic one
-    #define wxUSE_NATIVE_SEARCH_CONTROL 0
-#endif
+class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
+{
+public:
+    wxSearchCtrlBase() { }
+    virtual ~wxSearchCtrlBase() { }
+
+    // search control 
+    virtual void SetMenu(wxMenu *menu) = 0;
+    virtual wxMenu *GetMenu() = 0;
+
+    // get/set options
+    virtual void ShowSearchButton( bool show ) = 0;
+    virtual bool IsSearchButtonVisible() const = 0;
 
+    virtual void ShowCancelButton( bool show ) = 0;
+    virtual bool IsCancelButtonVisible() const = 0;
+};
+
+
+// include the platform-dependent class implementation
 #if wxUSE_NATIVE_SEARCH_CONTROL
     #if defined(__WXMAC__)
         #include "wx/mac/srchctrl.h"
diff --git a/samples/widgets/searchctrl.cpp b/samples/widgets/searchctrl.cpp
index 414cfe1f2f..80a95995c8 100644
--- a/samples/widgets/searchctrl.cpp
+++ b/samples/widgets/searchctrl.cpp
@@ -204,12 +204,12 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
 
 void SearchCtrlWidgetsPage::OnToggleSearchButton(wxCommandEvent&)
 {
-    m_srchCtrl->SetSearchButtonVisible( m_searchBtnCheck->GetValue() );
+    m_srchCtrl->ShowSearchButton( m_searchBtnCheck->GetValue() );
 }
 
 void SearchCtrlWidgetsPage::OnToggleCancelButton(wxCommandEvent&)
 {
-    m_srchCtrl->SetCancelButtonVisible( m_cancelBtnCheck->GetValue() );
+    m_srchCtrl->ShowCancelButton( m_cancelBtnCheck->GetValue() );
         
 }
 
diff --git a/src/generic/srchctlg.cpp b/src/generic/srchctlg.cpp
index 956edb3f83..d624d7d22e 100644
--- a/src/generic/srchctlg.cpp
+++ b/src/generic/srchctlg.cpp
@@ -17,10 +17,6 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "srchctlg.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -316,7 +312,7 @@ wxMenu* wxSearchCtrl::GetMenu()
     return m_menu;
 }
 
-void wxSearchCtrl::SetSearchButtonVisible( bool show )
+void wxSearchCtrl::ShowSearchButton( bool show )
 {
     if ( m_searchButtonVisible == show )
     {
@@ -333,13 +329,13 @@ void wxSearchCtrl::SetSearchButtonVisible( bool show )
     LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
 }
 
-bool wxSearchCtrl::GetSearchButtonVisible() const
+bool wxSearchCtrl::IsSearchButtonVisible() const
 {
     return m_searchButtonVisible;
 }
 
 
-void wxSearchCtrl::SetCancelButtonVisible( bool show )
+void wxSearchCtrl::ShowCancelButton( bool show )
 {
     if ( m_cancelButtonVisible == show )
     {
@@ -352,7 +348,7 @@ void wxSearchCtrl::SetCancelButtonVisible( bool show )
     LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
 }
 
-bool wxSearchCtrl::GetCancelButtonVisible() const
+bool wxSearchCtrl::IsCancelButtonVisible() const
 {
     return m_cancelButtonVisible;
 }
diff --git a/src/mac/carbon/srchctrl.cpp b/src/mac/carbon/srchctrl.cpp
index f6677c0ff8..90a889170b 100644
--- a/src/mac/carbon/srchctrl.cpp
+++ b/src/mac/carbon/srchctrl.cpp
@@ -17,10 +17,6 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "srchctrl.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -71,11 +67,11 @@ public :
     }
 
     // search field options
-    virtual void SetSearchButtonVisible( bool show );
-    virtual bool GetSearchButtonVisible() const;
+    virtual void ShowSearchButton( bool show );
+    virtual bool IsSearchButtonVisible() const;
 
-    virtual void SetCancelButtonVisible( bool show );
-    virtual bool GetCancelButtonVisible() const;
+    virtual void ShowCancelButton( bool show );
+    virtual bool IsCancelButtonVisible() const;
 
     virtual void SetSearchMenu( wxMenu* menu );
     virtual wxMenu* GetSearchMenu() const;
@@ -91,8 +87,8 @@ void wxMacSearchFieldControl::CreateControl( wxTextCtrl* /*peer*/, const Rect* b
     OptionBits attributes = 0;
     if ( UMAGetSystemVersion() >= 0x1040 )
     {
-		attributes = kHISearchFieldAttributesSearchIcon;
-	}
+        attributes = kHISearchFieldAttributesSearchIcon;
+    }
     HIRect hibounds = { { bounds->left, bounds->top }, { bounds->right-bounds->left, bounds->bottom-bounds->top } };
     verify_noerr( HISearchFieldCreate( 
         &hibounds,
-- 
2.45.2

