]> git.saurik.com Git - wxWidgets.git/blob - src/univ/inpcons.cpp
make sure we are feeding coordinates of HIView instances, not wx-dimensions back...
[wxWidgets.git] / src / univ / inpcons.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/inpcons.cpp
3 // Purpose: wxInputConsumer: mix-in class for input handling
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 14.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #include "wx/univ/renderer.h"
27 #include "wx/univ/inphand.h"
28 #include "wx/univ/theme.h"
29
30 // ============================================================================
31 // implementation
32 // ============================================================================
33
34 // ----------------------------------------------------------------------------
35 // focus/activation handling
36 // ----------------------------------------------------------------------------
37
38 void wxInputConsumer::OnFocus(wxFocusEvent& event)
39 {
40 if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) )
41 GetInputWindow()->Refresh();
42 else
43 event.Skip();
44 }
45
46 void wxInputConsumer::OnActivate(wxActivateEvent& event)
47 {
48 if ( m_inputHandler && m_inputHandler->HandleActivation(this, event.GetActive()) )
49 GetInputWindow()->Refresh();
50 else
51 event.Skip();
52 }
53
54 // ----------------------------------------------------------------------------
55 // input processing
56 // ----------------------------------------------------------------------------
57
58 void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
59 {
60 m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler);
61 }
62
63 void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
64 {
65 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, true) )
66 event.Skip();
67 }
68
69 void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
70 {
71 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, false) )
72 event.Skip();
73 }
74
75 void wxInputConsumer::OnMouse(wxMouseEvent& event)
76 {
77 if ( m_inputHandler )
78 {
79 if ( event.Moving() || event.Dragging() ||
80 event.Entering() || event.Leaving() )
81 {
82 if ( m_inputHandler->HandleMouseMove(this, event) )
83 return;
84 }
85 else // a click action
86 {
87 if ( m_inputHandler->HandleMouse(this, event) )
88 return;
89 }
90 }
91
92 event.Skip();
93 }
94
95 // ----------------------------------------------------------------------------
96 // the actions
97 // ----------------------------------------------------------------------------
98
99 bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action),
100 long WXUNUSED(numArg),
101 const wxString& WXUNUSED(strArg))
102 {
103 return false;
104 }
105