2
// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
// This program is free software; you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation; either version 3 of the License, or
7
// (at your option) any later version.
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
/* $Id: Key.h,v 1.34 2008/02/07 10:07:58 bwy Exp $ */
25
#include "gnashconfig.h"
28
#include "tu_config.h"
29
#include "as_object.h" // for inheritance
32
#include "gnash.h" // for gnash::key namespace
43
/************************************************************************
45
* This has been moved from action.cpp, when things are clean
46
* everything should have been moved up
48
************************************************************************/
50
class DSOEXPORT key_as_object : public as_object
56
// Mark all key listeners as reachable
57
void markReachableResources() const;
58
#endif // def GNASH_USE_GC
64
// Pass SWF keycode, returns true if currently pressed.
65
bool is_key_down(int keycode);
67
// Pass gnash::key::code. Changes m_last_key_event
68
// and adds appropriate SWF keycode to bit array of keys
69
// pressed (_unreleasedKeys)
70
void set_key_down(key::code code);
72
// Pass gnash::key::code. Changes m_last_key_event
73
// and removes appropriate SWF keycode from bit array of keys
74
// pressed (_unreleasedKeys)
75
void set_key_up(key::code code);
77
int get_last_key() const;
79
/// Responsible for user defined key events handlers only;
80
/// take over both characters and non-characters object.
81
void notify_listeners(const event_id& key_event_type);
84
/// bit-array for recording the unreleased keys
85
std::bitset<key::KEYCOUNT> _unreleasedKeys;
87
typedef std::list<boost::intrusive_ptr<as_object> > Listeners;
93
void key_class_init(as_object& global);
95
} // end of gnash namespace