]> git.saurik.com Git - wxWidgets.git/blame - include/wx/srchctrl.h
Always define SIZEOF_WCHAR_T if it's not defined under Windows.
[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
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
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
53a2db12 39extern WXDLLIMPEXP_DATA_CORE(const char) wxSearchCtrlNameStr[];
3f7f284d 40
9b11752c
VZ
41wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, wxCommandEvent);
42wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CORE, wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, wxCommandEvent);
3f7f284d
RD
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
53a2db12 49class WXDLLIMPEXP_CORE wxSearchCtrlBase : public wxSearchCtrlBaseBaseClass
ec184e32
VZ
50{
51public:
52 wxSearchCtrlBase() { }
53 virtual ~wxSearchCtrlBase() { }
54
cfddeb10
VZ
55 // search control
56#if wxUSE_MENUS
ec184e32
VZ
57 virtual void SetMenu(wxMenu *menu) = 0;
58 virtual wxMenu *GetMenu() = 0;
cfddeb10 59#endif // wxUSE_MENUS
ec184e32
VZ
60
61 // get/set options
62 virtual void ShowSearchButton( bool show ) = 0;
63 virtual bool IsSearchButtonVisible() const = 0;
3f7f284d 64
ec184e32
VZ
65 virtual void ShowCancelButton( bool show ) = 0;
66 virtual bool IsCancelButtonVisible() const = 0;
63f7d502
VZ
67
68private:
69 // implement wxTextEntry pure virtual method
70 virtual wxWindow *GetEditableWindow() { return this; }
ec184e32
VZ
71};
72
73
74// include the platform-dependent class implementation
7a71ffc1 75#if wxUSE_NATIVE_SEARCH_CONTROL
3f7f284d 76 #if defined(__WXMAC__)
ef0e9220 77 #include "wx/osx/srchctrl.h"
3f7f284d
RD
78 #endif
79#else
80 #include "wx/generic/srchctlg.h"
81#endif
82
7a71ffc1 83// ----------------------------------------------------------------------------
3f7f284d 84// macros for handling search events
7a71ffc1
VZ
85// ----------------------------------------------------------------------------
86
c60122bf
KO
87#define EVT_SEARCHCTRL_CANCEL_BTN(id, fn) \
88 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_CANCEL_BTN, id, wxCommandEventHandler(fn))
3f7f284d 89
c60122bf
KO
90#define EVT_SEARCHCTRL_SEARCH_BTN(id, fn) \
91 wx__DECLARE_EVT1(wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN, id, wxCommandEventHandler(fn))
3f7f284d
RD
92
93#endif // wxUSE_SEARCHCTRL
94
95#endif // _WX_SEARCHCTRL_H_BASE_