00001 /***************************************************************************** 00002 * evt_mouse.hpp 00003 ***************************************************************************** 00004 * Copyright (C) 2003 the VideoLAN team 00005 * $Id: 5328890177fd0ef71fc4ed0e20f77e01bdbe0003 $ 00006 * 00007 * Authors: Cyril Deguet <asmax@via.ecp.fr> 00008 * Olivier Teulière <ipkiss@via.ecp.fr> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License along 00021 * with this program; if not, write to the Free Software Foundation, Inc., 00022 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. 00023 *****************************************************************************/ 00024 00025 #ifndef EVT_MOUSE_HPP 00026 #define EVT_MOUSE_HPP 00027 00028 #include "evt_input.hpp" 00029 00030 00031 /// Class for mouse button events 00032 class EvtMouse: public EvtInput 00033 { 00034 public: 00035 enum ButtonType_t 00036 { 00037 kLeft, 00038 kMiddle, 00039 kRight 00040 }; 00041 00042 enum ActionType_t 00043 { 00044 kDown, 00045 kUp, 00046 kDblClick 00047 }; 00048 00049 EvtMouse( intf_thread_t *pIntf, int xPos, int yPos, ButtonType_t button, 00050 ActionType_t action, int mod = kModNone ) 00051 : EvtInput( pIntf, mod ), m_xPos( xPos ), m_yPos( yPos ), 00052 m_button( button ), m_action( action ) { } 00053 virtual ~EvtMouse() { } 00054 virtual const string getAsString() const; 00055 00056 // Return the event coordinates 00057 int getXPos() const { return m_xPos; } 00058 int getYPos() const { return m_yPos; } 00059 00060 // Return the button and the action 00061 ButtonType_t getButton() const { return m_button; } 00062 ActionType_t getAction() const { return m_action; } 00063 00064 private: 00065 /// Coordinates of the mouse relative to the window 00066 int m_xPos, m_yPos; 00067 /// Mouse button involved in the event 00068 ButtonType_t m_button; 00069 /// Type of action 00070 ActionType_t m_action; 00071 }; 00072 00073 00074 #endif
1.5.6