casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtDisplayDataGui.qo.h
Go to the documentation of this file.
00001 //# QtDisplayDataGui.qo.h: Qt options widget for single DisplayData
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef QTDisplayDataGui_H
00029 #define QTDisplayDataGui_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/QtAutoGui/QtAutoGui.qo.h>
00033 #include <display/QtViewer/QtDisplayData.qo.h>
00034 #include <casa/Containers/Record.h>
00035 
00036 #include <graphics/X11/X_enter.h>
00037 #  include <QDir>
00038 #  include <QColor>
00039 #  include <QHash>
00040 #include <graphics/X11/X_exit.h>
00041 
00042  
00043 namespace casa { //# NAMESPACE CASA - BEGIN
00044 
00045 class QtViewer;
00046 
00047 // <summary>
00048 // Qt options widget for single DisplayData.
00049 // </summary>
00050 
00051 // <synopsis>
00052 // QtDisplayDataGui is a thin layer over a QtAutoGui base, to
00053 // provide the options widget for a single QtDisplayData.  It is normally
00054 // in a tab of a QtDataOptionsPanel.  Unlike QtAutoGui, which is
00055 // intended to be generic and reusable for other purposes, QtDisplayDataGui   
00056 // knows about a QtDisplayData; QtDisplayDataGui makes the communication
00057 // connections between its QtDisplayData and QtAutoGui.
00058 // </synopsis>
00059 
00060 //class QtDisplayDataGui : protected QtAutoGui {
00061 class QtDisplayDataGui : public QtAutoGui {
00062   
00063   Q_OBJECT      //# Allows slot/signal definition.  Must only occur in
00064                 //# implement/.../*.h files; also, makefile must include
00065                 //# name of this file in 'mocs' section.
00066    
00067  public:
00068   
00069   // Always pass a valid QtDisplayData* when creating QtDisplayDataGui,
00070   // and use it only as long as the QtDisplayData* remains valid
00071   QtDisplayDataGui(QtDisplayData* qdd) : QtAutoGui(), qdd_(qdd) {
00072   
00073     setFileName((qdd_->name()+".opts").c_str());
00074     
00075     loadRecord(qdd_->getOptions());     //# populate gui
00076     
00077     //# set up communication between gui and qdd_.
00078     
00079 /*     
00080     QtAutoGui* thisAutoGui = this;
00081       
00082     connect( thisAutoGui, SIGNAL(setOptions(Record)),
00083              qdd_,        SLOT(setOptions(Record)) );
00084     connect( qdd_,         SIGNAL(optionsChanged(Record)),
00085              thisAutoGui,  SLOT(changeOptions(Record)) );  }
00086 */  
00087     
00088    
00089     connect( this, SIGNAL(setOptions(Record)),
00090              qdd_,   SLOT(setOptions(Record)) );
00091     //cerr<<" QDDG cn: this:"<<this<<" qdd:"<<qdd_<<endl;       //#diag
00092 
00093     connect( qdd_, SIGNAL(optionsChanged(Record)),
00094                      SLOT(changeOptions(Record)) );  }
00095  
00096 
00097     
00098   ~QtDisplayDataGui() {  }
00099 
00100    
00101  protected:
00102   
00103   QtDisplayData* qdd_;
00104         //# (QtDisplayDataGui is not responsible for destroying qdd_).
00105   
00106   // Not to be used; QtDisplayDataGui must be created with a valid
00107   // QtDisplayData*.
00108   QtDisplayDataGui() {  }
00109   
00110 };
00111 
00112 } //# NAMESPACE CASA - END
00113 
00114 #endif