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