debug/src/zoomwindow.h

00001 /***************************************************************************
00002                           floatrect.h  -  description
00003                              -------------------
00004     begin                : Thu Aug 21 2003
00005     copyright            : (C) 2003 by 
00006     email                : 
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef FLOATRECT_H
00019 #define FLOATRECT_H
00020 
00021 #include <qrect.h>
00022 #include <qpoint.h>
00023 #include <math.h>
00024 
00033 class ZoomWindow {
00034 
00035 public: 
00036 
00041   ZoomWindow(const QRect& rect);
00045   ~ZoomWindow();
00049 operator QRect() const;
00050 
00058 bool zoom(float factor, float centerX, float centerY);
00059 
00060 
00069 inline bool zoom(float factor, const QPoint& center){
00070   return zoom(factor, center.x(), center.y());
00071 };
00072 
00073 
00082 bool zoom(int firstClickX, int firstClickY, int secondClickX, int secondClickY);
00083 
00092 inline bool zoom(QPoint firstPoint, QPoint secondPoint) {
00093    return zoom(firstPoint.x(), firstPoint.y(), secondPoint.x(), secondPoint.y());
00094 };
00095 
00096 protected:
00100 void correctWindow();
00101 
00102 
00103 private:
00107 float left;
00111 float right;
00115 float bottom;
00119 float top;
00120 
00121 
00125 float initialLeft;
00129 float initialRight;
00133 float initialBottom;
00137 float initialTop;
00138 
00142 static const float MIN_SCALE;
00143 
00147 static const float MAX_SCALE;
00148 
00149 public:
00150 
00154 inline void reset(){
00155  left   = initialLeft;
00156  right  = initialRight;
00157  top    = initialTop;
00158  bottom = initialBottom;
00159 };
00160 
00161 };
00162 
00163 
00164 #endif

Generated on Mon Sep 17 20:47:31 2007 for NeuroScope by  doxygen 1.5.1