]> git.saurik.com Git - wxWidgets.git/blob - include/wx/srchctrl.h
addind nonowned window implementation
[wxWidgets.git] / include / wx / srchctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass : public wxControl,
30 public wxTextCtrlIface
31 {
32 };
33 #endif
34
35 // ----------------------------------------------------------------------------
36 // constants
37 // ----------------------------------------------------------------------------
38
39 extern WXDLLEXPORT_DATA(const char) wxSearchCtrlNameStr[];
40
41 extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN;
42 extern WXDLLIMPEXP_CORE const wxEventType wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN;
43
44 // ----------------------------------------------------------------------------
45 // a search ctrl is a text control with a search button and a cancel button
46 // it is based on the MacOSX 10.3 control HISearchFieldCreate
47 // ----------------------------------------------------------------------------
48
49 class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
50 {
51 public:
52 wxSearchCtrlBase() { }
53 virtual ~wxSearchCtrlBase() { }
54
55 // search control
56 #if wxUSE_MENUS
57 virtual void SetMenu(wxMenu *menu) = 0;
58 virtual wxMenu *GetMenu() = 0;
59 #endif // wxUSE_MENUS
60
61 // get/set options
62 virtual void ShowSearchButton( bool show ) = 0;
63 virtual bool IsSearchButtonVisible() const = 0;
64
65 virtual void ShowCancelButton( bool show ) = 0;
66 virtual bool IsCancelButtonVisible() const = 0;
67 };
68
69
70 // include the platform-dependent class implementation
71 #if wxUSE_NATIVE_SEARCH_CONTROL
72 #if defined(__WXMAC__)
73 #include "wx/mac/srchctrl.h"
74 #endif
75 #else
76 #include "wx/generic/srchctlg.h"
77 #endif
78
79 // ----------------------------------------------------------------------------
80 // macros for handling search events
81 // ----------------------------------------------------------------------------
82
83 #define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
84 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
85
86 #define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
87 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
88
89 #endif // wxUSE_SEARCHCTRL
90
91 #endif // _WX_SEARCHCTRL_H_BASE_