view dw/events.hh @ 2104:3e7e5395f0bc

non-ASCII keybindings Alexander Voigt has kindly done some testing, and it seems that this makes bindings to most keys on a German keyboard possible -- except those that need AltGr don't work yet.
author corvid <corvid@lavabit.com>
date Thu, 23 Jun 2011 19:24:11 +0000
parents 4704ad910042
children
line wrap: on
line source
#ifndef __DW_EVENTS_HH__
#define __DW_EVENTS_HH__

#ifndef __INCLUDED_FROM_DW_CORE_HH__
#   error Do not include this file directly, use "core.hh" instead.
#endif

namespace dw {
namespace core {

/**
 * \brief Platform independent representation.
 */
enum ButtonState
{
   /* We won't use more than these ones. */
   SHIFT_MASK    = 1 << 0,
   CONTROL_MASK  = 1 << 1,
   META_MASK     = 1 << 2,
   BUTTON1_MASK  = 1 << 3,
   BUTTON2_MASK  = 1 << 4,
   BUTTON3_MASK  = 1 << 5
};

/**
 * \brief Base class for all events.
 *
 * The dw::core::Event hierarchy describes events in a platform independent
 * way.
 */
class Event: public lout::object::Object
{
public:
};

/**
 * \brief Base class for all mouse events.
 */
class MouseEvent: public Event
{
public:
   ButtonState state;
};

/**
 * \brief Base class for all mouse events related to a specific position.
 */
class MousePositionEvent: public MouseEvent
{
public:
   int xCanvas, yCanvas, xWidget, yWidget;
};

/**
 * \brief Represents a button press or release event.
 */
class EventButton: public MousePositionEvent
{
public:
   int numPressed; /* 1 for simple click, 2 for double click, etc. */
   int button;
};

/**
 * \brief Represents a mouse motion event.
 */
class EventMotion: public MousePositionEvent
{
};

/**
 * \brief Represents a enter or leave notify event.
 */
class EventCrossing: public MouseEvent
{
public:
   Widget *lastWidget, *currentWidget;
};

} // namespace dw
} // namespace core

#endif // __DW_EVENTS_HH__