1. Renamed Set/GetXXXVisible() to ShowXXX() and IsXXXVisible()
[wxWidgets.git] / include / wx / srchctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: srchctrl.h
3 // Purpose: wxSearchCtrlBase class
4 // Author: Vince Harron
5 // Modified by:
6 // Created: 2006-02-18
7 // RCS-ID:
8 // Copyright: (c) Vince Harron
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_SEARCHCTRL_H_BASE_
13 #define _WX_SEARCHCTRL_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_SEARCHCTRL
18
19 #include "wx/textctrl.h"
20
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
25
26 #define wxSearchCtrlBaseBaseClass wxTextCtrl
27 #else
28 // no native version, use the generic one
29 #define wxUSE_NATIVE_SEARCH_CONTROL 0
30
31 #define wxSearchCtrlBaseBaseClass wxTextCtrlBase
32 #endif
33
34 // ----------------------------------------------------------------------------
35 // constants
36 // ----------------------------------------------------------------------------
37
38 extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[];
39
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()
44
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 // ----------------------------------------------------------------------------
49
50 class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
51 {
52 public:
53 wxSearchCtrlBase() { }
54 virtual ~wxSearchCtrlBase() { }
55
56 // search control
57 virtual void SetMenu(wxMenu *menu) = 0;
58 virtual wxMenu *GetMenu() = 0;
59
60 // get/set options
61 virtual void ShowSearchButton( bool show ) = 0;
62 virtual bool IsSearchButtonVisible() const = 0;
63
64 virtual void ShowCancelButton( bool show ) = 0;
65 virtual bool IsCancelButtonVisible() const = 0;
66 };
67
68
69 // include the platform-dependent class implementation
70 #if wxUSE_NATIVE_SEARCH_CONTROL
71 #if defined(__WXMAC__)
72 #include "wx/mac/srchctrl.h"
73 #endif
74 #else
75 #include "wx/generic/srchctlg.h"
76 #endif
77
78 // ----------------------------------------------------------------------------
79 // macros for handling search events
80 // ----------------------------------------------------------------------------
81
82 #define EVT_SEARCHCTRL_CANCEL(id, fn) \
83 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL, id, wxCommandEventHandler(fn))
84
85 #define EVT_SEARCHCTRL_SEARCH(id, fn) \
86 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH, id, wxCommandEventHandler(fn))
87
88 #endif // wxUSE_SEARCHCTRL
89
90 #endif // _WX_SEARCHCTRL_H_BASE_