]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/inphand.h
removed GSocket_[Un]Streamed(), GSocket_SetNonOriented() must be used instead
[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)
65571936 10// Licence: wxWindows licence
1e6feb95
VZ
11///////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_UNIV_INPHAND_H_
14#define _WX_UNIV_INPHAND_H_
15
12028905 16#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
1e6feb95
VZ
17 #pragma interface "inphand.h"
18#endif
19
23645bfa 20#include "wx/univ/inpcons.h" // for wxControlAction(s)
1e6feb95
VZ
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")
71e03035 38#define wxINP_HANDLER_STATUSBAR _T("statusbar")
1e6feb95 39#define wxINP_HANDLER_TEXTCTRL _T("textctrl")
3216dbf5 40#define wxINP_HANDLER_TOOLBAR _T("toolbar")
813edf09 41#define wxINP_HANDLER_TOPLEVEL _T("toplevel")
1e6feb95
VZ
42
43// ----------------------------------------------------------------------------
44// wxInputHandler: maps the events to the actions
45// ----------------------------------------------------------------------------
46
23645bfa 47class WXDLLEXPORT wxInputHandler : public wxObject
1e6feb95
VZ
48{
49public:
50 // map a keyboard event to one or more actions (pressed == TRUE if the key
51 // was pressed, FALSE if released), returns TRUE if something was done
23645bfa 52 virtual bool HandleKey(wxInputConsumer *consumer,
1e6feb95
VZ
53 const wxKeyEvent& event,
54 bool pressed) = 0;
55
56 // map a mouse (click) event to one or more actions
23645bfa 57 virtual bool HandleMouse(wxInputConsumer *consumer,
1e6feb95
VZ
58 const wxMouseEvent& event) = 0;
59
60 // handle mouse movement (or enter/leave) event: it is separated from
61 // HandleMouse() for convenience as many controls don't care about mouse
62 // movements at all
23645bfa 63 virtual bool HandleMouseMove(wxInputConsumer *consumer,
1e6feb95
VZ
64 const wxMouseEvent& event);
65
66 // do something with focus set/kill event: this is different from
67 // HandleMouseMove() as the mouse maybe over the control without it having
68 // focus
69 //
70 // return TRUE to refresh the control, FALSE otherwise
23645bfa 71 virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
1e6feb95
VZ
72
73 // react to the app getting/losing activation
74 //
75 // return TRUE to refresh the control, FALSE otherwise
23645bfa 76 virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
1e6feb95
VZ
77
78 // virtual dtor for any base class
79 virtual ~wxInputHandler();
80};
81
82// ----------------------------------------------------------------------------
83// wxStdInputHandler is just a base class for all other "standard" handlers
84// and also provides the way to chain input handlers together
85// ----------------------------------------------------------------------------
86
87class WXDLLEXPORT wxStdInputHandler : public wxInputHandler
88{
89public:
90 wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { }
91
23645bfa 92 virtual bool HandleKey(wxInputConsumer *consumer,
1e6feb95
VZ
93 const wxKeyEvent& event,
94 bool pressed)
95 {
23645bfa 96 return m_handler ? m_handler->HandleKey(consumer, event, pressed)
1e6feb95
VZ
97 : FALSE;
98 }
99
23645bfa 100 virtual bool HandleMouse(wxInputConsumer *consumer,
1e6feb95
VZ
101 const wxMouseEvent& event)
102 {
23645bfa 103 return m_handler ? m_handler->HandleMouse(consumer, event) : FALSE;
1e6feb95
VZ
104 }
105
23645bfa 106 virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event)
1e6feb95 107 {
23645bfa 108 return m_handler ? m_handler->HandleMouseMove(consumer, event) : FALSE;
1e6feb95
VZ
109 }
110
23645bfa 111 virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event)
1e6feb95 112 {
23645bfa 113 return m_handler ? m_handler->HandleFocus(consumer, event) : FALSE;
1e6feb95
VZ
114 }
115
116private:
117 wxInputHandler *m_handler;
118};
119
120#endif // _WX_UNIV_INPHAND_H_