]> git.saurik.com Git - wxWidgets.git/blob - src/univ/inpcons.cpp
follow up parent chain to properly support modal dialog parents, see #15383
[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 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/wxprec.h"
20
21 #ifdef __BORLANDC__
22 #pragma hdrstop
23 #endif
24
25 #ifndef WX_PRECOMP
26 #include "wx/window.h"
27 #endif // WX_PRECOMP
28
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
61 wxInputHandler *
62 wxInputConsumer::DoGetStdInputHandler(wxInputHandler * WXUNUSED(handlerDef))
63 {
64 return NULL;
65 }
66
67 void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
68 {
69 m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler, this);
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.Dragging() ||
89 event.Entering() || event.Leaving() )
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
108 bool wxInputConsumer::PerformAction(const wxControlAction& WXUNUSED(action),
109 long WXUNUSED(numArg),
110 const wxString& WXUNUSED(strArg))
111 {
112 return false;
113 }