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/compositewin.h"
30 #include "wx/containr.h"
32 class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
33 : public wxCompositeWindow
< wxNavigationEnabled
<wxControl
> >,
34 public wxTextCtrlIface
39 // ----------------------------------------------------------------------------
41 // ----------------------------------------------------------------------------
43 extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr
[];
45 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN
, wxCommandEvent
);
46 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE
, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN
, wxCommandEvent
);
48 // ----------------------------------------------------------------------------
49 // a search ctrl is a text control with a search button and a cancel button
50 // it is based on the MacOSX 10.3 control HISearchFieldCreate
51 // ----------------------------------------------------------------------------
53 class WXDLLIMPEXP_CORE wxSearchCtrlBase
: public wxSearchCtrlBaseBaseClass
56 wxSearchCtrlBase() { }
57 virtual ~wxSearchCtrlBase() { }
61 virtual void SetMenu(wxMenu
*menu
) = 0;
62 virtual wxMenu
*GetMenu() = 0;
66 virtual void ShowSearchButton( bool show
) = 0;
67 virtual bool IsSearchButtonVisible() const = 0;
69 virtual void ShowCancelButton( bool show
) = 0;
70 virtual bool IsCancelButtonVisible() const = 0;
73 // implement wxTextEntry pure virtual method
74 virtual wxWindow
*GetEditableWindow() { return this; }
78 // include the platform-dependent class implementation
79 #if wxUSE_NATIVE_SEARCH_CONTROL
80 #if defined(__WXMAC__)
81 #include "wx/osx/srchctrl.h"
84 #include "wx/generic/srchctlg.h"
87 // ----------------------------------------------------------------------------
88 // macros for handling search events
89 // ----------------------------------------------------------------------------
91 #define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
92 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
94 #define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
95 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
97 #endif // wxUSE_SEARCHCTRL
99 #endif // _WX_SEARCHCTRL_H_BASE_