00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef BUTTONNODE_H
00016 #define BUTTONNODE_H
00017
00018 #include "pandabase.h"
00019
00020 #include "clientBase.h"
00021 #include "clientButtonDevice.h"
00022 #include "dataNode.h"
00023 #include "buttonEventList.h"
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class EXPCL_PANDA_DEVICE ButtonNode : public DataNode {
00042 PUBLISHED:
00043 ButtonNode(ClientBase *client, const string &device_name);
00044 virtual ~ButtonNode();
00045
00046 INLINE bool is_valid() const;
00047
00048 INLINE int get_num_buttons() const;
00049
00050 INLINE void set_button_map(int index, ButtonHandle button);
00051 INLINE ButtonHandle get_button_map(int index) const;
00052
00053 INLINE bool get_button_state(int index) const;
00054 INLINE bool is_button_known(int index) const;
00055
00056 public:
00057 virtual void output(ostream &out) const;
00058 virtual void write(ostream &out, int indent_level = 0) const;
00059
00060 private:
00061 PT(ClientButtonDevice) _button;
00062
00063 protected:
00064
00065 virtual void do_transmit_data(DataGraphTraverser *trav,
00066 const DataNodeTransmit &input,
00067 DataNodeTransmit &output);
00068
00069 private:
00070
00071 int _button_events_output;
00072 PT(ButtonEventList) _button_events;
00073
00074 public:
00075 static TypeHandle get_class_type() {
00076 return _type_handle;
00077 }
00078 static void init_type() {
00079 DataNode::init_type();
00080 register_type(_type_handle, "ButtonNode",
00081 DataNode::get_class_type());
00082 }
00083 virtual TypeHandle get_type() const {
00084 return get_class_type();
00085 }
00086 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00087
00088 private:
00089 static TypeHandle _type_handle;
00090 };
00091
00092 #include "buttonNode.I"
00093
00094 #endif