26 ButtonNode(
ClientBase *client,
const std::string &device_name) :
29 _button_events_output = define_output(
"button_events", ButtonEventList::get_class_type());
31 nassertv(client !=
nullptr);
33 client->get_device(ClientButtonDevice::get_class_type(), device_name);
35 if (device ==
nullptr) {
37 <<
"Unable to open button device " << device_name <<
"\n";
41 if (!device->is_of_type(ClientButtonDevice::get_class_type())) {
43 <<
"Inappropriate device type " << device->get_type()
44 <<
" created; expected a ClientButtonDevice.\n";
59 _button_events_output = define_output(
"button_events", ButtonEventList::get_class_type());
77 output(std::ostream &out)
const {
78 DataNode::output(out);
80 if (_device !=
nullptr) {
82 _device->output_buttons(out);
91 write(std::ostream &out,
int indent_level)
const {
92 DataNode::write(out, indent_level);
94 if (_device !=
nullptr) {
95 _device->write_buttons(out, indent_level + 2);