00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029 #ifndef _GG_WndEvent_h_
00030 #define _GG_WndEvent_h_
00031
00032 #include <GG/Base.h>
00033 #include <GG/Exception.h>
00034 #include <GG/Flags.h>
00035
00036 #include <map>
00037
00038
00039 namespace GG {
00040
00041 class Timer;
00042 class Wnd;
00043
00044
00045 GG_FLAG_TYPE(ModKey);
00046 extern GG_API const ModKey MOD_KEY_NONE;
00047 extern GG_API const ModKey MOD_KEY_LSHIFT;
00048 extern GG_API const ModKey MOD_KEY_RSHIFT;
00049 extern GG_API const ModKey MOD_KEY_LCTRL;
00050 extern GG_API const ModKey MOD_KEY_RCTRL;
00051 extern GG_API const ModKey MOD_KEY_LALT;
00052 extern GG_API const ModKey MOD_KEY_RALT;
00053 extern GG_API const ModKey MOD_KEY_LMETA;
00054 extern GG_API const ModKey MOD_KEY_RMETA;
00055 extern GG_API const ModKey MOD_KEY_NUM;
00056 extern GG_API const ModKey MOD_KEY_CAPS;
00057 extern GG_API const ModKey MOD_KEY_MODE;
00058 extern GG_API const Flags<ModKey> MOD_KEY_CTRL;
00059 extern GG_API const Flags<ModKey> MOD_KEY_SHIFT;
00060 extern GG_API const Flags<ModKey> MOD_KEY_ALT;
00061 extern GG_API const Flags<ModKey> MOD_KEY_META;
00062
00069 class GG_API WndEvent
00070 {
00071 public:
00073 enum EventType {
00074 LButtonDown,
00075 LDrag,
00076 LButtonUp,
00077 LClick,
00078 LDoubleClick,
00079 MButtonDown,
00080 MDrag,
00081 MButtonUp,
00082 MClick,
00083 MDoubleClick,
00084 RButtonDown,
00085 RDrag,
00086 RButtonUp,
00087 RClick,
00088 RDoubleClick,
00089 MouseEnter,
00090 MouseHere,
00091 MouseLeave,
00092 MouseWheel,
00093 DragDropEnter,
00094 DragDropHere,
00095 DragDropLeave,
00096 KeyPress,
00097 KeyRelease,
00098 GainingFocus,
00099 LosingFocus,
00100 TimerFiring
00101 };
00102
00105 WndEvent(EventType type, const Pt& pt, Flags<ModKey> mod_keys);
00106
00109 WndEvent(EventType type, const Pt& pt, const Pt& move, Flags<ModKey> mod_keys);
00110
00113 WndEvent(EventType type, const Pt& pt, int move, Flags<ModKey> mod_keys);
00114
00117 WndEvent(EventType type, const Pt& pt, const std::map<Wnd*, Pt>& drag_drop_wnds, Flags<ModKey> mod_keys);
00118
00121 WndEvent(EventType type, Key key, Flags<ModKey> mod_keys);
00122
00124 WndEvent(EventType type, int ticks, Timer* timer);
00125
00127 explicit WndEvent(EventType type);
00128
00129 EventType Type() const;
00130 const Pt& Point() const;
00131 Key GetKey() const;
00132 Flags<ModKey> ModKeys() const;
00133 const Pt& DragMove() const;
00134 int WheelMove() const;
00135 const std::map<Wnd*, Pt>& DragDropWnds() const;
00136 int Ticks() const;
00137 Timer* GetTimer() const;
00138
00139 private:
00140 EventType m_type;
00141 Pt m_point;
00142 Key m_key;
00143 Flags<ModKey> m_mod_keys;
00144 Pt m_drag_move;
00145 int m_wheel_move;
00146 std::map<Wnd*, Pt> m_drag_drop_wnds;
00147 int m_ticks;
00148 Timer* m_timer;
00149 };
00150
00151 }
00152
00153 #endif