]> git.saurik.com Git - wxWidgets.git/blame - include/wx/srchctrl.h
added wx prefix to wxUSE_NATIVE_SEARCH_CONTROL
[wxWidgets.git] / include / wx / srchctrl.h
CommitLineData
3f7f284d
RD
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
ec184e32
VZ
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
3f7f284d
RD
34// ----------------------------------------------------------------------------
35// constants
36// ----------------------------------------------------------------------------
37
38extern WXDLLEXPORT_DATA(const wxChar) wxSearchCtrlNameStr[];
39
40BEGIN_DECLARE_EVENT_TYPES()
41 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_CANCEL, 1119)
42 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SEARCHCTRL_SEARCH, 1120)
43END_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
ec184e32
VZ
50class WXDLLEXPORT wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
51{
52public:
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;
3f7f284d 63
ec184e32
VZ
64 virtual void ShowCancelButton( bool show ) = 0;
65 virtual bool IsCancelButtonVisible() const = 0;
66};
67
68
69// include the platform-dependent class implementation
7a71ffc1 70#if wxUSE_NATIVE_SEARCH_CONTROL
3f7f284d
RD
71 #if defined(__WXMAC__)
72 #include "wx/mac/srchctrl.h"
73 #endif
74#else
75 #include "wx/generic/srchctlg.h"
76#endif
77
7a71ffc1 78// ----------------------------------------------------------------------------
3f7f284d 79// macros for handling search events
7a71ffc1
VZ
80// ----------------------------------------------------------------------------
81
3f7f284d
RD
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_