Panda3D
 All Classes Functions Variables Enumerations
buttonHandle.cxx
00001 // Filename: buttonHandle.cxx
00002 // Created by:  drose (01Mar00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "buttonHandle.h"
00016 #include "buttonRegistry.h"
00017 
00018 // This is initialized to zero by static initialization.
00019 ButtonHandle ButtonHandle::_none;
00020 
00021 TypeHandle ButtonHandle::_type_handle;
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //     Function: ButtonHandle::get_name
00025 //       Access: Public
00026 //  Description: Returns the name of the button.
00027 ////////////////////////////////////////////////////////////////////
00028 string ButtonHandle::
00029 get_name() const {
00030   if ((*this) == ButtonHandle::none()) {
00031     return "none";
00032   } else {
00033     return ButtonRegistry::ptr()->get_name(*this);
00034   }
00035 }
00036 
00037 ////////////////////////////////////////////////////////////////////
00038 //     Function: ButtonHandle::get_alias
00039 //       Access: Published
00040 //  Description: Returns the alias (alternate name) associated with
00041 //               the button, if any, or ButtonHandle::none() if the
00042 //               button has no alias.
00043 //
00044 //               Each button is allowed to have one alias, and
00045 //               multiple different buttons can refer to the same
00046 //               alias.  The alias should be the more general name for
00047 //               the button, for instance, shift is an alias for
00048 //               lshift, but not vice-versa.
00049 ////////////////////////////////////////////////////////////////////
00050 ButtonHandle ButtonHandle::
00051 get_alias() const {
00052   if ((*this) == ButtonHandle::none()) {
00053     return ButtonHandle::none();
00054   } else {
00055     return ButtonRegistry::ptr()->get_alias(*this);
00056   }
00057 }
 All Classes Functions Variables Enumerations