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