|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef SHORTCUTMANAGER_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define SHORTCUTMANAGER_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/tw.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TWIN_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//forward declarations
|
|
Toshihiro Shimizu |
890ddd |
class TKeyListener;
|
|
Toshihiro Shimizu |
890ddd |
class TFilePath;
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Shortcut
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TShortcut
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
string m_id;
|
|
Toshihiro Shimizu |
890ddd |
wstring m_name;
|
|
Toshihiro Shimizu |
890ddd |
TKeyListener *m_listener;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
TShortcut(string id);
|
|
Toshihiro Shimizu |
890ddd |
virtual ~TShortcut();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string getId() const { return m_id; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setName(wstring name) { m_name = name; }
|
|
Toshihiro Shimizu |
890ddd |
wstring getName() const { return m_name; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
string getKeyName() const;
|
|
Toshihiro Shimizu |
890ddd |
void setKeyName(string keyName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void onKeyDown() = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void onKeyUp(bool mouseEventReceived) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual string getType() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
// not implemented
|
|
Toshihiro Shimizu |
890ddd |
TShortcut(const TShortcut &);
|
|
Toshihiro Shimizu |
890ddd |
TShortcut &operator=(const TShortcut &);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Shortcut controller
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI TShortcutManager
|
|
Toshihiro Shimizu |
890ddd |
{ // singleton
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class Imp;
|
|
Toshihiro Shimizu |
890ddd |
Imp *m_imp;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TShortcutManager();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
~TShortcutManager();
|
|
Toshihiro Shimizu |
890ddd |
static TShortcutManager *instance();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setKeyName(string id, string keyName);
|
|
Toshihiro Shimizu |
890ddd |
string getKeyName(string id);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TShortcut *getShortcutByKeyName(string keyName);
|
|
Toshihiro Shimizu |
890ddd |
TShortcut *getShortcutById(string keyName);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void getShortcuts(std::vector<const *="" tshortcut=""> &shortcuts);</const>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// get ownership
|
|
Toshihiro Shimizu |
890ddd |
void add(TShortcut *shortcut);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setPath(const TFilePath &path);
|
|
Toshihiro Shimizu |
890ddd |
const TFilePath &getPath() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void load();
|
|
Toshihiro Shimizu |
890ddd |
void save();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|