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 DESKTOPSERVICES_H 00011 #define DESKTOPSERVICES_H 00012 00013 #include "Service.h" 00014 #include "Subject.h" 00015 #include "TypesFile.h" 00016 00017 #include <string> 00018 #include <vector> 00019 00020 class Axis; 00021 class DataElement; 00022 class DockWindow; 00023 class FileDescriptor; 00024 class MenuBar; 00025 class MouseMode; 00026 class PlotSet; 00027 class PlotSetGroup; 00028 class PlotView; 00029 class PlotWidget; 00030 class PlugIn; 00031 class PlugInCallback; 00032 class ProductWindow; 00033 class Progress; 00034 class QAction; 00035 class QCursor; 00036 class QImage; 00037 class QWidget; 00038 class SessionItem; 00039 class Signature; 00040 class SpatialDataView; 00041 class View; 00042 class Window; 00043 class WorkspaceWindow; 00044 00045 /** 00046 * \ingroup ServiceModule 00047 * Interface to manage windows and to provide access to widgets in the main 00048 * application window. 00049 * 00050 * This subclass of Subject will notify upon the following conditions: 00051 * - A window is added to the main application window. 00052 * - A workspace window is activated within the main application window. 00053 * - A window is removed from the main application window. 00054 * - The main application window is closed. 00055 * - Everything else documented in Subject. 00056 */ 00057 class DesktopServices : public Subject 00058 { 00059 public: 00060 /** 00061 * Emitted with any<Window*> when a window is added to the main application 00062 * window. 00063 */ 00064 SIGNAL_METHOD(DesktopServices, WindowAdded) 00065 00066 /** 00067 * Emitted with any<Window*> when a window is removed from the main 00068 * application window. 00069 */ 00070 SIGNAL_METHOD(DesktopServices, WindowRemoved) 00071 00072 /** 00073 * Emitted with any<WorkspaceWindow*> when a workspace window is activated 00074 * in the main application window. 00075 */ 00076 SIGNAL_METHOD(DesktopServices, WindowActivated) 00077 00078 /** 00079 * Emitted when the properties dialog is about to be displayed with 00080 * boost::any<std::pair<SessionItem*, std::vector<std::string>*> > 00081 * containing the session item whose properties will be displayed and a 00082 * pointer to a vector to which additional properties pages can be 00083 * displayed. 00084 */ 00085 SIGNAL_METHOD(DesktopServices, AboutToShowPropertiesDialog) 00086 00087 /** 00088 * Emitted with boost::any<ContextMenu*> when the user right-clicks to 00089 * invoke a context menu. 00090 * 00091 * This signal provides a means by which an object can be notified when a 00092 * context menu is invoked when the user clicks on any session item. To 00093 * receive notification when the user clicks inside a specific session 00094 * item, attach to the AboutToShowContextMenu signal of that particular 00095 * session item instead. 00096 * 00097 * This signal is emitted after SessionItem::getContextMenuActions() is 00098 * called and before the session item's own signal is emitted and before 00099 * the context menu is shown to give attached objects a chance to add or 00100 * modify the context menu that will be displayed to the user. 00101 * 00102 * The ContextMenu pointer value is guaranteed to be non-\c NULL. The 00103 * session items vector in the context menu contains the plot widget and 00104 * the plot view. 00105 * 00106 * @see \ref callingsequence "Context menu calling sequence" 00107 */ 00108 SIGNAL_METHOD(DesktopServices, AboutToShowContextMenu) 00109 00110 /** 00111 * Emitted when the main application window is closed. 00112 * 00113 * The main application window is still fully created when this signal is 00114 * emitted. 00115 */ 00116 SIGNAL_METHOD(DesktopServices, ApplicationWindowClosed) 00117 00118 /** 00119 * Returns a pointer to the Qt widget for the main application window. 00120 * 00121 * The Qt widget for the main application window can be used as the 00122 * parent widget for dialogs and other GUIs in plug-ins. 00123 * 00124 * @return A pointer to the Qt widget for the main application window. The 00125 * widget should not be modified, but is provided for use as a parent 00126 * widget in plug-in dialogs or other GUI components. 00127 */ 00128 virtual QWidget* getMainWidget() const = 0; 00129 00130 /** 00131 * Returns the application menu bar located at the top of the main 00132 * application window. 00133 * 00134 * @return A pointer to the appliation menu bar. 00135 */ 00136 virtual MenuBar* getMainMenuBar() const = 0; 00137 00138 /** 00139 * Creates a window of a given type. 00140 * 00141 * @param windowName 00142 * Name to be assigned to the new window. Depending on the window 00143 * type, the name may appear in the window's title bar. 00144 * @param windowType 00145 * Type of the window to be created. 00146 * 00147 * @return A pointer to the window. NULL is returned if the window already 00148 * exists or an error occurred. 00149 * 00150 * @see WindowType, getWindow() 00151 */ 00152 virtual Window* createWindow(const std::string& windowName, WindowType windowType) = 0; 00153 00154 /** 00155 * Returns a pointer to the window with a given name and type. 00156 * 00157 * @param windowName 00158 * The window name. 00159 * @param windowType 00160 * The window type. 00161 * 00162 * @return A pointer to the window or NULL if no window exists with the 00163 * given name and type. 00164 * 00165 * @see getCurrentWorkspaceWindow() 00166 */ 00167 virtual Window* getWindow(const std::string& windowName, WindowType windowType) const = 0; 00168 00169 /** 00170 * Returns a pointer to the window with a given unique identifier. 00171 * 00172 * @param uniqueId 00173 * The unique identifier. 00174 * 00175 * @return A pointer to the window or \c NULL if no window exists with the 00176 * given unique identifier. 00177 */ 00178 virtual Window* getWindow(const std::string& uniqueId) const = 0; 00179 00180 /** 00181 * Retrieves all available windows of a given type. 00182 * 00183 * @param windowType 00184 * The window type. 00185 * @param windows 00186 * A reference to a vector that will be filled with pointers 00187 * to the available windows of the given window type. 00188 */ 00189 virtual void getWindows(WindowType windowType, std::vector<Window*>& windows) const = 0; 00190 00191 /** 00192 * Retrieves all available windows of a given type and its subtypes. 00193 * 00194 * This method retrieves all available windows of a given type and all 00195 * of its subtypes. For example, passing in 'WorkspaceWindow' as the 00196 * window type retrieves all available workspace windows, analysis 00197 * windows, and product windows. 00198 * 00199 * @param windowType 00200 * A string containing the base class name of the window type 00201 * for which to retrieve the windows. Cannot be empty. 00202 * @param windows 00203 * A reference to a vector that will be filled with pointers 00204 * to the available windows of the given window type and 00205 * subtypes. 00206 */ 00207 virtual void getWindows(const std::string& windowType, std::vector<Window*>& windows) const = 0; 00208 00209 /** 00210 * Retrieves all available windows of all types. 00211 * 00212 * @param windows 00213 * A reference to a vector that will be filled with pointers 00214 * to all available windows of all window types. 00215 */ 00216 virtual void getWindows(std::vector<Window*>& windows) const = 0; 00217 00218 /** 00219 * Returns the number of available windows of a given type. 00220 * 00221 * @param windowType 00222 * The window type for which to get the number of windows. 00223 * 00224 * @return The number of available windows of the given type. 00225 */ 00226 virtual unsigned int getNumWindows(WindowType windowType) const = 0; 00227 00228 /** 00229 * Returns the number of available windows of a given type and its 00230 * subtypes. 00231 * 00232 * This method retrieves the number of available windows of a given 00233 * type and all of its subtypes. For example, passing in 00234 * 'WorkspaceWindow' as the window type retrieves the number of 00235 * available workspace windows, analysis windows, and product windows. 00236 * 00237 * @param windowType 00238 * The window type for which to get the number of windows. 00239 * 00240 * @return The number of available windows of the given type. 00241 */ 00242 virtual unsigned int getNumWindows(const std::string& windowType) const = 0; 00243 00244 /** 00245 * Returns the total number of available windows of all types. 00246 * 00247 * @return The number of available windows of all types. 00248 */ 00249 virtual unsigned int getNumWindows() const = 0; 00250 00251 /** 00252 * Deletes the given window. 00253 * 00254 * This method deletes a given window; any view or widget contained in 00255 * the window is also deleted. 00256 * 00257 * WARNING: Windows or Toolbars provided by the application cannot 00258 * be deleted using this method, they will be cleaned up during 00259 * application close. 00260 * 00261 * @param pWindow 00262 * The window to delete. 00263 * 00264 * @return TRUE if the window was sucessfully deleted, otherwise FALSE. 00265 */ 00266 virtual bool deleteWindow(Window* pWindow) = 0; 00267 00268 /** 00269 * Deletes all windows. 00270 * 00271 * @warning Windows or toolbars provided by the application cannot be 00272 * deleted using this method. They will be cleaned up when the 00273 * application is closed. 00274 */ 00275 virtual void deleteAllWindows() = 0; 00276 00277 /** 00278 * Activates a workspace window. 00279 * 00280 * @param pWindow 00281 * The workspace window to activate. Cannot be NULL. 00282 * 00283 * @return TRUE if the window was successfully activated, otherwise 00284 * FALSE. 00285 */ 00286 virtual bool setCurrentWorkspaceWindow(WorkspaceWindow* pWindow) = 0; 00287 00288 /** 00289 * Gets a pointer to the currently active workspace window. 00290 * 00291 * @return A pointer to the active workspace window or NULL if no 00292 * workspace windows exist. 00293 * 00294 * @see getCurrentWorkspaceWindowName() 00295 */ 00296 virtual WorkspaceWindow* getCurrentWorkspaceWindow() const = 0; 00297 00298 /** 00299 * Retrieves the name of the active workspace window. 00300 * 00301 * @param windowName 00302 * A string that is populated with the name of the active 00303 * workspace window. The string is emptied if no workspace 00304 * window exists. 00305 * 00306 * @return TRUE if the current workspace window name was set 00307 * successfully or FALSE if no workspace window exists. 00308 * 00309 * @see getCurrentWorkspaceWindow() 00310 */ 00311 virtual bool getCurrentWorkspaceWindowName(std::string& windowName) const = 0; 00312 00313 /** 00314 * Returns the active view in the active workspace window. 00315 * 00316 * This is a convenience method that calls getCurrentWorkspaceWindow() and 00317 * then WorkspaceWindow::getActiveView(). 00318 * 00319 * @return A pointer to the active View in the active workspace window. 00320 * See the WorkspaceWindow::getActiveView() return value 00321 * documentation for details on the returned View pointer based on 00322 * the window type. 00323 * 00324 * @see WorkspaceWindow::getActiveView() 00325 */ 00326 virtual View* getCurrentWorkspaceWindowView() const = 0; 00327 00328 /** 00329 * Arranges all workspace windows in a cascading fashion. 00330 * 00331 * This method arranges all workspace windows in a cascading fashion 00332 * within the main application workspace area. 00333 * 00334 * @see tileWorkspaceWindows() 00335 */ 00336 virtual void cascadeWorkspaceWindows() = 0; 00337 00338 /** 00339 * Tiles all workspace windows within the main application workspace. 00340 * 00341 * This method resizes and arranges all workspace windows to fill the 00342 * entire main application workspace area. Windows are arranged in a 00343 * two row grid, horizontally in one row or vertically in one column based 00344 * on the TilingType parameter. 00345 * 00346 * @param eType 00347 * Orientation of the tiled windows 00348 * 00349 * @see cascadeWorkspaceWindows() 00350 */ 00351 virtual void tileWorkspaceWindows(TilingType eType = TILE_GRID) = 0; 00352 00353 /** 00354 * Tiles given workspace windows within the main application workspace. 00355 * 00356 * This method resizes and arranges the given workspace windows to fill 00357 * the entire main application workspace area. Windows are arranged in a 00358 * two row grid, horizontally in one row or vertically in one column based 00359 * on the TilingType parameter. The windows are displayed in the order they 00360 * are added to the vector. Workspace windows not in the given vector are 00361 * sent behind the tiled windows. 00362 * 00363 * @param windows 00364 * The windows to tile in the main application workspace area. 00365 * @param maxFirst 00366 * For an odd number of windows to tile, if this value is TRUE, 00367 * the first window in the vector will have its height extend 00368 * the full height of the workspace area. If the value is 00369 * FALSE, the last window in the vector will have its height 00370 * extend the full height of the workspace area. This parameter 00371 * is ignored if the vector contains an even number of windows. 00372 * @param eType 00373 * Orientation of the tiled windows. 00374 * 00375 * @return TRUE if the windows were successfully tiled, otherwise 00376 * FALSE. 00377 * 00378 * @see TilingType 00379 */ 00380 virtual bool tileWorkspaceWindows(const std::vector<WorkspaceWindow*>& windows, 00381 bool maxFirst = true, TilingType eType = TILE_GRID) = 0; 00382 00383 /** 00384 * Creates a view that is not contained in a window. 00385 * 00386 * This method creates a view that is not associated with a window. The 00387 * view is not managed in any way, so it should be deleted when necessary 00388 * by calling the deleteView() method. 00389 * 00390 * @param viewName 00391 * The view name. Cannot be empty. 00392 * @param viewType 00393 * The view type. If ViewType::PLOT_VIEW is passed in, a plot of 00394 * type PlotType::CARTESIAN_PLOT is created. 00395 * @param pParent 00396 * The Qt widget to use as the parent for the view. 00397 * 00398 * @return A pointer to the newly created View. 00399 * 00400 * @see createPlot() 00401 */ 00402 virtual View* createView(const std::string& viewName, ViewType viewType, QWidget* pParent = 0) = 0; 00403 00404 /** 00405 * Creates a plot view widget that is not contained in a window. 00406 * 00407 * This method creates a plot that is not associated with a window. The 00408 * plot is not owned by another object, so it should be deleted when 00409 * necessary by calling the deleteView() method. 00410 * 00411 * @param plotName 00412 * The plot name. Cannot be empty. 00413 * @param plotType 00414 * The plot type. 00415 * @param pParent 00416 * The Qt widget to use as the parent for the plot view widget. 00417 * 00418 * @return A pointer to the newly created plot view widget. 00419 * 00420 * @see createView() 00421 */ 00422 virtual PlotView* createPlot(const std::string& plotName, PlotType plotType, QWidget* pParent = 0) = 0; 00423 00424 /** 00425 * Destroys a view. 00426 * 00427 * This method is intended to destroy View objects created with the 00428 * createView() method. To destroy views displayed in a window, call 00429 * deleteWindow() instead. 00430 * 00431 * @param pView 00432 * The view to delete. Cannot be NULL. If the given view is 00433 * displayed in a window, the window is also destroyed. 00434 */ 00435 virtual void deleteView(View* pView) = 0; 00436 00437 /** 00438 * Queries a view to see if it is a kind of another view. 00439 * 00440 * This method check type compatibility between two views. This functionality 00441 * is different than TypeAwareObject::isKindOf() in that only View-derived 00442 * classes are checked. 00443 * 00444 * @param className 00445 * The name of the View-derived class to query. 00446 * @param viewName 00447 * The View-derived class name to check type compatibility. 00448 * 00449 * @return Returns true if the given view class name is a kind of the given 00450 * class name; otherwise returns false. 00451 */ 00452 virtual bool isKindOfView(const std::string& className, const std::string& viewName) = 0; 00453 00454 /** 00455 * Returns a list of inherited view class names for a given class name. 00456 * 00457 * This method populates a vector with the class names of all inherited View 00458 * class types. The given class name is used as the initial class for 00459 * populating the vector. For example, passing in "SpatialDataView" as a 00460 * class name populates a vector with the "SpatialDataView", "PerspectiveView", 00461 * and "View" strings. 00462 * 00463 * @param className 00464 * The view class name for which to get all view element types. 00465 * @param classList 00466 * This vector is populated with the class names of all inherited view 00467 * classes and the given class name. 00468 */ 00469 virtual void getViewTypes(const std::string& className, std::vector<std::string>& classList) = 0; 00470 00471 /** 00472 * Queries a layer to see if it is a kind of another layer. 00473 * 00474 * This method checks type compatibility between two layers. This functionality 00475 * is different than TypeAwareObject::isKindOf() in that only Layer-derived 00476 * classes are checked. 00477 * 00478 * @param className 00479 * The name of the Layer-derived class to query. 00480 * @param layerName 00481 * The Layer-derived class name to check type compatibility. 00482 * 00483 * @return Returns true if the given layer class name is a kind of the given 00484 * class name; otherwise returns false. 00485 */ 00486 virtual bool isKindOfLayer(const std::string& className, const std::string& layerName) = 0; 00487 00488 /** 00489 * Returns a list of inherited layer class names for a given class name. 00490 * 00491 * This method populates a vector with the class names of all inherited Layer 00492 * class types. The given class name is used as the initial class for 00493 * populating the vector. For example, passing in "RasterLayer" as a 00494 * class name populates a vector with the "RasterLayer" and "Layer" strings. 00495 * 00496 * @param className 00497 * The layer class name for which to get all layer element types. 00498 * @param classList 00499 * This vector is populated with the class names of all inherited layer 00500 * classes and the given class name. 00501 */ 00502 virtual void getLayerTypes(const std::string& className, std::vector<std::string>& classList) = 0; 00503 00504 /** 00505 * Derive a new Product from an existing View. 00506 * 00507 * This method creates a new ProductWindow and populates the view object with the specified View. 00508 * 00509 * @param pView 00510 * The View used to populate the new ProductWindow. 00511 * 00512 * @return The new ProductWindow or NULL if there was an error. 00513 */ 00514 virtual ProductWindow *deriveProduct(View *pView) = 0; 00515 00516 /** 00517 * Creates a widget that can contain multiple plot sets. 00518 * 00519 * This method creates widget that contains multiple plot sets, where an 00520 * information bar is displayed along the top of the widget to manage the 00521 * active plot set. 00522 * 00523 * @param pParent 00524 * The Qt widget to use as the parent for the plot set group 00525 * widget. If \c NULL is passed in, the widget is not owned by 00526 * another object, so it should be deleted when necessary by 00527 * calling the deletePlotSetGroup() method. 00528 * 00529 * @return A pointer to the newly created plot set group widget. 00530 * 00531 * @see createPlotSet(), createPlotWidget() 00532 */ 00533 virtual PlotSetGroup* createPlotSetGroup(QWidget* pParent = NULL) = 0; 00534 00535 /** 00536 * Destroys a plot set group widget. 00537 * 00538 * This method is intended to destroy plot set group widgets created with 00539 * the createPlotSetGroup() method. This method should not be called 00540 * if the plot set group widget has a valid parent widget, where the widget 00541 * will be destroyed automatically when its parent is destroyed. 00542 * 00543 * @param pPlotSetGroup 00544 * The plot set group widget to delete. 00545 */ 00546 virtual void deletePlotSetGroup(PlotSetGroup* pPlotSetGroup) = 0; 00547 00548 /** 00549 * Creates a plot set widget that can contain multiple plots. 00550 * 00551 * This method creates a tabbed widget that displays a plot widget on each 00552 * tab. To display multiple plot set widgets within a single widget, see 00553 * createPlotSetGroup() instead. 00554 * 00555 * @param plotSetName 00556 * The plot set name. This method does nothing if an empty string 00557 * is passed in. 00558 * @param pParent 00559 * The Qt widget to use as the parent for the plot set widget. If 00560 * \c NULL is passed in, the widget is not owned by another object, 00561 * so it should be deleted when necessary by calling the 00562 * deletePlotSet() method. 00563 * 00564 * @return A pointer to the newly created plot set widget. 00565 * 00566 * @see createPlotSetGroup(), createPlotWidget() 00567 */ 00568 virtual PlotSet* createPlotSet(const std::string& plotSetName, QWidget* pParent = NULL) = 0; 00569 00570 /** 00571 * Destroys a plot set widget. 00572 * 00573 * This method is intended to destroy plot set widgets created with the 00574 * createPlotSet() method. This method should not be called if the plot set 00575 * widget has a valid parent widget, where the plot set will be destroyed 00576 * automatically when its parent is destroyed. 00577 * 00578 * @param pPlotSet 00579 * The plot set widget to delete. 00580 */ 00581 virtual void deletePlotSet(PlotSet* pPlotSet) = 0; 00582 00583 /** 00584 * Creates a plot widget that is not contained in a plot set. 00585 * 00586 * This method creates a plot widget that is not associated with a plot 00587 * set. To display multiple plot widgets within a single widget, see 00588 * the createPlotSet() method instead. 00589 * 00590 * @param plotName 00591 * The plot name. This method does nothing if an empty string is 00592 * passed in. 00593 * @param plotType 00594 * The type of plot to create. 00595 * @param pParent 00596 * The Qt widget to use as the parent for the plot widget. If 00597 * \c NULL is passed in, the widget is not owned by another object, 00598 * so it should be deleted when necessary by calling the 00599 * deletePlotWidget() method. 00600 * 00601 * @return A pointer to the newly created plot widget. 00602 * 00603 * @see createPlot() 00604 */ 00605 virtual PlotWidget* createPlotWidget(const std::string& plotName, PlotType plotType, QWidget* pParent = 0) = 0; 00606 00607 /** 00608 * Destroys a plot widget. 00609 * 00610 * This method is intended to destroy plot widgets created with the 00611 * createPlotWidget() method. This method should not be called if the plot 00612 * widget has a valid parent widget, where the plot widget will be destroyed 00613 * automatically when its parent is destroyed. 00614 * 00615 * To destroy plot widgets displayed in a plot set, get the plot set 00616 * containing the plot widget and call PlotSet::deletePlot() instead. 00617 * 00618 * @param pPlot 00619 * The plot widget to delete. 00620 * 00621 * @see PlotWidget::getPlotSet() 00622 */ 00623 virtual void deletePlotWidget(PlotWidget* pPlot) = 0; 00624 00625 /** 00626 * Creates an axis widget that is not contained in a PlotWidget. 00627 * 00628 * @param position 00629 * The position where the axis will be displayed relative to a 00630 * plot view. The position defines how the tick marks are drawn 00631 * and how the text is oriented. 00632 * @param pParent 00633 * The Qt widget to use as the parent for the axis widget. The 00634 * parent widget assumes ownership of the axis widget and will 00635 * destroy the axis when it is destroyed. If \b NULL is passed in 00636 * the deleteAxis() method should be called to destroy the 00637 * widget. 00638 * 00639 * @return A pointer to the newly created Axis widget. 00640 */ 00641 virtual Axis* createAxis(AxisPosition position, QWidget* pParent = 0) = 0; 00642 00643 /** 00644 * Destroys an axis widget. 00645 * 00646 * This method is intended to destroy axis widgets that were created with 00647 * the createAxis() method. This method should not be called if the axis 00648 * widget was created with a valid Qt parent widget. 00649 * 00650 * @param pAxis 00651 * The Axis widget to delete. 00652 */ 00653 virtual void deleteAxis(Axis* pAxis) = 0; 00654 00655 /** 00656 * Initializes the keyboard shortcut in an action. 00657 * 00658 * This method initializes the keyboard shortcut in a given action from the 00659 * user-defined configuration settings. If the shortcut for the action 00660 * already exists in the configuration settings based on the given context, 00661 * QAction::setShortcut() is called with that shortcut value. If the 00662 * shortcut for the action does not exist in the configuration settings, an 00663 * entry is added with the value set to the current shortcut value in the 00664 * action. 00665 * 00666 * @param pAction 00667 * The action in which to initialize its keyboard shortcut. 00668 * @param shortcutContext 00669 * The context name for the keyboard shortcut of the action. When 00670 * the user edits keyboard shortcuts, the shortcuts are grouped 00671 * according to their context string. Contexts can be nested by 00672 * using a slash (/) between context levels. If the top-level 00673 * context name is the same as a plug-in name, the shortcut is 00674 * grouped under a single Plug-Ins context. This method does 00675 * nothing if an empty string is passed in. 00676 * 00677 * @see ToolBar::addButton(QAction*, const std::string&), 00678 * MenuBar::insertCommand() 00679 */ 00680 virtual void initializeAction(QAction* pAction, const std::string& shortcutContext) = 0; 00681 00682 /** 00683 * Creates the mouse mode. 00684 * 00685 * This method creates a mouse mode that is available to add to a view. 00686 * 00687 * @param modeName 00688 * The name for the mouse mode. Mouse mode names must be unique for 00689 * the view type to which they are added. 00690 * @param mouseCursor 00691 * An icon to use for the mouse cursor in XPM format. Cursor icons 00692 * can be any size, but typically cursors are 32 x 32 pixels in size 00693 * or less. Currently only black and white cursors are supported. 00694 * @param cursorMask 00695 * An icon to use as a mask for the cursor icon. The mask should 00696 * act as a bit mask indicating which cursor icon pixels should be 00697 * drawn and which pixels should be transparent. The size of the 00698 * icon should be the same as \e mouseCursor. 00699 * @param iHotX 00700 * The x-coordinate for the cursor hot spot. 00701 * @param iHotY 00702 * The y-coordinate for the cursor hot spot. 00703 * @param pAction 00704 * A Qt action associated with the mouse mode. When the mouse mode 00705 * is added to a view, a non-\c NULL value will add the action to the 00706 * main mouse mode action group containing the following mouse modes: 00707 * @arg "LayerMode" 00708 * @arg "MeasurementMode" 00709 * @arg "PanMode" 00710 * @arg "RotateMode" 00711 * @arg "ZoomInMode" 00712 * @arg "ZoomOutMode" 00713 * @arg "ZoomBoxMode" 00714 * 00715 * When the mouse mode is activated in the view, the action is toggled 00716 * on and the other actions in the group are toggled off. So, this 00717 * value should only be set if the action should be added to the action 00718 * group. 00719 * 00720 * @return A pointer to the newly created mouse mode. 00721 * 00722 * @see createMouseMode(const std::string&, const QCursor&, QAction*) const, 00723 * MouseMode, deleteMouseMode(), View::addMouseMode(), View::setMouseMode() 00724 */ 00725 virtual MouseMode* createMouseMode(const std::string& modeName, const char* const mouseCursor[], 00726 const char* const cursorMask[], int iHotX = 0, int iHotY = 0, QAction* pAction = NULL) const = 0; 00727 00728 /** 00729 * Creates the mouse mode. 00730 * 00731 * This overloaded method serves as a convenience to create a mouse mode 00732 * that is available to add to a view. 00733 * 00734 * @param modeName 00735 * The name for the mouse mode. Mouse mode names must be unique for 00736 * the view type to which they are added. 00737 * @param mouseCursor 00738 * The cursor that should be displayed when the mouse mode is active. 00739 * Cursors can be any size, but typically they are 32 x 32 pixels 00740 * in size or less. Currently only black and white cursors are 00741 * supported. 00742 * @param pAction 00743 * A Qt action associated with the mouse mode. When the mouse mode 00744 * is added to a view, a non-\c NULL value will add the action to the 00745 * main mouse mode action group containing the following mouse modes: 00746 * @arg "LayerMode" 00747 * @arg "MeasurementMode" 00748 * @arg "PanMode" 00749 * @arg "RotateMode" 00750 * @arg "ZoomInMode" 00751 * @arg "ZoomOutMode" 00752 * @arg "ZoomBoxMode" 00753 * 00754 * When the mouse mode is activated in the view, the action is toggled 00755 * on and the other actions in the group are toggled off. So, this 00756 * value should only be set if the action should be added to the action 00757 * group. 00758 * 00759 * @return A pointer to the newly created mouse mode. 00760 * 00761 * @see MouseMode, deleteMouseMode(), View::addMouseMode(), View::setMouseMode() 00762 */ 00763 virtual MouseMode* createMouseMode(const std::string& modeName, const QCursor& mouseCursor, 00764 QAction* pAction = NULL) const = 0; 00765 00766 /** 00767 * Deletes a mouse mode. 00768 * 00769 * This method deletes a mouse mode. The mode should have already been 00770 * removed from all applicable views. The MouseMode pointer is invalid after 00771 * calling this method. 00772 * 00773 * WARNING: Mouse modes provided by the application cannot be deleted using 00774 * this method, they will be cleaned up during application close. 00775 * 00776 * @param pMouseMode 00777 * The mouse mode to delete. 00778 * 00779 * @see MouseMode 00780 */ 00781 virtual void deleteMouseMode(MouseMode* pMouseMode) const = 0; 00782 00783 /** 00784 * Sets the application pan mode. 00785 * 00786 * This method sets the pan mode for the entire application. All 00787 * views in all windows use this pan mode when panning through the 00788 * view. 00789 * 00790 * @param panMode 00791 * The pan mode. 00792 * 00793 * @see PanMode 00794 */ 00795 virtual void setPanMode(PanModeType panMode) = 0; 00796 00797 /** 00798 * Returns the application pan mode. 00799 * 00800 * @return The pan mode. 00801 */ 00802 virtual PanModeType getPanMode() const = 0; 00803 00804 /** 00805 * Sets the current AOI pixel selection tool on the AOI toolbar. 00806 * 00807 * This method sets the current object that is created when the user adds a 00808 * new object to an AOI layer and the drawing mode that is used when the 00809 * user edits the layer with the mouse. The given object type and drawing 00810 * mode are set into the current AOI layer of the current view and into 00811 * each AOI layer that is activated in any view. To set the graphic object 00812 * type and drawing mode in the layer separately from the AOI toolbar, call 00813 * GraphicLayer::setCurrentGraphicObjectType() or AoiLayer::setMode() 00814 * instead. 00815 * 00816 * @param toolType 00817 * The new pixel selection tool. 00818 * @param modeType 00819 * The new pixel selection mode. 00820 * 00821 * @deprecated 00822 * This method is deprecated, and may be removed in a future 00823 * version.\ Use AoiToolBar::setSelectionTool() instead. 00824 */ 00825 virtual void setAoiSelectionTool(GraphicObjectType toolType, ModeType modeType) = 0; 00826 00827 /** 00828 * Sets the current AOI add mode on the AOI toolbar. 00829 * 00830 * @param mode 00831 * The new add mode. 00832 * 00833 * @deprecated 00834 * This method is deprecated, and may be removed in a future 00835 * version.\ Use AoiToolBar::setAddMode() instead. 00836 */ 00837 virtual void setAoiAddMode(AoiAddMode mode) = 0; 00838 00839 /** 00840 * Returns the current AOI pixel selection tool on the AOI toolbar. 00841 * 00842 * @return The current pixel selection tool. 00843 * 00844 * @deprecated 00845 * This method is deprecated, and may be removed in a future 00846 * version.\ Use AoiToolBar::getSelectionTool() instead. 00847 */ 00848 virtual GraphicObjectType getAoiSelectionTool() const = 0; 00849 00850 /** 00851 * Returns the current AOI pixel selection mode on the AOI toolbar. 00852 * 00853 * @return The current pixel selection mode. 00854 * 00855 * @deprecated 00856 * This method is deprecated, and may be removed in a future 00857 * version.\ Use AoiToolBar::getSelectionMode() instead. 00858 */ 00859 virtual ModeType getAoiSelectionMode() const = 0; 00860 00861 /** 00862 * Returns the current AOI add mode on the AOI toolbar. 00863 * 00864 * @return The current add mode. 00865 * 00866 * @deprecated 00867 * This method is deprecated, and may be removed in a future 00868 * version.\ Use AoiToolBar::getAddMode() instead. 00869 */ 00870 virtual AoiAddMode getAoiAddMode() const = 0; 00871 00872 /** 00873 * Sets the current annotation object on the Annotation toolbar. 00874 * 00875 * This method sets the current object that is created when the user adds a 00876 * new object to an annotation layer. The given object is set into the 00877 * current annotation layer of the current view and into each annotation 00878 * layer that is activated in any view. To set the graphic object in the 00879 * layer separately from the Annotation toolbar, call 00880 * GraphicLayer::setCurrentGraphicObjectType() instead. 00881 * 00882 * @param objectType 00883 * The new annotation object. 00884 */ 00885 virtual void setAnnotationObject(GraphicObjectType objectType) = 0; 00886 00887 /** 00888 * Retrieves the current annotation object on the Annotation toolbar. 00889 * 00890 * @return The current annotation object. 00891 */ 00892 virtual GraphicObjectType getAnnotationObject() const = 0; 00893 00894 /** 00895 * Loads data from a file. 00896 * 00897 * This method is used to open any type of data from a file. A file selection 00898 * dialog appears for the user to select a desired file and importer. If a 00899 * valid importer subtype is given, only the importers of that subtype are 00900 * available to the user; otherwise all importers are available. 00901 * 00902 * @param importerSubtype 00903 * The importer subtype for which to set the available importer in 00904 * the file selection dialog. Passing in an empty string allows all 00905 * importers to be available. 00906 * @param pProgress 00907 * The progress object to use when importing the data. If \b NULL 00908 * is passed in, a new progress object is created. 00909 * 00910 * @return Returns \b true if at least one or more data sets was successfully 00911 * loaded from the file. 00912 * @see importFile(const std::string&, Progress*, std::vector<DataElement*>&) 00913 */ 00914 virtual bool importFile(const std::string& importerSubtype = std::string(), Progress* pProgress = NULL) = 0; 00915 00916 00917 /** 00918 * Loads data from a file. 00919 * 00920 * This method is used to open any type of data from a file. A file selection 00921 * dialog appears for the user to select a desired file and importer. If a 00922 * valid importer subtype is given, only the importers of that subtype are 00923 * available to the user; otherwise all importers are available. 00924 * 00925 * @param importerSubtype 00926 * The importer subtype for which to set the available importer in 00927 * the file selection dialog. Passing in an empty string allows all 00928 * importers to be available. 00929 * @param pProgress 00930 * The progress object to use when importing the data. If \b NULL 00931 * is passed in, a new progress object is created. 00932 * @param importedElements 00933 * A vector that will be populated with the data elements that were 00934 * successfully imported from the user selected file. This vector 00935 * will be empty if the user cancels the import operation or no data 00936 * elements were successfully imported. 00937 * 00938 * @return Returns \b true if at least one or more data sets was successfully 00939 * loaded from the file. 00940 * @see importFile(const std::string&, Progress*) 00941 */ 00942 virtual bool importFile(const std::string& importerSubtype, Progress* pProgress, std::vector<DataElement*>& importedElements) = 0; 00943 00944 /** 00945 * Saves a session item to disk. 00946 * 00947 * This method is used to save data from a given session item to disk. A file 00948 * selection dialog is invoked for the user to select an exporter and a 00949 * filename in which the data will be saved. 00950 * 00951 * @param pItem 00952 * The session item to export. 00953 * @param pNewFileDescriptor 00954 * The FileDescriptor to use for export. If \c NULL is passed in, 00955 * a default FileDescriptor is created. 00956 * @param pProgress 00957 * The progress object to use when exporting the session item. If 00958 * \c NULL is passed in, a new progress object is created. 00959 * 00960 * @return Returns \c true if the session item was successfully saved to 00961 * disk; otherwise returns \c false. 00962 */ 00963 virtual bool exportSessionItem(SessionItem *pItem, FileDescriptor* pNewFileDescriptor = NULL, 00964 Progress* pProgress = NULL) = 0; 00965 00966 /** 00967 * Saves multiple session items to disk. 00968 * 00969 * This method is used to save data from multiple session items to disk. A 00970 * dialog is invoked for the user to select a directory in which the data 00971 * will be saved, the exporter, and the default file extension for the new 00972 * files. 00973 * 00974 * Each session item is saved to a separate file with a default name based 00975 * on the session item name. 00976 * 00977 * @param items 00978 * The session items to export. Each session item in the vector 00979 * must be of the same type returned by 00980 * TypeAwareObject::getObjectType(). 00981 * @param pProgress 00982 * The progress object to use when exporting the session items. 00983 * If \c NULL is passed in, a new progress object is created. 00984 * 00985 * @return Returns \c true if at least one session item was successfully 00986 * saved to disk. Returns \c false if no session items were 00987 * successfully saved or if the given session items are not all of 00988 * the same type. 00989 * 00990 * @see SessionItem::getName() 00991 */ 00992 virtual bool exportSessionItems(const std::vector<SessionItem*>& items, Progress* pProgress = NULL) = 0; 00993 00994 /** 00995 * Displays the main application online help page. 00996 * 00997 * @return TRUE if the browser was successfully launched with the main help page 00998 * displayed, otherwise FALSE. 00999 */ 01000 virtual bool displayHelpHome() const = 0; 01001 01002 /** 01003 * Displays a given help file. 01004 * 01005 * This method displays the given HTML help file by launching the default browser. 01006 * A specific target within the file can be displayed by appending the # operator 01007 * followed by the target name. 01008 * 01009 * @param filename 01010 * The existing HTML help file. 01011 * 01012 * @return TRUE if the browser was successfully launched with the file displayed, 01013 * otherwise FALSE. 01014 */ 01015 virtual bool displayHelp(const std::string& filename) const = 0; 01016 01017 /** 01018 * Invokes the properties dialog for a given session item. 01019 * 01020 * @param pItem 01021 * The session item for which to display its properties. This 01022 * method does nothing if \c NULL is passed in. 01023 * 01024 * @notify This method emits the signalAboutToShowPropertiesDialog() 01025 * signal just before the properties dialog is about to be 01026 * displayed. 01027 * 01028 * @see displayProperties(SessionItem*, const std::vector<std::string>&, bool) const 01029 */ 01030 virtual void displayProperties(SessionItem* pItem) const = 0; 01031 01032 /** 01033 * Invokes the properties dialog containing only certain page widgets for a 01034 * given session item. 01035 * 01036 * This method provides a means to hide default properties page widgets for 01037 * the given session item. Only the properties pages given in the vector 01038 * will be displayed in the properties dialog. 01039 * 01040 * @param pItem 01041 * The session item for which to display its properties. This 01042 * method does nothing if \c NULL is passed in. 01043 * @param displayedPages 01044 * The names of Properties plug-in page widgets to display in the 01045 * properties dialog. 01046 * @param bEmitSignal 01047 * Set this parameter to \c true to emit the 01048 * signalAboutToShowPropertiesDialog() signal just before the 01049 * dialog is shown. Set the parameter to \c false to not emit the 01050 * signal and prevent other objects from adding pages not 01051 * contained in \em displayedPages. 01052 * 01053 * @notify This method emits the signalAboutToShowPropertiesDialog() 01054 * signal just before the properties dialog is about to be 01055 * displayed if the \em bEmitSignal parameter is set to \c true. 01056 * 01057 * @see displayProperties(SessionItem*) const 01058 */ 01059 virtual void displayProperties(SessionItem* pItem, const std::vector<std::string>& displayedPages, 01060 bool bEmitSignal = true) const = 0; 01061 01062 /** 01063 * Displays a message on the main application status bar. 01064 * 01065 * This method displays a message on the status bar for five seconds. %Any message 01066 * currently displayed in the status bar is replaced. 01067 * 01068 * @param messageText 01069 * The message to display. Can be empty. 01070 */ 01071 virtual void setStatusBarMessage(const std::string& messageText) const = 0; 01072 01073 /** 01074 * Sets the state of the check box inside a suppressible message dialog. 01075 * 01076 * The check box state is stored in ConfigurationSettings. 01077 * 01078 * Please see \ref suppressiblemsgdlg for more details. 01079 * 01080 * @param id 01081 * The suppressible message dialog key that will be passed into ConfigurationSettings::getSetting() to set 01082 * the dialog's check box state. 01083 * 01084 * @param bState 01085 * The state of the check box inside the suppressible message dialog. 01086 * 01087 * @see getSuppressibleMsgDlgState(), showSuppressibleMsgDlg(), SuppressibleMsgDlg 01088 */ 01089 virtual void setSuppressibleMsgDlgState(const std::string& id, bool bState) = 0; 01090 01091 /** 01092 * Gets the state of the check box inside a suppressible message dialog. 01093 * 01094 * Please see \ref suppressiblemsgdlg for more details. 01095 * 01096 * @param id 01097 * This ID will be used to get the suppressible message dialog check box state from ConfigurationSettings::getSetting(). 01098 * 01099 * @return This method will return \c true if the state of the check box inside the suppressible message dialog is checked, 01100 * meaning that the dialog will not be shown again. If the dialog check box is not checked, then the method will 01101 * return \c false. 01102 * 01103 * @see setSuppressibleMsgDlgState(), showSuppressibleMsgDlg(), SuppressibleMsgDlg 01104 */ 01105 virtual bool getSuppressibleMsgDlgState(const std::string& id) = 0; 01106 01107 /** 01108 * Displays a suppressible message dialog that the user can disable by clicking on the check box inside the dialog. 01109 * 01110 * This method will display a suppressible message dialog based on its ID as long as its "don't show this again" 01111 * check box has not been checked. While this method shows the dialog, it's the dialog itself that 01112 * handles both showing and reading of the "don't show this again" check box state. 01113 * The icon that will be shown next to the message in the dialog will depend on the message type. 01114 * 01115 * Each suppressible message dialog must have its own unique ID. This ID will be passed into 01116 * ConfigurationSettings::getSetting() in order to get the dialog's current check box state. 01117 * 01118 * If a plug-in developer wanted to give the user more control on when the message dialog 01119 * gets displayed, the developer will have to write an option plug-in himself. For a example on how 01120 * this would be done, take a look at the OptionsSuppressibleMsgDlg class located in PlugInSamplerQt. 01121 * 01122 * Please see \ref suppressiblemsgdlg for more details. 01123 * 01124 * @param dialogTitle 01125 * The text that will appear on the suppressible message dialog title bar. 01126 * @param dialogMsg 01127 * The text that will be displayed inside the suppressible message dialog. 01128 * @param type 01129 * The type of message. 01130 * @param id 01131 * The message dialog ID that will be used to get the check box state from ConfigurationSettings::getSetting(). 01132 * @param pParent 01133 * The message box parent. If \em pParent is NULL, the main application window will be the parent. 01134 * 01135 * @see getSuppressibleMsgDlgState(), setSuppressibleMsgDlgState(), SuppressibleMsgDlg 01136 */ 01137 virtual void showSuppressibleMsgDlg(const std::string& dialogTitle, const std::string& dialogMsg, MessageType type, 01138 const std::string& id, QWidget* pParent = NULL) = 0; 01139 01140 /** 01141 * Displays a message box to the user. 01142 * 01143 * In interactive mode, this method displays a QMessageBox to the user. 01144 * It will not return until the user presses one of the buttons on the 01145 * message box. In batch mode, this method writes the caption and text to 01146 * standard out and returns the default button value. 01147 * 01148 * @param caption 01149 * The text to put on the window title bar 01150 * @param text 01151 * The message text for the dialog 01152 * @param button0 01153 * The label for the first button. If this string is empty, the 01154 * button will not be displayed. 01155 * @param button1 01156 * The label for the second button. If this string is empty, the 01157 * button will not be displayed. 01158 * @param button2 01159 * The label for the third button. If this string is empty, the 01160 * button will not be displayed. 01161 * @param defaultButton 01162 * The button that will be selected if the user simply presses 01163 * the 'Enter' key. If this value does not correspond to any 01164 * button, the 'Enter' key will be ignored. 01165 * @param escapeButton 01166 * The button that will be selected if the user simply presses 01167 * the 'Escape' key. If this value does not correspond to any 01168 * button, pressing the 'Escape' key will cause the dialog to be 01169 * dismissed and the value specified will be returned. 01170 * 01171 * @return The number of the button the user selected. 01172 */ 01173 virtual int showMessageBox(const std::string &caption, const std::string &text, 01174 const std::string &button0=std::string(), const std::string &button1=std::string(), 01175 const std::string &button2=std::string(), int defaultButton=0, 01176 int escapeButton=-1) const = 0; 01177 01178 /** 01179 * Adds a new background plug-in to the Background Plug-In %Window. 01180 * 01181 * This method adds an item to the background plug-in window that allows 01182 * the user to view progress and abort the plug-in if possible. The 01183 * method should be called after executing a background plug-in in 01184 * interactive mode. 01185 * 01186 * @param pPlugIn 01187 * The background plug-in to add to the Background Plug-In %Window. 01188 * @param pProgress 01189 * The (thread-safe) Progress object that the plug-in uses. 01190 */ 01191 virtual void addBackgroundPlugIn(PlugIn* pPlugIn, Progress* pProgress) const = 0; 01192 01193 /** 01194 * Registers a callback to the core. 01195 * 01196 * Valid callback types are enumerated in TypesFile.h. Currently, only 01197 * callbacks signaling background processing are supported. 01198 * 01199 * @param eType 01200 * The type of callback to register. 01201 * @param pCallback 01202 * The callback being registered. The application assumes 01203 * ownership of the callback object and deletes it after executing 01204 * the callback. The plug-in should not attempt to delete the 01205 * callback object itself. 01206 * 01207 * @return Returns \c true if the callback was registered properly; returns 01208 * \c false if there was an error registering or if an invalid 01209 * callback type was specified. 01210 * 01211 * @see PlugInCallbackType, Executable::isBackground() 01212 */ 01213 virtual bool registerCallback(PlugInCallbackType eType, PlugInCallback* pCallback) const = 0; 01214 01215 /** 01216 * Query the dock location of the specified DockWindow 01217 * 01218 * @param dockWindow 01219 * The DockWindow whose location is being queried 01220 * 01221 * @return the location of the DockWindow 01222 */ 01223 virtual DockWindowAreaType getDockWindowArea(const DockWindow &dockWindow) const = 0; 01224 01225 /** 01226 * Sets a DockWindow to the given dock area. 01227 * 01228 * @param pDockWindow 01229 * DockWindow to move. 01230 * 01231 * @param dockArea 01232 * Area to dock with. 01233 * 01234 * @return True if the operation was successful, false otherwise. 01235 */ 01236 virtual bool setDockWindowArea(DockWindow *pDockWindow, 01237 DockWindowAreaType dockArea) = 0; 01238 01239 /** 01240 * Attach a Progress object to an appropriate dialog. 01241 * 01242 * @param caption 01243 * A caption for the view. 01244 * 01245 * @param pProgress 01246 * The Progress object to attach. 01247 * 01248 * @returns True if successful, false otherwise. 01249 */ 01250 virtual bool createProgressDialog(const std::string &caption, Progress *pProgress) const = 0; 01251 01252 /** 01253 * Get a list of all available symbols for MultipointObjects. 01254 * 01255 * The list is formed from all supported files within the Annotation directory. 01256 * Only CGM files are currently supported. 01257 * 01258 * @returns A vector of strings containing the names of available symbols. 01259 */ 01260 virtual const std::vector<std::string> &getAvailableSymbolNames() const = 0; 01261 01262 /** 01263 * Get a QImage of the given symbol, for use with MultipointObjects. 01264 * 01265 * @param symbol 01266 * The name of the symbol to get the image of. This name 01267 * should be contained in the vector gotten from getAvailableSymbolNames(). 01268 * 01269 * @return A QImage containing the drawn symbol. 01270 */ 01271 virtual const QImage &getSymbolImage(const std::string &symbol) const = 0; 01272 01273 protected: 01274 /** 01275 * This will be cleaned up during application close. Plug-ins do not 01276 * need to destroy it. 01277 */ 01278 virtual ~DesktopServices() {} 01279 }; 01280 01281 #endif