Window.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 WINDOW_H
00011 #define WINDOW_H
00012 
00013 #include "SessionItem.h"
00014 #include "Subject.h"
00015 #include "TypesFile.h"
00016 
00017 #include <string>
00018 
00019 /**
00020  *  The basic object in which to display data to the user.
00021  *
00022  *  This class is a base class for displaying data to the user.  The main
00023  *  application can create and manage several types of windows.  Every
00024  *  window has a name and a type that is used to uniquely identify itself
00025  *  within the application.
00026  *
00027  *  This subclass of Subject will notify upon the following conditions:
00028  *  - The following method is called: setName().
00029  *  - Everything else documented in Subject.
00030  *
00031  *  @see     DesktopServices
00032  */
00033 class Window : public SessionItem, public Subject
00034 {
00035 public:
00036    /**
00037     *  This interface is implemented by objects wishing to selectively accept drop events.
00038     *
00039     *  @see signalSessionItemDropped()
00040     */
00041    class SessionItemDropFilter
00042    {
00043    public:
00044       /**
00045        *  Accept the drop of the SessionItem.
00046        *
00047        *  @param pItem
00048        *         The SessionItem in the drop event.
00049        *  @return True to accept the drop, false otherwise.
00050        */
00051       virtual bool accept(SessionItem *pItem) const = 0;
00052 
00053    protected:
00054       virtual ~SessionItemDropFilter() {}
00055    };
00056 
00057    /**
00058     *  Emitted with any<SessionItem*> for each SessionItem dropped onto the window.
00059     *
00060     *  If a single signal with all SessionItems involved in a dropEvent() is needed, see
00061     *  signalSessionItemsDropped().
00062     */
00063    SIGNAL_METHOD(Window, SessionItemDropped)
00064 
00065    /**
00066     *  Emitted with any<vector<SessionItem*> > when one or more SessionItems are dropped onto the window.
00067     *  All SessionItems are included in this signal. See signalSessionItemDropped() if a separate signal for each
00068     *  SessionItem is needed.
00069     */
00070    SIGNAL_METHOD(Window, SessionItemsDropped)
00071 
00072    /**
00073     *  Sets the window name.
00074     *
00075     *  @param   windowName
00076     *           The new name for the window.  Cannot be empty.
00077     *
00078     *  @notify  This method will notify Subject::signalModified.
00079     */
00080    virtual void setName(const std::string& windowName) = 0;
00081 
00082    /**
00083     *  Returns the window type.
00084     *
00085     *  @return  The window type.
00086     *
00087     *  @see     WindowType
00088     */
00089    virtual WindowType getWindowType() const = 0;
00090 
00091    /**
00092     *  Enable dropping of SessionItems via drag and drop.
00093     *
00094     *  Windows can accept drag and drop events by calling this method.
00095     *  Once enabled signalSessionItemDropped() is emmitted for each
00096     *  SessionItem dropped into this Window. If the caller wishes to
00097     *  selectively accept drops, the SessionItemDropFilter parameter should
00098     *  be non-null.
00099     *
00100     *  @param pFilter
00101     *         If this is NULL, all SessionItems will be accepted. If non-NULL,
00102     *         the filter will be added to the filter list. Each filter registered
00103     *         will be checked for acceptance of the drop until one accepts. The caller
00104     *         maintains ownership of the filter.
00105     */
00106    virtual void enableSessionItemDrops(SessionItemDropFilter *pFilter = NULL) = 0;
00107 
00108 protected:
00109    /**
00110     * This should be destroyed by calling DesktopServices::deleteWindow.
00111     */
00112    virtual ~Window() {}
00113 };
00114 
00115 #endif

Software Development Kit - Opticks 4.9.0 Build 16218