00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MOUSEWATCHERREGION_H
00020 #define MOUSEWATCHERREGION_H
00021
00022 #include "pandabase.h"
00023
00024 #include "namable.h"
00025 #include "typedReferenceCount.h"
00026 #include "luse.h"
00027 #include "buttonHandle.h"
00028 #include "modifierButtons.h"
00029
00030 class MouseWatcherParameter;
00031
00032
00033
00034
00035
00036
00037 class EXPCL_PANDA MouseWatcherRegion : public TypedReferenceCount, public Namable {
00038 PUBLISHED:
00039 INLINE MouseWatcherRegion(const string &name, float left, float right,
00040 float bottom, float top);
00041 INLINE MouseWatcherRegion(const string &name, const LVecBase4f &frame);
00042
00043 INLINE void set_frame(float left, float right, float bottom, float top);
00044 INLINE void set_frame(const LVecBase4f &frame);
00045 INLINE const LVecBase4f &get_frame() const;
00046 INLINE float get_area() const;
00047
00048 INLINE void set_sort(int sort);
00049 INLINE int get_sort() const;
00050
00051 INLINE void set_active(bool active);
00052 INLINE bool get_active() const;
00053
00054 INLINE void set_keyboard(bool keyboard);
00055 INLINE bool get_keyboard() const;
00056
00057 enum SuppressFlags {
00058 SF_mouse_button = 0x001,
00059 SF_other_button = 0x002,
00060 SF_any_button = 0x003,
00061 SF_mouse_position = 0x004,
00062 };
00063
00064 INLINE void set_suppress_flags(int suppress_flags);
00065 INLINE int get_suppress_flags() const;
00066
00067 void output(ostream &out) const;
00068 void write(ostream &out, int indent_level = 0) const;
00069
00070 public:
00071 INLINE bool operator < (const MouseWatcherRegion &other) const;
00072
00073 virtual void enter(const MouseWatcherParameter ¶m);
00074 virtual void exit(const MouseWatcherParameter ¶m);
00075 virtual void within(const MouseWatcherParameter ¶m);
00076 virtual void without(const MouseWatcherParameter ¶m);
00077 virtual void press(const MouseWatcherParameter ¶m);
00078 virtual void release(const MouseWatcherParameter ¶m);
00079 virtual void keystroke(const MouseWatcherParameter ¶m);
00080
00081 private:
00082 LVecBase4f _frame;
00083 float _area;
00084 int _sort;
00085
00086 enum Flags {
00087
00088
00089 F_suppress_flags = 0x0ff,
00090 F_active = 0x100,
00091 F_keyboard = 0x200,
00092 };
00093 int _flags;
00094 ModifierButtons _mods;
00095
00096 public:
00097 static TypeHandle get_class_type() {
00098 return _type_handle;
00099 }
00100 static void init_type() {
00101 TypedReferenceCount::init_type();
00102 Namable::init_type();
00103 register_type(_type_handle, "MouseWatcherRegion",
00104 TypedReferenceCount::get_class_type(),
00105 Namable::get_class_type());
00106 }
00107 virtual TypeHandle get_type() const {
00108 return get_class_type();
00109 }
00110 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00111
00112 private:
00113 static TypeHandle _type_handle;
00114 };
00115
00116 INLINE ostream &operator << (ostream &out, const MouseWatcherRegion ®ion) {
00117 region.output(out);
00118 return out;
00119 }
00120
00121 #include "mouseWatcherRegion.I"
00122
00123 #endif