DockWindow.h

Go to the documentation of this file.
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 DOCKWINDOW_H
00011 #define DOCKWINDOW_H
00012 
00013 #include "ViewWindow.h"
00014 
00015 class QMenu;
00016 
00017 /**
00018  *  Settings, characteristics, and features for docking windows.
00019  *
00020  *  This class defines all of the services available to dock windows.  A dock
00021  *  window can attach to an edge of the main application window,or can float
00022  *  independently on the desktop.  When the user right-clicks in the window's
00023  *  context, a \ref contextmenus "context menu" is invoked allowing the user to
00024  *  change the display characteristics of the window.  The window also contains
00025  *  a button to hide itself.
00026  *
00027  *  This subclass of Subject will notify upon the following conditions:
00028  *  - The following methods are called: dock(), undock(), show(), and hide().
00029  *  - The user right-clicks in the window to invoke a context menu.
00030  *  - Everything documented in ViewWindow.
00031  *
00032  *  @see     ViewWindow
00033  */
00034 class DockWindow : public ViewWindow
00035 {
00036 public:
00037    /**
00038     *  Emitted when the window is docked.
00039     */
00040    SIGNAL_METHOD(DockWindow, Docked)
00041 
00042    /**
00043     *  Emitted when the window is undocked.
00044     */
00045    SIGNAL_METHOD(DockWindow, Undocked)
00046 
00047    /**
00048     *  Emitted when the window is shown.
00049     */
00050    SIGNAL_METHOD(DockWindow, Shown)
00051 
00052    /**
00053     *  Emitted when the window is hidden.
00054     */
00055    SIGNAL_METHOD(DockWindow, Hidden)
00056 
00057    /**
00058     *  Emitted with boost::any<ContextMenu*> when the user right-clicks to
00059     *  invoke a context menu.
00060     *
00061     *  This signal provides a means by which an object can be notified when a
00062     *  context menu is invoked by the user clicking inside a dock window.  To
00063     *  receive notification for when a context menu is invoked when the user
00064     *  clicks on any session item, attach to the
00065     *  DesktopServices::signalAboutToShowContextMenu() signal instead.
00066     *
00067     *  This signal is emitted after getContextMenuActions() is called and
00068     *  after the DesktopServices::signalAboutToShowContextMenu() signal is
00069     *  emitted, but before the context menu is shown to give attached objects a
00070     *  chance to add or modify the context menu that will be displayed to the
00071     *  user.
00072     *
00073     *  The ContextMenu pointer value is guaranteed to be non-\c NULL.  The
00074     *  session items vector in the context menu contains the dock window.
00075     *
00076     *  @see     \ref callingsequence "Context menu calling sequence"
00077     */
00078    SIGNAL_METHOD(DockWindow, AboutToShowContextMenu)
00079 
00080    /**
00081     *  Associates an icon with the dock window.
00082     *
00083     *  The icon associated with the dock window will appear in the session
00084     *  explorer.
00085     *
00086     *  @param   icon
00087     *           The icon to associate with the dock window.
00088     *
00089     *  @see     getIcon()
00090     */
00091    virtual void setIcon(const QIcon& icon) = 0;
00092 
00093    /**
00094     *  @copydoc SessionItem::getContextMenuActions()
00095     *
00096     *  @default The default implementation returns the context menu actions
00097     *           listed \ref dockwindow "here".  The default actions can be
00098     *           removed or additional actions can be added by attaching to the
00099     *           signalAboutToShowContextMenu() signal.
00100     */
00101    virtual std::list<ContextMenuAction> getContextMenuActions() const = 0;
00102 
00103    /**
00104     *  Attaches the view to the edge of the main application window.
00105     *
00106     *  A docked window is fixed to an adge of the application window and can be
00107     *  resized in one direction only.  The title bar is replaced by a gripper bar
00108     *  with small buttons to hide the window or maximize available space if other
00109     *  views are docked along the same wdge of the application window.  A docked
00110     *  window cannot be minimized or maximized.
00111     *
00112     *  @notify  This method will notify signalModified() if the window was
00113     *           successfully docked from a previously undocked state.
00114     *
00115     *  @see     undock()
00116     */
00117    virtual void dock() = 0;
00118 
00119    /**
00120     *  Floats a docked window over the desktop.
00121     *
00122     *  This method detaches a docked window from the main application window and
00123     *  floats it over the desktop.  The title bar reappears, and the window can
00124     *  be minimized and maximized.
00125     *
00126     *  @notify  This method will notify signalModified() if the window was
00127     *           successfully undocked from a previously docked state.
00128     *
00129     *  @see     dock()
00130     */
00131    virtual void undock() = 0;
00132 
00133    /**
00134     *  Shows the dock window.
00135     *
00136     *  This method displays the dock window in its former state, docked or floating.
00137     *  If the dock window is already displayed, this method does nothing.
00138     *
00139     *  @notify  This method will notify signalModified() if the window was
00140     *           successfully displayed from a previously hidden state.
00141     *
00142     *  @see     hide()
00143     */
00144    virtual void show() = 0;
00145 
00146    /**
00147     *  Hides the dock window.
00148     *
00149     *  This method hides the dock window but does not delete it.  A hidden dock window
00150     *  can be displayed again from the main application right-click menu.  If the dock
00151     *  window is already hidden, this method does nothing.
00152     *
00153     *  @notify  This method will notify signalModified() if the window was
00154     *           successfully hidden from a previously visible state.
00155     *
00156     *  @see     show()
00157     */
00158    virtual void hide() = 0;
00159 
00160    /**
00161     *  Returns the current visiblity state of the dock window.
00162     *
00163     *  @return  Returns \c true if the dock window is shown or \c false
00164     *           if the dock window is hidden.
00165     */
00166    virtual bool isShown() const = 0;
00167 
00168 protected:
00169    /**
00170     * This should be destroyed by calling DesktopServices::deleteWindow.
00171     */
00172    virtual ~DockWindow() {}
00173 };
00174 
00175 #endif

Software Development Kit - Opticks 4.9.0 Build 16218