1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSearchCtrlBase class
4 // Author: Vince Harron
7 // Copyright: (c) Vince Harron
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_SEARCHCTRL_H_BASE_
12 #define _WX_SEARCHCTRL_H_BASE_
18 #include "wx/textctrl.h"
20 #if !defined(__WXUNIVERSAL__) && defined(__WXMAC__)
21 // search control was introduced in Mac OS X 10.3 Panther
22 #define wxUSE_NATIVE_SEARCH_CONTROL 1
24 #define wxSearchCtrlBaseBaseClass wxTextCtrl
26 // no native version, use the generic one
27 #define wxUSE_NATIVE_SEARCH_CONTROL 0
29 class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
: public wxControl
,
30 public wxTextCtrlIface
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr
[];
41 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN
;
42 extern WXDLLIMPEXP_CORE
const wxEventType wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN
;
44 // ----------------------------------------------------------------------------
45 // a search ctrl is a text control with a search button and a cancel button
46 // it is based on the MacOSX 10.3 control HISearchFieldCreate
47 // ----------------------------------------------------------------------------
49 class WXDLLIMPEXP_CORE wxSearchCtrlBase
: public wxSearchCtrlBaseBaseClass
52 wxSearchCtrlBase() { }
53 virtual ~wxSearchCtrlBase() { }
57 virtual void SetMenu(wxMenu
*menu
) = 0;
58 virtual wxMenu
*GetMenu() = 0;
62 virtual void ShowSearchButton( bool show
) = 0;
63 virtual bool IsSearchButtonVisible() const = 0;
65 virtual void ShowCancelButton( bool show
) = 0;
66 virtual bool IsCancelButtonVisible() const = 0;
70 // include the platform-dependent class implementation
71 #if wxUSE_NATIVE_SEARCH_CONTROL
72 #if defined(__WXMAC__)
73 #include "wx/osx/srchctrl.h"
76 #include "wx/generic/srchctlg.h"
79 // ----------------------------------------------------------------------------
80 // macros for handling search events
81 // ----------------------------------------------------------------------------
83 #define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
84 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
86 #define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
87 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
89 #endif // wxUSE_SEARCHCTRL
91 #endif // _WX_SEARCHCTRL_H_BASE_