casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ImageScroll.qo.h
Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 #ifndef IMAGESCROLL_QO_H
00026 #define IMAGESCROLL_QO_H
00027 
00028 #include <display/QtViewer/ImageManager/ImageTracker.h>
00029 #include <QtGui/QWidget>
00030 
00031 class QDragMoveEvent;
00032 class QDragEnterEvent;
00033 class QDropEvent;
00034 class QMimeData;
00035 class QSpacerItem;
00036 
00037 namespace casa {
00038 
00039 class ImageView;
00040 class QtDisplayData;
00041 class DisplayDataHolder;
00042 
00047 class ImageScroll : public QWidget, public ImageTracker {
00048     Q_OBJECT
00049 
00050 public:
00051     ImageScroll(QWidget *parent = 0);
00052     void setImageHolder( DisplayDataHolder* holder );
00053     void setControllingDD( QtDisplayData* dd );
00054     QList<ImageView*> getSelectedViews();
00055 
00056     bool isManaged( QtDisplayData* displayData ) const;
00057     void closeImages();
00058     void addImageViews( QList<ImageView*>& views );
00059     void removeImageViews( QList<ImageView*>& view );
00060     void setSelectAll( bool selectAll);
00061     void setImageColorsEnabled( bool enabled );
00062     void applyColorChangesIndividually();
00063     bool findColor( const QString& lookup, QColor* foundColor );
00064     virtual ~ImageScroll();
00065 
00066     //Image Tracker Interface
00067     virtual void masterImageSelected( QtDisplayData* image );
00068     virtual void imageAdded( QtDisplayData* image );
00069     virtual void imageRemoved( QtDisplayData* image );
00070 
00071 signals:
00072         void displayDataRemoved( QtDisplayData* imageData );
00073         void displayDataAdded( QtDisplayData* imageData );
00074         void displayTypeChanged( ImageView* displayData );
00075         void displayColorsChanged( ImageView* displayData );
00076 
00077 protected:
00078         void dragEnterEvent( QDragEnterEvent* enterEvent );
00079     void dropEvent( QDropEvent* dropEvent );
00080     void dragMoveEvent( QDragMoveEvent* dragMoveEvent );
00081 
00082 private:
00083     ImageScroll( const ImageScroll& other );
00084     ImageScroll operator=( const ImageScroll& other );
00085     void addImage( ImageView* imageView );
00086     void closeImage( ImageView* imageView, bool deleteImage = true );
00087     ImageView* findImageView( const QString& name );
00088     ImageView* getMimeImageView( const QMimeData* mimeData );
00089     QSpacerItem* spacer;
00090     const int LAYOUT_SPACING;
00091     const int LAYOUT_MARGIN;
00092     QList<ImageView*> images;
00093     DisplayDataHolder* managedImages;
00094     bool imageColorsEnabled;
00095 };
00096 
00097 }
00098 
00099 #endif // IMAGESCROLL_QO_H