inpcons.cpp

来自「A*算法 A*算法 A*算法 A*算法A*算法A*算法」· C++ 代码 · 共 110 行

CPP
110
字号
/////////////////////////////////////////////////////////////////////////////
// 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: inpcons.cpp,v 1.10 2004/12/20 01:08:13 VZ Exp $
// Copyright:   (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

// ============================================================================
// declarations
// ============================================================================

#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
    #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.Dragging() ||
                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& WXUNUSED(action),
                                    long WXUNUSED(numArg),
                                    const wxString& WXUNUSED(strArg))
{
    return false;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?