- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

umouseevent.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/events/umouseevent.hpp 00008 begin : Wed May 9 2001 00009 $Id: umouseevent.hpp,v 1.9 2005/05/21 15:17:23 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 #ifndef UMOUSEEVENT_HPP 00029 #define UMOUSEEVENT_HPP 00030 00031 #include "uinputevent.hpp" 00032 #include "ukeysym.hpp" 00033 00034 #include "../util/upoint.hpp" 00035 00036 namespace ufo { 00037 00044 class UFO_EXPORT UMouseEvent : public UInputEvent { 00045 UFO_DECLARE_DYNAMIC_CLASS(UMouseEvent) 00046 public: 00056 UMouseEvent(UWidget * sourceA, Type typeA, UMod_t modifiersA, 00057 const UPoint & pos, UMod_t button, int clickCountA); 00058 00071 UMouseEvent(UWidget * sourceA, Type typeA, UMod_t modifiersA, 00072 const UPoint & pos, const UPoint & relMove, UMod_t button, int clickCountA); 00073 00086 UMouseEvent(UWidget * sourceA, Type typeA, UMod_t modifiersA, 00087 const UPoint & pos, const UPoint & relMove, 00088 const UPoint & root, 00089 UMod_t button, int clickCountA); 00090 00092 int getClickCount() const; 00093 00102 UMod_t getButton() const; 00103 00105 const UPoint & getLocation() const; 00107 const UPoint & getRootLocation() const; 00109 const UPoint & getRelMovement() const; 00110 00112 int getX() const; 00114 int getY() const; 00115 00117 int getXRel() const; 00119 int getYRel() const; 00120 00122 int getRootX() const; 00124 int getRootY() const; 00125 00127 void translate(const UPoint & pos); 00128 00129 protected: // Protected methods 00130 virtual std::ostream & paramString(std::ostream & os) const; 00131 00132 private: // Private attributes 00133 UPoint m_pos; 00134 00135 UPoint m_rel; 00136 00137 UPoint m_root; 00138 00139 UMod_t m_button; 00141 int m_clickCount; 00142 }; 00143 00144 // 00145 // inline implementation 00146 // 00147 00148 00149 inline int 00150 UMouseEvent::getClickCount() const { 00151 return m_clickCount; 00152 } 00153 00154 inline UMod_t 00155 UMouseEvent::getButton() const { 00156 return m_button; 00157 } 00158 00159 00160 inline const UPoint & 00161 UMouseEvent::getLocation() const { 00162 return m_pos; 00163 } 00164 00165 inline const UPoint & 00166 UMouseEvent::getRootLocation() const { 00167 return m_root; 00168 } 00169 00170 inline const UPoint & 00171 UMouseEvent::getRelMovement() const { 00172 return m_rel; 00173 } 00174 00175 inline int 00176 UMouseEvent::getX() const { 00177 return m_pos.x; 00178 } 00179 00180 inline int 00181 UMouseEvent::getY() const { 00182 return m_pos.y; 00183 } 00184 00185 inline int 00186 UMouseEvent::getXRel() const { 00187 return m_rel.x; 00188 } 00189 00190 inline int 00191 UMouseEvent::getYRel() const { 00192 return m_rel.y; 00193 } 00194 00195 inline int 00196 UMouseEvent::getRootX() const { 00197 return m_root.x; 00198 } 00199 00200 inline int 00201 UMouseEvent::getRootY() const { 00202 return m_root.y; 00203 } 00204 00205 inline void 00206 UMouseEvent::translate(const UPoint & pos) { 00207 m_pos.translate(pos); 00208 m_root.translate(pos); 00209 } 00210 00211 } // namespace ufo 00212 00213 #endif // UMOUSEEVENT_HPP

The libUFO Project - written by Johannes Schmidt