]> git.saurik.com Git - wxWidgets.git/blame - include/wx/srchctrl.h
Only link with libwxscintilla if using Scintilla is enabled.
[wxWidgets.git] / include / wx / srchctrl.h
CommitLineData
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
35368572 29 #include "wx/compositewin.h"
e7c9d913
VZ
30 #include "wx/containr.h"
31
32 class WXDLLIMPEXP_CORE wxSearchCtrlBaseBaseClass
35368572 33 : public wxCompositeWindow< wxNavigationEnabled<wxControl> >,
e7c9d913 34 public wxTextCtrlIface
0ec1179b
VZ
35 {
36 };
ec184e32
VZ
37#endif
38
3f7f284d
RD
39// ----------------------------------------------------------------------------
40// constants
41// ----------------------------------------------------------------------------
42
53a2db12 43extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[];
3f7f284d 44
ce7fe42e
VZ
45wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCHCTRL_CANCEL_BTN, wxCommandEvent);
46wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_SEARCHCTRL_SEARCH_BTN, wxCommandEvent);
3f7f284d
RD
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
53a2db12 53class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
ec184e32
VZ
54{
55public:
56 wxSearchCtrlBase() { }
57 virtual ~wxSearchCtrlBase() { }
58
cfddeb10
VZ
59 // search control
60#if wxUSE_MENUS
ec184e32
VZ
61 virtual void SetMenu(wxMenu *menu) = 0;
62 virtual wxMenu *GetMenu() = 0;
cfddeb10 63#endif // wxUSE_MENUS
ec184e32
VZ
64
65 // get/set options
66 virtual void ShowSearchButton( bool show ) = 0;
67 virtual bool IsSearchButtonVisible() const = 0;
3f7f284d 68
ec184e32
VZ
69 virtual void ShowCancelButton( bool show ) = 0;
70 virtual bool IsCancelButtonVisible() const = 0;
63f7d502
VZ
71
72private:
73 // implement wxTextEntry pure virtual method
74 virtual wxWindow *GetEditableWindow() { return this; }
ec184e32
VZ
75};
76
77
78// include the platform-dependent class implementation
7a71ffc1 79#if wxUSE_NATIVE_SEARCH_CONTROL
3f7f284d 80 #if defined(__WXMAC__)
ef0e9220 81 #include "wx/osx/srchctrl.h"
3f7f284d
RD
82 #endif
83#else
84 #include "wx/generic/srchctlg.h"
85#endif
86
7a71ffc1 87// ----------------------------------------------------------------------------
3f7f284d 88// macros for handling search events
7a71ffc1
VZ
89// ----------------------------------------------------------------------------
90
c60122bf 91#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
ce7fe42e 92 wx__DECLARE_EVT1(wxEVT_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
3f7f284d 93
c60122bf 94#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
ce7fe42e
VZ
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
3f7f284d
RD
100
101#endif // wxUSE_SEARCHCTRL
102
103#endif // _WX_SEARCHCTRL_H_BASE_