00001 /*****************************************************************************
00002 * SGL: A Scene Graph Library
00003 *
00004 * Copyright (C) 1997-2001 Scott McMillan All Rights Reserved.
00005 *
00006 * This library is free software; you can redistribute it and/or
00007 * modify it under the terms of the GNU Library General Public
00008 * License as published by the Free Software Foundation; either
00009 * version 2 of the License, or (at your option) any later version.
00010 *
00011 * This library is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014 * Library General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU Library General Public
00017 * License along with this library; if not, write to the Free
00018 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 *****************************************************************************
00020 * File: sgluMouse.hpp
00021 * Created: 22 March 1997
00022 * Summary: a struct to store state of the mouse in the current window.
00023 * -- was dmGLMouse.hpp
00024 *****************************************************************************/
00025
00026 #ifndef __SGLU_MOUSE_HPP
00027 #define __SGLU_MOUSE_HPP
00028
00029 #include <sglu.h>
00030
00031 //----------------------------------------------------------------------------
00032
00033 struct SGLU_DLL_API sgluMouse
00034 {
00035 enum {eLEFT_DOWN = 0x01,
00036 eMIDDLE_DOWN = 0x02,
00037 eRIGHT_DOWN = 0x04};
00038
00039 int win_size_x;
00040 int win_size_y;
00041
00042 int in_window_flag; // TRUE if mouse is in window
00043 int button_flags; // bitmasks 4,2,1 for right,middle,left buttons
00044 int xwin, ywin; // position within window
00045 float xchan, ychan; // normalized window position
00046
00047 // not thread safe - only one mouse handle exists and is returned by the
00048 static sgluMouse* initialize();
00049
00050 ~sgluMouse() {};
00051
00052 static void handleEntry(int state);
00053 static void handleMouse(int button, int state, int x, int y);
00054 static void handleMotion(int x, int y);
00055 static void handlePassiveMotion(int x, int y);
00056
00057 protected:
00058 sgluMouse() {};
00059
00060 private: // not implemented
00061 sgluMouse(const sgluMouse &);
00062 sgluMouse &operator=(const sgluMouse &);
00063 };
00064
00065 #endif
00066
00067
1.2.6 written by Dimitri van Heesch,
© 1997-2001