]> git.saurik.com Git - wxWidgets.git/blob - include/wx/srchctrl.h
Define WXBUILDING in Xcode projects.
[wxWidgets.git] / include / wx / srchctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/srchctrl.h
3 // Purpose: wxSearchCtrlBase class
4 // Author: Vince Harron
5 // Created: 2006-02-18
6 // RCS-ID: $Id$
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
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
23
24 #define wxSearchCtrlBaseBaseClass wxTextCtrl
25 #else
26 // no native version, use the generic one
27 #define wxUSE_NATIVE_SEARCH_CONTROL 0
28
29 #include "wx/compositewin.h"
30 #include "wx/containr.h"
31
32 class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
33 : public wxCompositeWindow< wxNavigationEnabled<wxControl> >,
34 public wxTextCtrlIface
35 {
36 };
37 #endif
38
39 // ----------------------------------------------------------------------------
40 // constants
41 // ----------------------------------------------------------------------------
42
43 extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[];
44
45 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCHCTRL_CANCEL_BTN, wxCommandEvent);
46 wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCHCTRL_SEARCH_BTN, wxCommandEvent);
47
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 // ----------------------------------------------------------------------------
52
53 class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
54 {
55 public:
56 wxSearchCtrlBase() { }
57 virtual ~wxSearchCtrlBase() { }
58
59 // search control
60 #if wxUSE_MENUS
61 virtual void SetMenu(wxMenu *menu) = 0;
62 virtual wxMenu *GetMenu() = 0;
63 #endif // wxUSE_MENUS
64
65 // get/set options
66 virtual void ShowSearchButton( bool show ) = 0;
67 virtual bool IsSearchButtonVisible() const = 0;
68
69 virtual void ShowCancelButton( bool show ) = 0;
70 virtual bool IsCancelButtonVisible() const = 0;
71
72 private:
73 // implement wxTextEntry pure virtual method
74 virtual wxWindow *GetEditableWindow() { return this; }
75 };
76
77
78 // include the platform-dependent class implementation
79 #if wxUSE_NATIVE_SEARCH_CONTROL
80 #if defined(__WXMAC__)
81 #include "wx/osx/srchctrl.h"
82 #endif
83 #else
84 #include "wx/generic/srchctlg.h"
85 #endif
86
87 // ----------------------------------------------------------------------------
88 // macros for handling search events
89 // ----------------------------------------------------------------------------
90
91 #define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
92 wx__DECLARE_EVT1(wxEVT_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
93
94 #define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
95 wx__DECLARE_EVT1(wxEVT_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
96
97 // old wxEVT_COMMAND_* constants
98 #define wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN wxEVT_SEARCHCTRL_CANCEL_BTN
99 #define wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN wxEVT_SEARCHCTRL_SEARCH_BTN
100
101 #endif // wxUSE_SEARCHCTRL
102
103 #endif // _WX_SEARCHCTRL_H_BASE_