Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

glutm/winexam.h

Go to the documentation of this file.
00001 #ifndef GLUTM_WINEXAM_H
00002 #define GLUTM_WINEXAM_H
00003 
00004 /*
00005 
00006   GLT OpenGL C++ Toolkit (LGPL)
00007   Copyright (C) 2000-2002 Nigel Stewart  
00008 
00009   Email: nigels.com@gmail.com   
00010   WWW:   http://www.nigels.com/glt/
00011 
00012   This library is free software; you can redistribute it and/or
00013   modify it under the terms of the GNU Lesser General Public
00014   License as published by the Free Software Foundation; either
00015   version 2.1 of the License, or (at your option) any later version.
00016 
00017   This library is distributed in the hope that it will be useful,
00018   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020   Lesser General Public License for more details.
00021 
00022   You should have received a copy of the GNU Lesser General Public
00023   License along with this library; if not, write to the Free Software
00024   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 */
00027 
00033 #include <glutm/window.h>
00034 #include <math/matrix4.h>
00035 #include <glt/project.h>
00036 
00042 class GlutWindowExaminer : public GlutWindow
00043 {
00044 public:
00046     GlutWindowExaminer
00047     (
00048         const std::string &title = titleDefault,
00049         int width                = widthDefault, 
00050         int height               = heightDefault,
00051         int x                    = xDefault, 
00052         int y                    = yDefault,
00053         unsigned int displayMode = displayModeDefault
00054     );
00056     virtual ~GlutWindowExaminer();
00057 
00058     void OnOpen();
00059     void OnClose();
00060     void OnReshape(int w, int h);   
00061     void OnKeyboard(unsigned char key, int x, int y);
00062     void OnSpecial(int key, int x, int y);   
00063     void OnMenu(int value);
00064     void OnMouse(int button, int state, int x, int y);
00065     void OnMotion(int x, int y);
00066     void OnPassiveMotion(int x, int y);
00067 
00069     virtual void OnOrient(const Matrix &viewing,const Matrix &inverse);
00070 
00072     virtual Vector getReferencePoint(int x,int y,const Vector &pos,const Matrix &modelView,const Matrix &modelViewInverse) const;
00073 
00075     Vector &referencePoint();
00076 
00077     //
00078     // Config
00079     //
00080 
00082     bool &mouseZoom();
00084     bool &mousePan();
00086     bool &mouseRotate();
00087 
00089     typedef enum
00090     {
00091         MODE_MOUSE_ONLY = 0,
00092         MODE_MOUSE_RIGHT,
00093         MODE_MAX
00094     } MouseMode;
00095     
00097     MouseMode &mouseMode();
00098         
00099 protected:
00100 
00102     bool mousePressed() const;
00103 
00105     Vector xAxisOfRotation() const;
00107     Vector yAxisOfRotation() const;
00109     Vector axisOfRotation(const Vector &v) const;
00110 
00112     void OnPreDisplay();
00113 
00115     Vector dragPos(const int x,const int y) const;  
00116 
00118     Matrix    _viewMatrix;
00120     Matrix    _viewMatrixInverse;       
00121 
00122     GltOrtho  _ortho;
00123 
00124 private:
00125 
00126     bool      _mouseZoom;
00127     bool      _mousePan;
00128     bool      _mouseRotate;
00129     
00130     MouseMode _mouseMode;
00131     
00133     Vector    _referencePoint;
00134 
00135     //
00136     //
00137     //
00138 
00139     bool   _mouseLeft;
00140     bool   _mouseMiddle;
00141     bool   _mouseRight;
00142     int    _mouseX;
00143     int    _mouseY;
00144     bool   _wasIdle;                // Stop idle while manipulating with mouse
00145     int    _oldCursor;              // Remember old cursor while manipulating
00146     Vector _dragPosPrev;
00147 };
00148 
00149 #endif

Generated on Tue Nov 5 11:11:04 2002 for GLT by doxygen1.2.18