]> git.saurik.com Git - wxWidgets.git/blob - src/univ/inpcons.cpp
many improvements/bug fixes to media control: new wxEVT_MEDIA_LOADED event, new metho...
[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 // ----------------------------------------------------------------------------
39 // focus/activation handling
40 // ----------------------------------------------------------------------------
41
42 void wxInputConsumer::OnFocus(wxFocusEvent& event)
43 {
44 if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) )
45 GetInputWindow()->Refresh();
46 else
47 event.Skip();
48 }
49
50 void wxInputConsumer::OnActivate(wxActivateEvent& event)
51 {
52 if ( m_inputHandler && m_inputHandler->HandleActivation(this, event.GetActive()) )
53 GetInputWindow()->Refresh();
54 else
55 event.Skip();
56 }
57
58 // ----------------------------------------------------------------------------
59 // input processing
60 // ----------------------------------------------------------------------------
61
62 void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
63 {
64 m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler);
65 }
66
67 void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
68 {
69 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, true) )
70 event.Skip();
71 }
72
73 void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
74 {
75 if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, false) )
76 event.Skip();
77 }
78
79 void wxInputConsumer::OnMouse(wxMouseEvent& event)
80 {
81 if ( m_inputHandler )
82 {
83 if ( event.Moving() || event.Dragging() ||
84 event.Entering() || event.Leaving() )
85 {
86 if ( m_inputHandler->HandleMouseMove(this, event) )
87 return;
88 }
89 else // a click action
90 {
91 if ( m_inputHandler->HandleMouse(this, event) )
92 return;
93 }
94 }
95
96 event.Skip();
97 }
98
99 // ----------------------------------------------------------------------------
100 // the actions
101 // ----------------------------------------------------------------------------
102
103 bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action),
104 long WXUNUSED(numArg),
105 const wxString& WXUNUSED(strArg))
106 {
107 return false;
108 }
109