📄 uifltk.cpp
字号:
/*************************************************************************** DSemu - The Next Generation ** Fltk user interface: Plugin implementation [uifltk.cpp] ** Copyright Imran Nazar, 2005; released under the BSD public licence. ** Fltk used under the terms of the LGPL. ***************************************************************************/#include <FL/Fl.H>#include <FL/fl_draw.H>#include "uifltk.h"#include "plugin.h"#include "log.h"#include "w32compile.h"// Essentially, this is a very boring wrapper for the UI; this class// inherits from Plugin, whereas the UI inherits from an Fltk window.// This wrapper keeps the two inheritance paths seperate, and hides the// UI's Fltk stuff away.//---Static private class members------------------------------------------// Every plugin has an INFO structure attached, with info about the plugin.PLUGININFO UIFltk::pInfo={ PLUGIN_TYPE_GUI, 0x00010001, "Fltk user interface", "DSemu-ng"};std::string UIFltk::pluginName;// BUGBUG: Major hack until I find the libs where these variables are defined#ifdef WIN32int __mb_cur_max = 512;# ifdef _MSC_VERconst unsigned short* _pctype = 0;# endif#endif// Start the executionint UIFltk::run(){ // Keep looping while there's a window to show do { ui->execFrame();/* #ifdef WIN32 Sleep(10); #else usleep(10000); #endif*/ } while(Fl::check()); return 0;}// Externally visible wrappers for the UI's subwindow and event systemsint UIFltk::subwinCreate(int xd, int yd, const char *title, u32 *buf){ return ui->subwinCreate(xd, yd, title, buf);}void UIFltk::subwinRefresh(int id){ ui->subwinRefresh(id);}uint64_t UIFltk::getTimestamp(){ return ui->getTimestamp();}void UIFltk::eventPush(u32 time, int type, vfptr func, void *data){ ui->eventPush(time, type, func, data);}UIFltk::UIFltk(std::string name, REQPTR req, UNREQPTR unreq){ pName = std::string(name); pClass = pName.substr(0, pName.find(".")+1); pRequest = req; pUnrequest = unreq; pluginName = std::string(pName); ui = new UI(100, 100, 240, 37, DSEMU_VERSION_STR); Logger::log(pName) << "Initialised.";}UIFltk::~UIFltk(){ if(ui) { delete ui; ui = NULL; } Logger::log(pName) << "Shutdown.";}void UIFltk::reset(){}void UIFltk::status(int opt1=0, int opt2=0){}//---Plugin architecture support-------------------------------------------// Retrieve Plugin class from outside// Parameters: plg - Address of a pointer to a Plugin class to 'new'// name - FQPN of plugin as listed in INI file// req - Pointer to PluginRequest API function// unreq - Pointer to PluginUnrequest API functionEXPORTFUNC void getPlugin(Plugin **plg, std::string name, REQPTR req, UNREQPTR unreq){ *plg = new UIFltk(name, req, unreq);}// Provide plugin version informationPLUGININFO *UIFltk::getinfo(){ return &pInfo;}// Release plugin from outsidevoid UIFltk::release(){ // Delete the Test plugin that was 'new'd in getPlugin. delete this;}/*** EOF: uifltk.cpp *****************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -