]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/inphand.h
added length argument to wxString::wxString(wchar_t*), just like in case of wxChar...
[wxWidgets.git] / include / wx / univ / inphand.h
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$
9 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
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/univ/inpcons.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_STATUSBAR _T("statusbar")
39 #define wxINP_HANDLER_TEXTCTRL _T("textctrl")
40 #define wxINP_HANDLER_TOPLEVEL _T("toplevel")
41
42 // ----------------------------------------------------------------------------
43 // wxInputHandler: maps the events to the actions
44 // ----------------------------------------------------------------------------
45
46 class WXDLLEXPORT wxInputHandler : public wxObject
47 {
48 public:
49 // map a keyboard event to one or more actions (pressed == TRUE if the key
50 // was pressed, FALSE if released), returns TRUE if something was done
51 virtual bool HandleKey(wxInputConsumer *consumer,
52 const wxKeyEvent& event,
53 bool pressed) = 0;
54
55 // map a mouse (click) event to one or more actions
56 virtual bool HandleMouse(wxInputConsumer *consumer,
57 const wxMouseEvent& event) = 0;
58
59 // handle mouse movement (or enter/leave) event: it is separated from
60 // HandleMouse() for convenience as many controls don't care about mouse
61 // movements at all
62 virtual bool HandleMouseMove(wxInputConsumer *consumer,
63 const wxMouseEvent& event);
64
65 // do something with focus set/kill event: this is different from
66 // HandleMouseMove() as the mouse maybe over the control without it having
67 // focus
68 //
69 // return TRUE to refresh the control, FALSE otherwise
70 virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
71
72 // react to the app getting/losing activation
73 //
74 // return TRUE to refresh the control, FALSE otherwise
75 virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
76
77 // virtual dtor for any base class
78 virtual ~wxInputHandler();
79 };
80
81 // ----------------------------------------------------------------------------
82 // wxStdInputHandler is just a base class for all other "standard" handlers
83 // and also provides the way to chain input handlers together
84 // ----------------------------------------------------------------------------
85
86 class WXDLLEXPORT wxStdInputHandler : public wxInputHandler
87 {
88 public:
89 wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { }
90
91 virtual bool HandleKey(wxInputConsumer *consumer,
92 const wxKeyEvent& event,
93 bool pressed)
94 {
95 return m_handler ? m_handler->HandleKey(consumer, event, pressed)
96 : FALSE;
97 }
98
99 virtual bool HandleMouse(wxInputConsumer *consumer,
100 const wxMouseEvent& event)
101 {
102 return m_handler ? m_handler->HandleMouse(consumer, event) : FALSE;
103 }
104
105 virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event)
106 {
107 return m_handler ? m_handler->HandleMouseMove(consumer, event) : FALSE;
108 }
109
110 virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event)
111 {
112 return m_handler ? m_handler->HandleFocus(consumer, event) : FALSE;
113 }
114
115 private:
116 wxInputHandler *m_handler;
117 };
118
119 #endif // _WX_UNIV_INPHAND_H_