aboutsummaryrefslogtreecommitdiff
path: root/dw/events.hh
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-09-24 18:44:40 +0200
committerjcid <devnull@localhost>2008-09-24 18:44:40 +0200
commitc377e06400f138325a9a9d43d91a9272691867a1 (patch)
tree49f3ca1c46af11a058a68714899d4137ec717618 /dw/events.hh
parent642f9b3e747859a7256ea12fab9f9ed50aa9253a (diff)
- Moved the dw2 tree into dillo2's tree.
Diffstat (limited to 'dw/events.hh')
-rw-r--r--dw/events.hh83
1 files changed, 83 insertions, 0 deletions
diff --git a/dw/events.hh b/dw/events.hh
new file mode 100644
index 00000000..860472ab
--- /dev/null
+++ b/dw/events.hh
@@ -0,0 +1,83 @@
+#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 independant 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 independant
+ * way.
+ */
+class Event: public 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__