]>
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 | |
23645bfa | 7 | // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) |
65571936 | 8 | // Licence: wxWindows licence |
23645bfa VS |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | // ============================================================================ | |
12 | // declarations | |
13 | // ============================================================================ | |
14 | ||
23645bfa VS |
15 | // ---------------------------------------------------------------------------- |
16 | // headers | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | #include "wx/wxprec.h" | |
20 | ||
21 | #ifdef __BORLANDC__ | |
22 | #pragma hdrstop | |
23 | #endif | |
24 | ||
83c5d35f WS |
25 | #ifndef WX_PRECOMP |
26 | #include "wx/window.h" | |
27 | #endif // WX_PRECOMP | |
28 | ||
23645bfa VS |
29 | #include "wx/univ/renderer.h" |
30 | #include "wx/univ/inphand.h" | |
31 | #include "wx/univ/theme.h" | |
32 | ||
33 | // ============================================================================ | |
34 | // implementation | |
35 | // ============================================================================ | |
36 | ||
37 | // ---------------------------------------------------------------------------- | |
38 | // focus/activation handling | |
39 | // ---------------------------------------------------------------------------- | |
40 | ||
41 | void wxInputConsumer::OnFocus(wxFocusEvent& event) | |
42 | { | |
43 | if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) ) | |
44 | GetInputWindow()->Refresh(); | |
45 | else | |
46 | event.Skip(); | |
47 | } | |
48 | ||
49 | void wxInputConsumer::OnActivate(wxActivateEvent& event) | |
50 | { | |
51 | if ( m_inputHandler && m_inputHandler->HandleActivation(this, event.GetActive()) ) | |
52 | GetInputWindow()->Refresh(); | |
53 | else | |
54 | event.Skip(); | |
55 | } | |
56 | ||
57 | // ---------------------------------------------------------------------------- | |
58 | // input processing | |
59 | // ---------------------------------------------------------------------------- | |
60 | ||
9467bdb7 VZ |
61 | wxInputHandler * |
62 | wxInputConsumer::DoGetStdInputHandler(wxInputHandler * WXUNUSED(handlerDef)) | |
63 | { | |
64 | return NULL; | |
65 | } | |
66 | ||
23645bfa VS |
67 | void wxInputConsumer::CreateInputHandler(const wxString& inphandler) |
68 | { | |
9467bdb7 | 69 | m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler, this); |
23645bfa VS |
70 | } |
71 | ||
72 | void wxInputConsumer::OnKeyDown(wxKeyEvent& event) | |
73 | { | |
a290fa5a | 74 | if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, true) ) |
23645bfa VS |
75 | event.Skip(); |
76 | } | |
77 | ||
78 | void wxInputConsumer::OnKeyUp(wxKeyEvent& event) | |
79 | { | |
a290fa5a | 80 | if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, false) ) |
23645bfa VS |
81 | event.Skip(); |
82 | } | |
83 | ||
84 | void wxInputConsumer::OnMouse(wxMouseEvent& event) | |
85 | { | |
86 | if ( m_inputHandler ) | |
87 | { | |
ca1ecff4 VZ |
88 | if ( event.Moving() || event.Dragging() || |
89 | event.Entering() || event.Leaving() ) | |
23645bfa VS |
90 | { |
91 | if ( m_inputHandler->HandleMouseMove(this, event) ) | |
92 | return; | |
93 | } | |
94 | else // a click action | |
95 | { | |
96 | if ( m_inputHandler->HandleMouse(this, event) ) | |
97 | return; | |
98 | } | |
99 | } | |
100 | ||
101 | event.Skip(); | |
102 | } | |
103 | ||
104 | // ---------------------------------------------------------------------------- | |
105 | // the actions | |
106 | // ---------------------------------------------------------------------------- | |
107 | ||
61fef19b VZ |
108 | bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action), |
109 | long WXUNUSED(numArg), | |
110 | const wxString& WXUNUSED(strArg)) | |
23645bfa | 111 | { |
a290fa5a | 112 | return false; |
23645bfa | 113 | } |