Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/putil/buttonEventList.cxx

Go to the documentation of this file.
00001 // Filename: buttonEventList.cxx
00002 // Created by:  drose (12Mar02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "buttonEventList.h"
00020 #include "modifierButtons.h"
00021 #include "indent.h"
00022 
00023 TypeHandle ButtonEventList::_type_handle;
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: ButtonEventList::update_mods
00027 //       Access: Public
00028 //  Description: Updates the indicated ModifierButtons object with all
00029 //               of the button up/down transitions indicated in the
00030 //               list.
00031 ////////////////////////////////////////////////////////////////////
00032 void ButtonEventList::
00033 update_mods(ModifierButtons &mods) const {
00034   Events::const_iterator ei;
00035   for (ei = _events.begin(); ei != _events.end(); ++ei) {
00036     mods.add_event(*ei);
00037   }
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: ButtonEventList::output
00042 //       Access: Public, Virtual
00043 //  Description: 
00044 ////////////////////////////////////////////////////////////////////
00045 void ButtonEventList::
00046 output(ostream &out) const {
00047   if (_events.empty()) {
00048     out << "(no buttons)";
00049   } else {
00050     Events::const_iterator ei;
00051     ei = _events.begin();
00052     out << "(" << (*ei);
00053     ++ei;
00054     while (ei != _events.end()) {
00055       out << " " << (*ei);
00056       ++ei;
00057     }
00058     out << ")";
00059   }
00060 }
00061 
00062 ////////////////////////////////////////////////////////////////////
00063 //     Function: ButtonEventList::write
00064 //       Access: Public
00065 //  Description: 
00066 ////////////////////////////////////////////////////////////////////
00067 void ButtonEventList::
00068 write(ostream &out, int indent_level) const {
00069   indent(out, indent_level) << _events.size() << " events:\n";
00070   Events::const_iterator ei;
00071   for (ei = _events.begin(); ei != _events.end(); ++ei) {
00072     indent(out, indent_level + 2) << (*ei) << "\n";
00073   }
00074 }

Generated on Fri May 2 00:43:32 2003 for Panda by doxygen1.3