1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSearchCtrlBase class
4 // Author: Vince Harron
8 // Copyright: (c) Vince Harron
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_SEARCHCTRL_H_BASE_
13 #define _WX_SEARCHCTRL_H_BASE_
19 #include "wx/textctrl.h"
21 #if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) && defined(__WXMAC_OSX__) \
22 && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3)
23 // search control was introduced in Mac OS X 10.3 Panther
24 #define wxUSE_NATIVE_SEARCH_CONTROL 1
26 #define wxSearchCtrlBaseBaseClass wxTextCtrl
28 // no native version, use the generic one
29 #define wxUSE_NATIVE_SEARCH_CONTROL 0
31 #define wxSearchCtrlBaseBaseClass wxTextCtrlBase
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 extern WXDLLEXPORT_DATA(const wxChar
) wxSearchCtrlNameStr
[];
40 BEGIN_DECLARE_EVENT_TYPES()
41 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL
, 1119)
42 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH
, 1120)
43 END_DECLARE_EVENT_TYPES()
45 // ----------------------------------------------------------------------------
46 // a search ctrl is a text control with a search button and a cancel button
47 // it is based on the MacOSX 10.3 control HISearchFieldCreate
48 // ----------------------------------------------------------------------------
50 class WXDLLEXPORT wxSearchCtrlBase
: public wxSearchCtrlBaseBaseClass
53 wxSearchCtrlBase() { }
54 virtual ~wxSearchCtrlBase() { }
57 virtual void SetMenu(wxMenu
*menu
) = 0;
58 virtual wxMenu
*GetMenu() = 0;
61 virtual void ShowSearchButton( bool show
) = 0;
62 virtual bool IsSearchButtonVisible() const = 0;
64 virtual void ShowCancelButton( bool show
) = 0;
65 virtual bool IsCancelButtonVisible() const = 0;
69 // include the platform-dependent class implementation
70 #if wxUSE_NATIVE_SEARCH_CONTROL
71 #if defined(__WXMAC__)
72 #include "wx/mac/srchctrl.h"
75 #include "wx/generic/srchctlg.h"
78 // ----------------------------------------------------------------------------
79 // macros for handling search events
80 // ----------------------------------------------------------------------------
82 #define EVT_SEARCHCTRL_CANCEL(id, fn) \
83 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL, id, wxCommandEventHandler(fn))
85 #define EVT_SEARCHCTRL_SEARCH(id, fn) \
86 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH, id, wxCommandEventHandler(fn))
88 #endif // wxUSE_SEARCHCTRL
90 #endif // _WX_SEARCHCTRL_H_BASE_