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 class QtCleanPanelGui2; 00045 00046 // <summary> 00047 // Qt implementation of main viewer supervisory object -- Gui level. 00048 // </summary> 00049 00050 // <synopsis> 00051 // A QtViewer app should use just one QtViewer object, in all 00052 // Probability; the rest of the objects will coordinate through it. 00053 // 00054 // The viewer is structured with a functional layer and a gui layer. 00055 // In principle the former can operate without the latter. 00056 // This class contains and manages various _gui_ objects associated with 00057 // the viewer. Its base manages the corresponding functional objects. 00058 // 00059 // Functional objects Related Gui objects 00060 // ------------------ ------------------- 00061 // QtViewerBase QtViewer, QtDataManager, print dialog 00062 // QtDisplayData QtDataOptionsPanel 00063 // QtDisplayPanel QtDisplayPanelGui, panel options dialog 00064 // 00065 // QtDisplayPanel _is_ also a display widget, but minimal, 00066 // without surrounding graphical interface (animator, menus, etc.) 00067 // to operate it. 00068 // 00069 // </synopsis> 00070 00071 class QtViewer : public QtViewerBase { 00072 00073 Q_OBJECT //# Allows slot/signal definition. Must only occur in 00074 //# implement/.../*.h files; also, makefile must include 00075 //# name of this file in 'mocs' section. 00076 00077 public: 00078 00079 QtViewer( const std::list<std::string> &args, bool is_server=false, const char *dbus_name=0 ); 00080 ~QtViewer(); 00081 00082 // Called from casaviewer.cc, true indicates that this application has been activated, 00083 // false indicates that it has been deactivated. The application (with OSX anyway) 00084 // becomes deactivated when it looses application focus, e.g. when the user moves 00085 // to "mission control" etc. This is useful for signaling that the mouse has left 00086 // the display window... (in these cases where it leaves without dragging out) 00087 void activate( bool ); 00088 00089 // name used to initialize connection to dbus 00090 static const QString &name( ); 00091 00092 public slots: 00093 00094 // create a main display panel Gui 00095 virtual QtDisplayPanelGui *createDPG(); 00096 virtual QtDisplayPanelGui *createDPG(const QtDisplayPanelGui *); 00097 virtual QtCleanPanelGui *createInteractiveCleanGui( ); 00098 virtual QtCleanPanelGui2 *createInteractiveCleanGui2( ); 00099 00100 // Exits Qt loop. (Note that the loop can be restarted (and is, in 00101 // interactive clean, e.g.), with existing widgets intact. This 00102 // does not in itself delete objects or exit the process, although 00103 // the driver program might do that). Also, some of the panels may 00104 // have WA_DeleteOnClose set, which would cause their deletion (see, 00105 // e.g., createDPG()). 00106 virtual void quit(); 00107 00108 00109 private: 00110 friend class QtDisplayPanelGui; 00111 void dpgDeleted(QtDisplayPanelGui*); 00112 00113 protected: 00114 00115 QtDBusViewerAdaptor* dbus_; 00116 std::list<std::string> args_; 00117 00118 private: 00119 static QString name_; 00120 QString dbus_name_; 00121 bool is_server_; 00122 typedef vector<QtDisplayPanelGui*> panel_list_t; 00123 panel_list_t panels; 00124 00125 }; 00126 00127 00128 00129 } //# NAMESPACE CASA - END 00130 00131 #endif