00001 // Filename: buttonEvent.I 00002 // Created by: drose (01Mar00) 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 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: ButtonEvent::Default Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE ButtonEvent:: 00026 ButtonEvent() : 00027 _button(ButtonHandle::none()), 00028 _keycode(0), 00029 _type(T_down) 00030 { 00031 } 00032 00033 //////////////////////////////////////////////////////////////////// 00034 // Function: ButtonEvent::Constructor 00035 // Access: Public 00036 // Description: 00037 //////////////////////////////////////////////////////////////////// 00038 INLINE ButtonEvent:: 00039 ButtonEvent(ButtonHandle button, ButtonEvent::Type type) : 00040 _button(button), 00041 _keycode(0), 00042 _type(type) 00043 { 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: ButtonEvent::Constructor 00048 // Access: Public 00049 // Description: 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE ButtonEvent:: 00052 ButtonEvent(short keycode) : 00053 _button(ButtonHandle::none()), 00054 _keycode(keycode), 00055 _type(T_keystroke) 00056 { 00057 } 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: ButtonEvent::Copy Constructor 00061 // Access: Public 00062 // Description: 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE ButtonEvent:: 00065 ButtonEvent(const ButtonEvent ©) : 00066 _button(copy._button), 00067 _keycode(copy._keycode), 00068 _type(copy._type) 00069 { 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: ButtonEvent::Copy Assignment Operator 00074 // Access: Public 00075 // Description: 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE void ButtonEvent:: 00078 operator = (const ButtonEvent ©) { 00079 _button = copy._button; 00080 _keycode = copy._keycode; 00081 _type = copy._type; 00082 } 00083 00084 //////////////////////////////////////////////////////////////////// 00085 // Function: ButtonEvent::Equality Operator 00086 // Access: Public 00087 // Description: 00088 //////////////////////////////////////////////////////////////////// 00089 INLINE bool ButtonEvent:: 00090 operator == (const ButtonEvent &other) const { 00091 return (_button == other._button && 00092 _keycode == other._keycode && 00093 _type == other._type); 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: ButtonEvent::Inequality Operator 00098 // Access: Public 00099 // Description: 00100 //////////////////////////////////////////////////////////////////// 00101 INLINE bool ButtonEvent:: 00102 operator != (const ButtonEvent &other) const { 00103 return !operator == (other); 00104 } 00105 00106 //////////////////////////////////////////////////////////////////// 00107 // Function: ButtonEvent::Ordering Operator 00108 // Access: Public 00109 // Description: 00110 //////////////////////////////////////////////////////////////////// 00111 INLINE bool ButtonEvent:: 00112 operator < (const ButtonEvent &other) const { 00113 if (_button != other._button) { 00114 return _button < other._button; 00115 } 00116 if (_keycode != other._keycode) { 00117 return _keycode < other._keycode; 00118 } 00119 00120 return _type < other._type; 00121 }