]>
Commit | Line | Data |
---|---|---|
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 | ||
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 | ||
9467bdb7 VZ |
58 | wxInputHandler * |
59 | wxInputConsumer::DoGetStdInputHandler(wxInputHandler * WXUNUSED(handlerDef)) | |
60 | { | |
61 | return NULL; | |
62 | } | |
63 | ||
23645bfa VS |
64 | void wxInputConsumer::CreateInputHandler(const wxString& inphandler) |
65 | { | |
9467bdb7 | 66 | m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler, this); |
23645bfa VS |
67 | } |
68 | ||
69 | void wxInputConsumer::OnKeyDown(wxKeyEvent& event) | |
70 | { | |
a290fa5a | 71 | if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, true) ) |
23645bfa VS |
72 | event.Skip(); |
73 | } | |
74 | ||
75 | void wxInputConsumer::OnKeyUp(wxKeyEvent& event) | |
76 | { | |
a290fa5a | 77 | if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, false) ) |
23645bfa VS |
78 | event.Skip(); |
79 | } | |
80 | ||
81 | void wxInputConsumer::OnMouse(wxMouseEvent& event) | |
82 | { | |
83 | if ( m_inputHandler ) | |
84 | { | |
ca1ecff4 VZ |
85 | if ( event.Moving() || event.Dragging() || |
86 | event.Entering() || event.Leaving() ) | |
23645bfa VS |
87 | { |
88 | if ( m_inputHandler->HandleMouseMove(this, event) ) | |
89 | return; | |
90 | } | |
91 | else // a click action | |
92 | { | |
93 | if ( m_inputHandler->HandleMouse(this, event) ) | |
94 | return; | |
95 | } | |
96 | } | |
97 | ||
98 | event.Skip(); | |
99 | } | |
100 | ||
101 | // ---------------------------------------------------------------------------- | |
102 | // the actions | |
103 | // ---------------------------------------------------------------------------- | |
104 | ||
61fef19b VZ |
105 | bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action), |
106 | long WXUNUSED(numArg), | |
107 | const wxString& WXUNUSED(strArg)) | |
23645bfa | 108 | { |
a290fa5a | 109 | return false; |
23645bfa VS |
110 | } |
111 |