00001 /* 00002 * The information in this file is 00003 * Copyright(c) 2007 Ball Aerospace & Technologies Corporation 00004 * and is subject to the terms and conditions of the 00005 * GNU Lesser General Public License Version 2.1 00006 * The license text is available from 00007 * http://www.gnu.org/licenses/lgpl.html 00008 */ 00009 00010 #ifndef VIEWWINDOW_H 00011 #define VIEWWINDOW_H 00012 00013 #include "Window.h" 00014 #include "TypesFile.h" 00015 00016 #include <string> 00017 00018 class QWidget; 00019 class View; 00020 00021 /** 00022 * A window that displays a view. 00023 * 00024 * A view window is an abstract base class for windows to display a single 00025 * widget that can be either a View object or a generic QWidget. Since 00026 * the window contains a single widget, the current image can be printed 00027 * as well. 00028 * 00029 * This subclass of Subject will notify upon the following conditions: 00030 * - The following methods are called: createView(), setWidget() 00031 * - Everything documented in Window. 00032 * 00033 * @see Window 00034 */ 00035 class ViewWindow : public Window 00036 { 00037 public: 00038 /** 00039 * Emitted just before the widget is set into the window. 00040 * 00041 * @see setWidget() 00042 */ 00043 SIGNAL_METHOD(ViewWindow, AboutToSetWidget) 00044 00045 /** 00046 * Emitted after the widget is set into the window with boost::any<QWidget*> 00047 * containing a pointer to the widget that was set. 00048 * 00049 * @see setWidget() 00050 */ 00051 SIGNAL_METHOD(ViewWindow, WidgetSet) 00052 00053 /** 00054 * Creates the view based on a given type. 00055 * 00056 * This method creates a view and sets it as the display widget in the 00057 * window. This method does nothing for SpatialDataWindow and ProductWindow 00058 * objects since a view is already created by default. 00059 * 00060 * @param viewName 00061 * The name for the view. Depending on the view type, the name 00062 * may appear in the view's title bar. 00063 * @param viewType 00064 * The type of the view to be created. 00065 * 00066 * @return A pointer to the created view. NULL is returned if the view 00067 * is already created or if an error occurred. 00068 * 00069 * @notify This method will notify signalAboutToSetWidget() just before the 00070 * created view is set into the window and signalWidgetSet() just 00071 * after the view is set with boost::any<QWidget*> containing a 00072 * pointer to the view that is set into the window. 00073 * 00074 * @see ViewType, setWidget() 00075 */ 00076 virtual View* createView(const std::string& viewName, const ViewType& viewType) = 0; 00077 00078 /** 00079 * Returns a pointer to the view. 00080 * 00081 * @return A pointer to the view displayed in the window. NULL is returned 00082 * if a view has not been created, or if the window is displaying a 00083 * custom widget. 00084 */ 00085 virtual View* getView() const = 0; 00086 00087 /** 00088 * Sets the widget to be displayed in the window. 00089 * 00090 * This method sets the view window to display a custom Qt widget instead of 00091 * a View. This method does nothing for SpatialDataWindow and ProductWindow 00092 * objects since by default, they contain a view. 00093 * 00094 * @param pWidget 00095 * The Qt widget to set in the view window. Cannot be NULL. 00096 * 00097 * @notify This method will notify signalAboutToSetWidget() just before the 00098 * widget is set into the window and signalWidgetSet() just after 00099 * the widget is set with boost::any<QWidget*> containing a pointer 00100 * to the widget that is set into the window. 00101 */ 00102 virtual void setWidget(QWidget* pWidget) = 0; 00103 00104 /** 00105 * Returns the current widget in the window. 00106 * 00107 * @return A pointer to the widget in the view window. If a View is 00108 * displayed, the widget displaying the View is returned. NULL is 00109 * returned if no widget exists or the widget cannot be accessed. 00110 * 00111 * @see setWidget() 00112 */ 00113 virtual QWidget* getWidget() const = 0; 00114 00115 /** 00116 * Sends the current image displayed in the window to the printer. 00117 * 00118 * @param bSetupDialog 00119 * Set this value to TRUE to display the print options dialog 00120 * before printing. 00121 */ 00122 virtual void print(bool bSetupDialog = false) = 0; 00123 00124 protected: 00125 /** 00126 * This should be destroyed by calling DesktopServices::deleteWindow. 00127 */ 00128 virtual ~ViewWindow() {} 00129 }; 00130 00131 #endif