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 #include "wx/containr.h"
31 class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
32 : public wxNavigationEnabled
<wxControl
>,
33 public wxTextCtrlIface
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr
[];
44 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN
, wxCommandEvent
);
45 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN
, wxCommandEvent
);
47 // ----------------------------------------------------------------------------
48 // a search ctrl is a text control with a search button and a cancel button
49 // it is based on the MacOSX 10.3 control HISearchFieldCreate
50 // ----------------------------------------------------------------------------
52 class WXDLLIMPEXP_CORE wxSearchCtrlBase
: public wxSearchCtrlBaseBaseClass
55 wxSearchCtrlBase() { }
56 virtual ~wxSearchCtrlBase() { }
60 virtual void SetMenu(wxMenu
*menu
) = 0;
61 virtual wxMenu
*GetMenu() = 0;
65 virtual void ShowSearchButton( bool show
) = 0;
66 virtual bool IsSearchButtonVisible() const = 0;
68 virtual void ShowCancelButton( bool show
) = 0;
69 virtual bool IsCancelButtonVisible() const = 0;
72 // implement wxTextEntry pure virtual method
73 virtual wxWindow
*GetEditableWindow() { return this; }
77 // include the platform-dependent class implementation
78 #if wxUSE_NATIVE_SEARCH_CONTROL
79 #if defined(__WXMAC__)
80 #include "wx/osx/srchctrl.h"
83 #include "wx/generic/srchctlg.h"
86 // ----------------------------------------------------------------------------
87 // macros for handling search events
88 // ----------------------------------------------------------------------------
90 #define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
91 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
93 #define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
94 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
96 #endif // wxUSE_SEARCHCTRL
98 #endif // _WX_SEARCHCTRL_H_BASE_