wxInputConsumer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-09-22 11:56:04 +00:00
parent d6eaea2845
commit 23645bfa01
26 changed files with 406 additions and 259 deletions

108
src/univ/inpcons.cpp Normal file
View File

@@ -0,0 +1,108 @@
/////////////////////////////////////////////////////////////////////////////
// Name: src/univ/inpcons.cpp
// Purpose: wxInputConsumer: mix-in class for input handling
// Author: Vadim Zeitlin
// Modified by:
// Created: 14.08.00
// RCS-ID: $Id$
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
#ifdef __GNUG__
#pragma implementation "inpcons.h"
#endif
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/univ/renderer.h"
#include "wx/univ/inphand.h"
#include "wx/univ/theme.h"
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// focus/activation handling
// ----------------------------------------------------------------------------
void wxInputConsumer::OnFocus(wxFocusEvent& event)
{
if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) )
GetInputWindow()->Refresh();
else
event.Skip();
}
void wxInputConsumer::OnActivate(wxActivateEvent& event)
{
if ( m_inputHandler && m_inputHandler->HandleActivation(this, event.GetActive()) )
GetInputWindow()->Refresh();
else
event.Skip();
}
// ----------------------------------------------------------------------------
// input processing
// ----------------------------------------------------------------------------
void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
{
m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler);
}
void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
{
if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, TRUE) )
event.Skip();
}
void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
{
if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, FALSE) )
event.Skip();
}
void wxInputConsumer::OnMouse(wxMouseEvent& event)
{
if ( m_inputHandler )
{
if ( event.Moving() || event.Entering() || event.Leaving() )
{
if ( m_inputHandler->HandleMouseMove(this, event) )
return;
}
else // a click action
{
if ( m_inputHandler->HandleMouse(this, event) )
return;
}
}
event.Skip();
}
// ----------------------------------------------------------------------------
// the actions
// ----------------------------------------------------------------------------
bool wxInputConsumer::PerformAction(const wxControlAction& action,
long numArg,
const wxString& strArg)
{
return FALSE;
}