| 1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2005 Takuro Ashie |
| 4 |
* Copyright (C) 2012 CSSlayer |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation; either version 2, or (at your option) |
| 9 |
* any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program; if not, write to the Free Software |
| 18 |
* Foundation, 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef __FCITX_ANTHY_ACTION_H__ |
| 22 |
#define __FCITX_ANTHY_ACTION_H__ |
| 23 |
|
| 24 |
#include <string> |
| 25 |
#include "common.h" |
| 26 |
|
| 27 |
class AnthyInstance; |
| 28 |
|
| 29 |
typedef bool (AnthyInstance::*PMF) (void); |
| 30 |
|
| 31 |
class Action |
| 32 |
{ |
| 33 |
|
| 34 |
public: |
| 35 |
|
| 36 |
Action(); |
| 37 |
Action (const std::string &name, FcitxHotkey* hotkey, PMF pmf); |
| 38 |
|
| 39 |
public: |
| 40 |
bool perform (AnthyInstance *performer); |
| 41 |
bool perform (AnthyInstance *performer, |
| 42 |
const KeyEvent &key); |
| 43 |
|
| 44 |
bool match_action_name (const char *name); |
| 45 |
|
| 46 |
bool operator < (const Action& b) { |
| 47 |
return m_name < b.m_name; |
| 48 |
} |
| 49 |
|
| 50 |
bool match_key_event (const KeyEvent &key); |
| 51 |
|
| 52 |
std::string m_name; |
| 53 |
std::string m_desc; |
| 54 |
PMF m_pmf; |
| 55 |
FcitxHotkey* m_key_bindings; |
| 56 |
}; |
| 57 |
|
| 58 |
#endif /* __FCITX_ANTHY_ACTION_H__ */ |