Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

splitViewInterface.h

Go to the documentation of this file.
00001 //==============================================
00002 //  copyright            : (C) 2003-2005 by Will Stokes
00003 //==============================================
00004 //  This program is free software; you can redistribute it 
00005 //  and/or modify it under the terms of the GNU General 
00006 //  Public License as published by the Free Software 
00007 //  Foundation; either version 2 of the License, or  
00008 //  (at your option) any later version.         
00009 //==============================================
00010 
00011 #ifndef GUI_EDITING_SPLITVIEWINTERFACE_H
00012 #define GUI_EDITING_SPLITVIEWINTERFACE_H
00013 
00014 //--------------------
00015 //forward declarations
00016 //--------------------
00017 
00018 #include <qwidget.h>
00019 #include <qimage.h>
00020 
00022 typedef enum
00023 {  
00024   SPLIT_VIEW,
00025   ORIGINAL_IMAGE,
00026   ADJUSTED_IMAGE,
00027   INV_SPLIT_VIEW,
00028 } PREVIEW_MODE;
00029 
00031 typedef enum
00032 {  
00033   DRAG_SPLIT,
00034   NO_EFFECT_ON_SPLIT
00035 } PREVIEW_MOUSE_MODE;
00036 
00037 //=====================================
00042 //=====================================
00043 class SplitViewInterface : public QWidget
00044 {
00045 Q_OBJECT
00046 
00047 public:
00049   SplitViewInterface(QWidget *parent=0, 
00050                      const char* name=0);
00051   
00053   void setPreviewMode( PREVIEW_MODE mode, bool forceDrawLabel=false );
00054   
00055   virtual QSize sizeHint() const = 0;
00056   virtual QSize minimumSizeHint() const;
00057 
00058   //sets both orig and adjusted images and repaints
00059   void setImages( QImage origImage, QImage adjustedImage );
00060 
00062   void setAdjustedImage( QImage adjustedImage );
00063 
00065   QImage& getOrigImage();
00066   //----------------------
00067 protected:
00068   void paintEvent( QPaintEvent *e);
00069   void mousePressEvent( QMouseEvent *e);
00070   void mouseReleaseEvent( QMouseEvent *);
00071   void mouseMoveEvent( QMouseEvent *e);
00072 
00073   virtual void resizeEvent( QResizeEvent * ) = 0;
00074   //----------------------
00075 private:
00077   double displayToWorld( int coordinate );
00078   
00080   int worldToDisplay( double coordinate );
00081 
00083   bool nearSplitPoint( QPoint p );
00084   
00086   PREVIEW_MODE previewMode;  
00087   
00089   bool forceDrawLabel;
00090   
00092   QString originalString;
00093   QString adjustedString;
00094   
00096   QFont textFont;
00097 
00099   double dragOffset;
00100 
00102   PREVIEW_MOUSE_MODE mouseMode;
00103 
00106   PREVIEW_MOUSE_MODE currentMouseShape;
00107   
00109   QImage origImage;
00110   
00112   QImage adjustedImage;
00113   //----------------------
00114 };
00115 //======================
00116 
00117 #endif //GUI_EDITING_SPLITVIEWINTERFACE_H

Generated on Sat Apr 2 05:44:04 2005 for AlbumShaper by  doxygen 1.3.9.1