]> git.saurik.com Git - wxWidgets.git/blame - src/univ/inpcons.cpp
Committing in .
[wxWidgets.git] / src / univ / inpcons.cpp
CommitLineData
23645bfa
VS
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)
65571936 9// Licence: wxWindows licence
23645bfa
VS
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
23645bfa
VS
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
38void wxInputConsumer::OnFocus(wxFocusEvent& event)
39{
40 if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) )
41 GetInputWindow()->Refresh();
42 else
43 event.Skip();
44}
45
46void 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
58void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
59{
60 m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler);
61}
62
63void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
64{
a290fa5a 65 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, true) )
23645bfa
VS
66 event.Skip();
67}
68
69void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
70{
a290fa5a 71 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, false) )
23645bfa
VS
72 event.Skip();
73}
74
75void wxInputConsumer::OnMouse(wxMouseEvent& event)
76{
77 if ( m_inputHandler )
78 {
ca1ecff4
VZ
79 if ( event.Moving() || event.Dragging() ||
80 event.Entering() || event.Leaving() )
23645bfa
VS
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
61fef19b
VZ
99bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action),
100 long WXUNUSED(numArg),
101 const wxString& WXUNUSED(strArg))
23645bfa 102{
a290fa5a 103 return false;
23645bfa
VS
104}
105