]> git.saurik.com Git - wxWidgets.git/blob - src/univ/inpcons.cpp
replaced by CHANGES.txt
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma implementation "inpcons.h"
18 #endif
19
20 // ----------------------------------------------------------------------------
21 // headers
22 // ----------------------------------------------------------------------------
23
24 #include "wx/wxprec.h"
25
26 #ifdef __BORLANDC__
27 #pragma hdrstop
28 #endif
29
30 #include "wx/univ/renderer.h"
31 #include "wx/univ/inphand.h"
32 #include "wx/univ/theme.h"
33
34 // ============================================================================
35 // implementation
36 // ============================================================================
37
38 wxInputConsumer::wxInputConsumer()
39 {
40 m_inputHandler = NULL;
41 }
42
43 // ----------------------------------------------------------------------------
44 // focus/activation handling
45 // ----------------------------------------------------------------------------
46
47 void wxInputConsumer::OnFocus(wxFocusEvent& event)
48 {
49 if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) )
50 GetInputWindow()->Refresh();
51 else
52 event.Skip();
53 }
54
55 void wxInputConsumer::OnActivate(wxActivateEvent& event)
56 {
57 if ( m_inputHandler && m_inputHandler->HandleActivation(this, event.GetActive()) )
58 GetInputWindow()->Refresh();
59 else
60 event.Skip();
61 }
62
63 // ----------------------------------------------------------------------------
64 // input processing
65 // ----------------------------------------------------------------------------
66
67 void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
68 {
69 m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler);
70 }
71
72 void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
73 {
74 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, TRUE) )
75 event.Skip();
76 }
77
78 void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
79 {
80 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, FALSE) )
81 event.Skip();
82 }
83
84 void wxInputConsumer::OnMouse(wxMouseEvent& event)
85 {
86 if ( m_inputHandler )
87 {
88 if ( event.Moving() || event.Entering() || event.Leaving() )
89 {
90 if ( m_inputHandler->HandleMouseMove(this, event) )
91 return;
92 }
93 else // a click action
94 {
95 if ( m_inputHandler->HandleMouse(this, event) )
96 return;
97 }
98 }
99
100 event.Skip();
101 }
102
103 // ----------------------------------------------------------------------------
104 // the actions
105 // ----------------------------------------------------------------------------
106
107 bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action),
108 long WXUNUSED(numArg),
109 const wxString& WXUNUSED(strArg))
110 {
111 return FALSE;
112 }
113