1
// Thatcher Ulrich <tu@tulrich.com> 2003
3
// This source code has been donated to the Public Domain. Do
4
// whatever you want with it.
7
#ifndef GNASH_MOUSE_BUTTON_STATE_H
8
#define GNASH_MOUSE_BUTTON_STATE_H
11
#include "character_def.h"
13
#include "smart_ptr.h" // for composition and inlines
14
#include "character.h" // for use in intrusive_ptr
16
// Forward declarations
18
class sprite_instance;
23
/// Helper to generate mouse events, given mouse state & history.
24
class mouse_button_state
29
/// Possible button states
32
/// Button is depressed
39
/// entity that currently owns the mouse pointer
40
boost::intrusive_ptr<character> m_active_entity;
42
/// what's underneath the mouse right now
43
boost::intrusive_ptr<character> m_topmost_entity;
45
/// previous state of mouse button
46
bool m_mouse_button_state_last;
48
/// current state of mouse button
49
bool m_mouse_button_state_current;
51
/// whether mouse was inside the active_entity last frame
52
bool m_mouse_inside_entity_last;
56
m_mouse_button_state_last(UP),
57
m_mouse_button_state_current(UP),
58
m_mouse_inside_entity_last(false)
63
/// Mark reachable objects (active and topmost entities)
64
void markReachableResources() const
66
if ( m_active_entity.get() ) m_active_entity->setReachable();
67
if ( m_topmost_entity.get() ) m_topmost_entity->setReachable();
69
#endif // GNASH_USE_GC
72
} // end namespace gnash
75
#endif // GNASH_MOUSE_BUTTON_STATE_H
82
// indent-tabs-mode: t