1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * Copyright (C) 2005 Takuro Ashie
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "scim_anthy_action.h"
25 #include "scim_anthy_utils.h"
27 using namespace scim_anthy;
29 Action::Action (const String &name, const String &key_bindings, PMF pmf)
34 scim_string_to_key_list (m_key_bindings, key_bindings);
37 Action::Action (const String &name, const String &key_bindings, Func func)
42 scim_string_to_key_list (m_key_bindings, key_bindings);
45 Action::~Action (void)
50 Action::perform (AnthyInstance *performer)
53 return (performer->*m_pmf) ();
55 return m_func (performer);
61 Action::perform (AnthyInstance *performer, const KeyEvent &key)
63 if (!m_pmf && !m_func)
66 if (match_key_event (key)) {
68 return (performer->*m_pmf) ();
70 return m_func (performer);
77 Action::match_key_event (const KeyEvent &key)
79 return util_match_key_event (m_key_bindings, key, SCIM_KEY_CapsLockMask);
83 Action::match_action_name (const char *name)
85 return (m_name.compare (name) == 0);