]>
Commit | Line | Data |
---|---|---|
3f7f284d | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/srchctrl.h |
3f7f284d RD |
3 | // Purpose: wxSearchCtrlBase class |
4 | // Author: Vince Harron | |
3f7f284d | 5 | // Created: 2006-02-18 |
8bc333d7 | 6 | // RCS-ID: $Id$ |
3f7f284d RD |
7 | // Copyright: (c) Vince Harron |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_SEARCHCTRL_H_BASE_ | |
12 | #define _WX_SEARCHCTRL_H_BASE_ | |
13 | ||
14 | #include "wx/defs.h" | |
15 | ||
16 | #if wxUSE_SEARCHCTRL | |
17 | ||
18 | #include "wx/textctrl.h" | |
19 | ||
03647350 | 20 | #if !defined(__WXUNIVERSAL__) && defined(__WXMAC__) |
ec184e32 VZ |
21 | // search control was introduced in Mac OS X 10.3 Panther |
22 | #define wxUSE_NATIVE_SEARCH_CONTROL 1 | |
23 | ||
24 | #define wxSearchCtrlBaseBaseClass wxTextCtrl | |
25 | #else | |
26 | // no native version, use the generic one | |
27 | #define wxUSE_NATIVE_SEARCH_CONTROL 0 | |
28 | ||
e7c9d913 VZ |
29 | #include "wx/containr.h" |
30 | ||
31 | class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass | |
32 | : public wxNavigationEnabled<wxControl>, | |
33 | public wxTextCtrlIface | |
0ec1179b VZ |
34 | { |
35 | }; | |
ec184e32 VZ |
36 | #endif |
37 | ||
3f7f284d RD |
38 | // ---------------------------------------------------------------------------- |
39 | // constants | |
40 | // ---------------------------------------------------------------------------- | |
41 | ||
53a2db12 | 42 | extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[]; |
3f7f284d | 43 | |
9b11752c VZ |
44 | wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, wxCommandEvent); |
45 | wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, wxCommandEvent); | |
3f7f284d RD |
46 | |
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 | // ---------------------------------------------------------------------------- | |
51 | ||
53a2db12 | 52 | class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass |
ec184e32 VZ |
53 | { |
54 | public: | |
55 | wxSearchCtrlBase() { } | |
56 | virtual ~wxSearchCtrlBase() { } | |
57 | ||
cfddeb10 VZ |
58 | // search control |
59 | #if wxUSE_MENUS | |
ec184e32 VZ |
60 | virtual void SetMenu(wxMenu *menu) = 0; |
61 | virtual wxMenu *GetMenu() = 0; | |
cfddeb10 | 62 | #endif // wxUSE_MENUS |
ec184e32 VZ |
63 | |
64 | // get/set options | |
65 | virtual void ShowSearchButton( bool show ) = 0; | |
66 | virtual bool IsSearchButtonVisible() const = 0; | |
3f7f284d | 67 | |
ec184e32 VZ |
68 | virtual void ShowCancelButton( bool show ) = 0; |
69 | virtual bool IsCancelButtonVisible() const = 0; | |
63f7d502 VZ |
70 | |
71 | private: | |
72 | // implement wxTextEntry pure virtual method | |
73 | virtual wxWindow *GetEditableWindow() { return this; } | |
ec184e32 VZ |
74 | }; |
75 | ||
76 | ||
77 | // include the platform-dependent class implementation | |
7a71ffc1 | 78 | #if wxUSE_NATIVE_SEARCH_CONTROL |
3f7f284d | 79 | #if defined(__WXMAC__) |
ef0e9220 | 80 | #include "wx/osx/srchctrl.h" |
3f7f284d RD |
81 | #endif |
82 | #else | |
83 | #include "wx/generic/srchctlg.h" | |
84 | #endif | |
85 | ||
7a71ffc1 | 86 | // ---------------------------------------------------------------------------- |
3f7f284d | 87 | // macros for handling search events |
7a71ffc1 VZ |
88 | // ---------------------------------------------------------------------------- |
89 | ||
c60122bf KO |
90 | #define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \ |
91 | wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn)) | |
3f7f284d | 92 | |
c60122bf KO |
93 | #define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \ |
94 | wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn)) | |
3f7f284d RD |
95 | |
96 | #endif // wxUSE_SEARCHCTRL | |
97 | ||
98 | #endif // _WX_SEARCHCTRL_H_BASE_ |