casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtViewer.qo.h
Go to the documentation of this file.
00001 //# QtViewer.qo.h: Qt implementation of main viewer supervisory object
00002 //#              -- Gui level.
00003 //# Copyright (C) 2005
00004 //# Associated Universities, Inc. Washington DC, USA.
00005 //#
00006 //# This library is free software; you can redistribute it and/or modify it
00007 //# under the terms of the GNU Library General Public License as published by
00008 //# the Free Software Foundation; either version 2 of the License, or (at your
00009 //# option) any later version.
00010 //#
00011 //# This library is distributed in the hope that it will be useful, but WITHOUT
00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00014 //# License for more details.
00015 //#
00016 //# You should have received a copy of the GNU Library General Public License
00017 //# along with this library; if not, write to the Free Software Foundation,
00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00019 //#
00020 //# Correspondence concerning AIPS++ should be addressed as follows:
00021 //#        Internet email: aips2-request@nrao.edu.
00022 //#        Postal address: AIPS++ Project Office
00023 //#                        National Radio Astronomy Observatory
00024 //#                        520 Edgemont Road
00025 //#                        Charlottesville, VA 22903-2475 USA
00026 //#
00027 //# $Id$
00028 
00029 #ifndef QTVIEWER_H
00030 #define QTVIEWER_H
00031 #include <list>
00032 #include <string>
00033 #include <display/QtViewer/QtViewerBase.qo.h>
00034 
00035 #include <graphics/X11/X_enter.h>
00036 #  include <QObject>
00037 #include <graphics/X11/X_exit.h>
00038 
00039 namespace casa { //# NAMESPACE CASA - BEGIN
00040 
00041 class QtDBusViewerAdaptor;
00042 class QtDisplayPanelGui;
00043 class QtCleanPanelGui;
00044 
00045 // <summary>
00046 // Qt implementation of main viewer supervisory object -- Gui level.
00047 // </summary>
00048 
00049 // <synopsis>
00050 // A QtViewer app should use just one QtViewer object, in all
00051 // Probability; the rest of the objects will coordinate through it.
00052 // 
00053 // The viewer is structured with a functional layer and a gui layer.
00054 // In principle the former can operate without the latter.
00055 // This class contains and manages various _gui_ objects associated with
00056 // the viewer.  Its base manages the corresponding functional objects.
00057 //
00058 //   Functional objects     Related Gui objects
00059 //   ------------------     -------------------
00060 //      QtViewerBase        QtViewer, QtDataManager, print dialog
00061 //      QtDisplayData       QtDataOptionsPanel
00062 //      QtDisplayPanel      QtDisplayPanelGui, panel options dialog
00063 //
00064 //      QtDisplayPanel _is_ also a display widget, but minimal,
00065 //      without surrounding graphical interface (animator, menus, etc.)
00066 //      to operate it.
00067 //
00068 // </synopsis>
00069 
00070 class QtViewer : public QtViewerBase {
00071 
00072   Q_OBJECT      //# Allows slot/signal definition.  Must only occur in
00073                 //# implement/.../*.h files; also, makefile must include
00074                 //# name of this file in 'mocs' section.
00075 
00076  public:
00077   
00078   QtViewer( const std::list<std::string> &args, bool is_server=false, const char *dbus_name=0 );
00079   ~QtViewer();
00080 
00081   // Called from casaviewer.cc, true indicates that this application has been activated,
00082   // false indicates that it has been deactivated. The application (with OSX anyway)
00083   // becomes deactivated when it looses application focus, e.g. when the user moves
00084   // to "mission control" etc. This is useful for signaling that the mouse has left
00085   // the display window... (in these cases where it leaves without dragging out)
00086   void activate( bool );
00087 
00088   // name used to initialize connection to dbus
00089   static const QString &name( );
00090 
00091  public slots:
00092  
00093   // create a main display panel Gui 
00094   virtual QtDisplayPanelGui *createDPG();
00095   virtual QtCleanPanelGui *createInteractiveCleanGui( );
00096    
00097   // Exits Qt loop.  (Note that the loop can be restarted (and is, in
00098   // interactive clean, e.g.), with existing widgets intact.  This
00099   // does not in itself delete objects or exit the process, although
00100   // the driver program might do that).  Also, some of the panels may
00101   // have WA_DeleteOnClose set, which would cause their deletion (see,
00102   // e.g., createDPG()).
00103   virtual void quit();
00104  
00105  
00106  private slots:
00107          void dpgDestroyed(QObject*);
00108 
00109  protected:
00110  
00111   QtDBusViewerAdaptor* dbus_;
00112   std::list<std::string> args_;
00113 
00114  private:
00115   static QString name_;
00116   QString dbus_name_;
00117   bool is_server_;
00118   typedef vector<QtDisplayPanelGui*> panel_list_t;
00119   panel_list_t panels;
00120     
00121 };
00122 
00123 
00124 
00125 } //# NAMESPACE CASA - END
00126 
00127 #endif