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
00074 class GG_API WndEvent
00075 {
00076 public:
00079 enum EventType {
00080 LButtonDown,
00081 LDrag,
00082 LButtonUp,
00083 LClick,
00084 LDoubleClick,
00085 MButtonDown,
00086 MDrag,
00087 MButtonUp,
00088 MClick,
00089 MDoubleClick,
00090 RButtonDown,
00091 RDrag,
00092 RButtonUp,
00093 RClick,
00094 RDoubleClick,
00095 MouseEnter,
00096 MouseHere,
00097 MouseLeave,
00098 MouseWheel,
00099 DragDropEnter,
00100 DragDropHere,
00101 DragDropLeave,
00102 KeyPress,
00103 KeyRelease,
00104 GainingFocus,
00105 LosingFocus,
00106 TimerFiring
00107 };
00108
00112 WndEvent(EventType type, const Pt& pt, Flags<ModKey> mod_keys);
00113
00117 WndEvent(EventType type, const Pt& pt, const Pt& move, Flags<ModKey> mod_keys);
00118
00122 WndEvent(EventType type, const Pt& pt, int move, Flags<ModKey> mod_keys);
00123
00127 WndEvent(EventType type, const Pt& pt, const std::map<Wnd*, Pt>& drag_drop_wnds, Flags<ModKey> mod_keys);
00128
00131 WndEvent(EventType type, Key key, boost::uint32_t code_point, Flags<ModKey> mod_keys);
00132
00135 WndEvent(EventType type, unsigned int ticks, Timer* timer);
00136
00139 explicit WndEvent(EventType type);
00140
00141 EventType Type() const;
00142 const Pt& Point() const;
00143 Key GetKey() const;
00144 boost::uint32_t KeyCodePoint() const;
00145 Flags<ModKey> ModKeys() const;
00146 const Pt& DragMove() const;
00147 int WheelMove() const;
00148 const std::map<Wnd*, Pt>& DragDropWnds() const;
00149 unsigned int Ticks() const;
00150 Timer* GetTimer() const;
00151
00152 private:
00153 EventType m_type;
00154 Pt m_point;
00155 Key m_key;
00156 boost::uint32_t m_key_code_point;
00157 Flags<ModKey> m_mod_keys;
00158 Pt m_drag_move;
00159 int m_wheel_move;
00160 std::map<Wnd*, Pt> m_drag_drop_wnds;
00161 unsigned int m_ticks;
00162 Timer* m_timer;
00163 };
00164
00165 }
00166
00167 #endif