⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accel.cpp

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 CPP
字号:
/////////////////////////////////////////////////////////////////////////////// Name:        src/mac/carbon/accel.cpp// Purpose:     wxAcceleratorTable// Author:      Stefan Csomor// Modified by:// Created:     1998-01-01// RCS-ID:      $Id: accel.cpp,v 1.21 2006/10/08 21:56:36 VZ Exp $// Copyright:   (c) Stefan Csomor// Licence:     wxWindows licence/////////////////////////////////////////////////////////////////////////////#include "wx/wxprec.h"#include "wx/accel.h"#ifndef WX_PRECOMP    #include "wx/string.h"#endifIMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)// ----------------------------------------------------------------------------// wxAccelList: a list of wxAcceleratorEntries// ----------------------------------------------------------------------------WX_DECLARE_LIST(wxAcceleratorEntry, wxAccelList);#include "wx/listimpl.cpp"WX_DEFINE_LIST(wxAccelList)// ----------------------------------------------------------------------------// wxAccelRefData: the data used by wxAcceleratorTable// ----------------------------------------------------------------------------class WXDLLEXPORT wxAcceleratorRefData: public wxObjectRefData{    friend class WXDLLEXPORT wxAcceleratorTable;public:    wxAcceleratorRefData();    virtual ~wxAcceleratorRefData();    wxAccelList m_accels;};#define M_ACCELDATA ((wxAcceleratorRefData *)m_refData)wxAcceleratorRefData::wxAcceleratorRefData()    : m_accels(){}wxAcceleratorRefData::~wxAcceleratorRefData(){    WX_CLEAR_LIST( wxAccelList, m_accels );}wxAcceleratorTable::wxAcceleratorTable(){    m_refData = NULL;}wxAcceleratorTable::~wxAcceleratorTable(){}// Create from an arraywxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]){    m_refData = new wxAcceleratorRefData;    for (int i = 0; i < n; i++)    {        int flag    = entries[i].GetFlags();        int keycode = entries[i].GetKeyCode();        int command = entries[i].GetCommand();        if ((keycode >= (int)'a') && (keycode <= (int)'z')) keycode = (int)toupper( (char)keycode );        M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) );    }}bool wxAcceleratorTable::IsOk() const{    return (m_refData != NULL);}int wxAcceleratorTable::GetCommand( wxKeyEvent &event ){    if (!Ok()) return -1;    wxAccelList::compatibility_iterator node = M_ACCELDATA->m_accels.GetFirst();    while (node)    {        wxAcceleratorEntry *entry = node->GetData();        if ((event.m_keyCode == entry->GetKeyCode()) &&           (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&           (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&           (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown()) &&            (((entry->GetFlags() & wxACCEL_CMD) == 0) || event.CmdDown()))        {            return entry->GetCommand();        }        node = node->GetNext();    }    return -1;}

⌨️ 快捷键说明

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