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
This commit is contained in:
Vadim Zeitlin
2006-12-11 13:48:18 +00:00
parent 8138b9a4e2
commit ec184e3242
7 changed files with 60 additions and 95 deletions

View File

@@ -120,9 +120,9 @@ Returns a pointer to the search control's menu object or NULL if there is no
menu attached. 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. 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 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 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. Returns the search button visibility value.
If there is a menu attached, the search button will be visible regardless of the search 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 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. 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. Indicates whether the cancel button is visible.

View File

@@ -14,37 +14,11 @@
#if wxUSE_SEARCHCTRL #if wxUSE_SEARCHCTRL
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "srchctlg.h"
#endif
#include "wx/bitmap.h" #include "wx/bitmap.h"
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxSearchButton; class WXDLLEXPORT wxSearchButton;
class WXDLLEXPORT wxSearchTextCtrl; 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 // wxSearchCtrl is a combination of wxTextCtrl and wxSearchButton
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -81,11 +55,11 @@ public:
// get/set search options // get/set search options
// ---------------------- // ----------------------
virtual void SetSearchButtonVisible( bool show ); virtual void ShowSearchButton( bool show );
virtual bool GetSearchButtonVisible() const; virtual bool IsSearchButtonVisible() const;
virtual void SetCancelButtonVisible( bool show ); virtual void ShowCancelButton( bool show );
virtual bool GetCancelButtonVisible() const; virtual bool IsCancelButtonVisible() const;
// accessors // accessors
// --------- // ---------

View File

@@ -14,30 +14,6 @@
#if wxUSE_SEARCHCTRL #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 wxMacSearchFieldControl;
class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase class WXDLLEXPORT wxSearchCtrl : public wxSearchCtrlBase
@@ -72,11 +48,11 @@ public:
// get/set search options // get/set search options
// ---------------------- // ----------------------
virtual void SetSearchButtonVisible( bool show ); virtual void ShowSearchButton( bool show );
virtual bool GetSearchButtonVisible() const; virtual bool IsSearchButtonVisible() const;
virtual void SetCancelButtonVisible( bool show ); virtual void ShowCancelButton( bool show );
virtual bool GetCancelButtonVisible() const; virtual bool IsCancelButtonVisible() const;
virtual wxInt32 MacSearchFieldSearchHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; virtual wxInt32 MacSearchFieldSearchHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
virtual wxInt32 MacSearchFieldCancelHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ; virtual wxInt32 MacSearchFieldCancelHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;

View File

@@ -18,6 +18,19 @@
#include "wx/textctrl.h" #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 // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -34,16 +47,26 @@ END_DECLARE_EVENT_TYPES()
// it is based on the MacOSX 10.3 control HISearchFieldCreate // it is based on the MacOSX 10.3 control HISearchFieldCreate
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// include the platform-dependent class implementation class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
#if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \ {
&& (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3) public:
// search control was introduced in Mac OS X 10.3 Panther wxSearchCtrlBase() { }
#define wxUSE_NATIVE_SEARCH_CONTROL 1 virtual ~wxSearchCtrlBase() { }
#else
// no native version, use the generic one
#define wxUSE_NATIVE_SEARCH_CONTROL 0
#endif
// 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 wxUSE_NATIVE_SEARCH_CONTROL
#if defined(__WXMAC__) #if defined(__WXMAC__)
#include "wx/mac/srchctrl.h" #include "wx/mac/srchctrl.h"

View File

@@ -204,12 +204,12 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
void SearchCtrlWidgetsPage::OnToggleSearchButton(wxCommandEvent&) void SearchCtrlWidgetsPage::OnToggleSearchButton(wxCommandEvent&)
{ {
m_srchCtrl->SetSearchButtonVisible( m_searchBtnCheck->GetValue() ); m_srchCtrl->ShowSearchButton( m_searchBtnCheck->GetValue() );
} }
void SearchCtrlWidgetsPage::OnToggleCancelButton(wxCommandEvent&) void SearchCtrlWidgetsPage::OnToggleCancelButton(wxCommandEvent&)
{ {
m_srchCtrl->SetCancelButtonVisible( m_cancelBtnCheck->GetValue() ); m_srchCtrl->ShowCancelButton( m_cancelBtnCheck->GetValue() );
} }

View File

@@ -17,10 +17,6 @@
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "srchctlg.h"
#endif
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
@@ -316,7 +312,7 @@ wxMenu* wxSearchCtrl::GetMenu()
return m_menu; return m_menu;
} }
void wxSearchCtrl::SetSearchButtonVisible( bool show ) void wxSearchCtrl::ShowSearchButton( bool show )
{ {
if ( m_searchButtonVisible == show ) if ( m_searchButtonVisible == show )
{ {
@@ -333,13 +329,13 @@ void wxSearchCtrl::SetSearchButtonVisible( bool show )
LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
} }
bool wxSearchCtrl::GetSearchButtonVisible() const bool wxSearchCtrl::IsSearchButtonVisible() const
{ {
return m_searchButtonVisible; return m_searchButtonVisible;
} }
void wxSearchCtrl::SetCancelButtonVisible( bool show ) void wxSearchCtrl::ShowCancelButton( bool show )
{ {
if ( m_cancelButtonVisible == show ) if ( m_cancelButtonVisible == show )
{ {
@@ -352,7 +348,7 @@ void wxSearchCtrl::SetCancelButtonVisible( bool show )
LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight()); LayoutControls(0, 0, rect.GetWidth(), rect.GetHeight());
} }
bool wxSearchCtrl::GetCancelButtonVisible() const bool wxSearchCtrl::IsCancelButtonVisible() const
{ {
return m_cancelButtonVisible; return m_cancelButtonVisible;
} }

View File

@@ -17,10 +17,6 @@
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "srchctrl.h"
#endif
// For compilers that support precompilation, includes "wx.h". // For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h" #include "wx/wxprec.h"
@@ -71,11 +67,11 @@ public :
} }
// search field options // search field options
virtual void SetSearchButtonVisible( bool show ); virtual void ShowSearchButton( bool show );
virtual bool GetSearchButtonVisible() const; virtual bool IsSearchButtonVisible() const;
virtual void SetCancelButtonVisible( bool show ); virtual void ShowCancelButton( bool show );
virtual bool GetCancelButtonVisible() const; virtual bool IsCancelButtonVisible() const;
virtual void SetSearchMenu( wxMenu* menu ); virtual void SetSearchMenu( wxMenu* menu );
virtual wxMenu* GetSearchMenu() const; virtual wxMenu* GetSearchMenu() const;
@@ -91,8 +87,8 @@ void wxMacSearchFieldControl::CreateControl( wxTextCtrl* /*peer*/, const Rect* b
OptionBits attributes = 0; OptionBits attributes = 0;
if ( UMAGetSystemVersion() >= 0x1040 ) if ( UMAGetSystemVersion() >= 0x1040 )
{ {
attributes = kHISearchFieldAttributesSearchIcon; attributes = kHISearchFieldAttributesSearchIcon;
} }
HIRect hibounds = { { bounds->left, bounds->top }, { bounds->right-bounds->left, bounds->bottom-bounds->top } }; HIRect hibounds = { { bounds->left, bounds->top }, { bounds->right-bounds->left, bounds->bottom-bounds->top } };
verify_noerr( HISearchFieldCreate( verify_noerr( HISearchFieldCreate(
&hibounds, &hibounds,