00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MODIFIERBUTTONS_H
00020 #define MODIFIERBUTTONS_H
00021
00022 #include <pandabase.h>
00023
00024 #include "buttonHandle.h"
00025 #include "pointerToArray.h"
00026 #include "buttonEvent.h"
00027
00028
00029
00030
00031
00032
00033
00034 class EXPCL_PANDA ModifierButtons {
00035 PUBLISHED:
00036 ModifierButtons();
00037 ModifierButtons(const ModifierButtons ©);
00038 ~ModifierButtons();
00039 INLINE void operator = (const ModifierButtons ©);
00040
00041 INLINE bool operator == (const ModifierButtons &other) const;
00042 INLINE bool operator != (const ModifierButtons &other) const;
00043 INLINE bool operator < (const ModifierButtons &other) const;
00044
00045 bool matches(const ModifierButtons &other) const;
00046
00047 bool add_button(ButtonHandle button);
00048 bool has_button(ButtonHandle button) const;
00049 bool remove_button(ButtonHandle button);
00050
00051 INLINE int get_num_buttons() const;
00052 INLINE ButtonHandle get_button(int index) const;
00053
00054 bool button_down(ButtonHandle button);
00055 bool button_up(ButtonHandle button);
00056 INLINE bool add_event(const ButtonEvent &event);
00057 INLINE void all_buttons_up();
00058
00059 bool is_down(ButtonHandle button) const;
00060 INLINE bool is_down(int index) const;
00061 INLINE bool is_any_down() const;
00062
00063 string get_prefix() const;
00064
00065 void output(ostream &out) const;
00066 void write(ostream &out) const;
00067
00068 private:
00069 void modify_button_list();
00070
00071 PTA(ButtonHandle) _button_list;
00072 typedef unsigned long BitmaskType;
00073 BitmaskType _state;
00074 };
00075
00076 INLINE ostream &operator << (ostream &out, const ModifierButtons &mb) {
00077 mb.output(out);
00078 return out;
00079 }
00080
00081 #include "modifierButtons.I"
00082
00083 #endif
00084