]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/inphand.h
made some wxHtmlEntitiesParser's methods public -- turned out they are useful
[wxWidgets.git] / include / wx / univ / inphand.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/inphand.h
3// Purpose: wxInputHandler class maps the keyboard and mouse events to the
4// actions which then are performed by the control
5// Author: Vadim Zeitlin
6// Modified by:
7// Created: 18.08.00
8// RCS-ID: $Id$
442b35b5 9// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
1e6feb95
VZ
10// Licence: wxWindows license
11///////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_UNIV_INPHAND_H_
14#define _WX_UNIV_INPHAND_H_
15
16#ifdef __GNUG__
17 #pragma interface "inphand.h"
18#endif
19
20#include "wx/control.h" // for wxControlAction(s)
21
22// ----------------------------------------------------------------------------
23// types of the standard input handlers which can be passed to
24// wxTheme::GetInputHandler()
25// ----------------------------------------------------------------------------
26
27#define wxINP_HANDLER_DEFAULT _T("")
28#define wxINP_HANDLER_BUTTON _T("button")
29#define wxINP_HANDLER_CHECKBOX _T("checkbox")
30#define wxINP_HANDLER_CHECKLISTBOX _T("checklistbox")
31#define wxINP_HANDLER_COMBOBOX _T("combobox")
32#define wxINP_HANDLER_LISTBOX _T("listbox")
33#define wxINP_HANDLER_NOTEBOOK _T("notebook")
34#define wxINP_HANDLER_RADIOBTN _T("radiobtn")
35#define wxINP_HANDLER_SCROLLBAR _T("scrollbar")
36#define wxINP_HANDLER_SLIDER _T("slider")
37#define wxINP_HANDLER_SPINBTN _T("spinbtn")
38#define wxINP_HANDLER_TEXTCTRL _T("textctrl")
39
40// ----------------------------------------------------------------------------
41// wxInputHandler: maps the events to the actions
42// ----------------------------------------------------------------------------
43
44class WXDLLEXPORT wxInputHandler
45{
46public:
47 // map a keyboard event to one or more actions (pressed == TRUE if the key
48 // was pressed, FALSE if released), returns TRUE if something was done
49 virtual bool HandleKey(wxControl *control,
50 const wxKeyEvent& event,
51 bool pressed) = 0;
52
53 // map a mouse (click) event to one or more actions
54 virtual bool HandleMouse(wxControl *control,
55 const wxMouseEvent& event) = 0;
56
57 // handle mouse movement (or enter/leave) event: it is separated from
58 // HandleMouse() for convenience as many controls don't care about mouse
59 // movements at all
60 virtual bool HandleMouseMove(wxControl *control,
61 const wxMouseEvent& event);
62
63 // do something with focus set/kill event: this is different from
64 // HandleMouseMove() as the mouse maybe over the control without it having
65 // focus
66 //
67 // return TRUE to refresh the control, FALSE otherwise
68 virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
69
70 // react to the app getting/losing activation
71 //
72 // return TRUE to refresh the control, FALSE otherwise
73 virtual bool HandleActivation(wxControl *control, bool activated);
74
75 // virtual dtor for any base class
76 virtual ~wxInputHandler();
77};
78
79// ----------------------------------------------------------------------------
80// wxStdInputHandler is just a base class for all other "standard" handlers
81// and also provides the way to chain input handlers together
82// ----------------------------------------------------------------------------
83
84class WXDLLEXPORT wxStdInputHandler : public wxInputHandler
85{
86public:
87 wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { }
88
89 virtual bool HandleKey(wxControl *control,
90 const wxKeyEvent& event,
91 bool pressed)
92 {
93 return m_handler ? m_handler->HandleKey(control, event, pressed)
94 : FALSE;
95 }
96
97 virtual bool HandleMouse(wxControl *control,
98 const wxMouseEvent& event)
99 {
100 return m_handler ? m_handler->HandleMouse(control, event) : FALSE;
101 }
102
103 virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event)
104 {
105 return m_handler ? m_handler->HandleMouseMove(control, event) : FALSE;
106 }
107
108 virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event)
109 {
110 return m_handler ? m_handler->HandleFocus(control, event) : FALSE;
111 }
112
113private:
114 wxInputHandler *m_handler;
115};
116
117#endif // _WX_UNIV_INPHAND_H_