📄 events.cpp
字号:
/* Copyright (C) 1995, Tektronix Inc. All Rights Reserved. * * Usage Restrictions * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes only. * * Disclaimer of Warranty * * These software programs are available to the user without any license * fee or royalty on an "as is" basis. Tektronix Inc. disclaims any and * all warranties, whether express, implied, or statuary, including any * implied warranties or merchantability or of fitness for a particular * purpose. In no event shall the copyright-holder be liable for any * incidental, punitive, or consequential damages of any kind whatsoever * arising from the use of these programs. * * This disclaimer of warranty extends to the user of these programs and * user's customers, employees, agents, transferees, successors, and * assigns. * * The Tektronix Inc. does not represent or warrant that the programs * furnished hereunder are free of infringement of any third-party * patents.*//* Event implementation */#include "stdafx.h"#include "Events.H"EventManager::EventManager (){ for (int i = 0; i < (int) NumberEventTypes; i++) { Callbacks[i] = NULL; }}void EventManager::Register (EventType t, Callback f, void* d){ CallbackRecord* crec = new CallbackRecord(t, f, d); Callbacks[t] = crec;
}void EventManager::Trigger (EventType t, void* call_data){ if ((t < 0) || (t >= NumberEventTypes)) return; CallbackRecord* crec = Callbacks[t];
if(crec == NULL)
{
printf("\nbad pointer in Trigger.");
return;
} crec->callback(crec->type, crec->client_data, call_data);}CallbackRecord::CallbackRecord (EventType t, Callback c, void* d){ type = t; callback = c; client_data = d;}Wrapper::Wrapper (int ii){ i = ii;}Wrapper::Wrapper (char cc){ c = cc;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -