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