OptionShell.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 OPTIONSHELL_H
00011 #define OPTIONSHELL_H
00012 
00013 #include "Option.h"
00014 #include "PlugInShell.h"
00015 
00016 #include <string>
00017 
00018 /**
00019  *  \ingroup ShellModule
00020  * A base class for plug-in shells or plug-in instances.
00021  *
00022  * This class provides a default implementation of the Option
00023  * plug-in interfaces.
00024  *
00025  * This class should generally NOT be subclassed directly,
00026  * instead try using OptionQWidgetWrapper.
00027  *
00028  * @see Option, OptionQWidgetWrapper
00029  */
00030 class OptionShell : public Option, public PlugInShell
00031 {
00032 public:
00033    /**
00034     *  Creates the option plug-in.
00035     *
00036     *  The constructor sets the plug-in type to PlugInManagerServices::OptionType().
00037     *
00038     *  @see     getType()
00039     */
00040    OptionShell();
00041 
00042    /**
00043     *  Destroys the option plug-in.
00044     */
00045    virtual ~OptionShell();
00046 
00047    /**
00048     * @copydoc Option::getWidget()
00049     *
00050     * @default The default implementation will call
00051     * createOptionsWidget() once per instance of this
00052     * plug-in.
00053     */
00054    QWidget* getWidget();
00055 
00056    /**
00057     * @copydoc Option::getOptionName()
00058     *
00059     * @default The default implementation will return
00060     * value provided to setOptionName().
00061     */
00062    const std::string& getOptionName();
00063 
00064 protected:
00065    /**
00066     * This method should be implemented in 
00067     * subclasses and can directly new the 
00068     * QWidget* and initialize it.  It
00069     * guaranteed to called at most once
00070     * per instance of this plug-in.
00071     */
00072    virtual QWidget* createOptionsWidget() = 0;
00073 
00074    /**
00075     * Returns the currently stored QWidget*.
00076     * If getWidget() has not yet been called
00077     * NULL will be returned.  Otherwise, the
00078     * value of createOptionsWidget() will
00079     * have been stored and that value is
00080     * returned.
00081     */
00082    virtual QWidget* getStoredWidget();
00083 
00084    /**
00085     * Sets the option name that will
00086     * be returned from getOptionName().
00087     *
00088     * @param name
00089     *        the option name.  Please see
00090     *        Option::getOptionName() for
00091     *        how the string is interpreted.
00092     *
00093     * @see Option::getOptionName()
00094     */
00095    void setOptionName(const std::string& name);
00096 
00097 private:
00098    QWidget* mpOptionWidget;
00099    std::string mOptionName;
00100 };
00101 
00102 #endif

Software Development Kit - Opticks 4.9.0 Build 16218