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 SETTABLESESSIONITEM_H 00011 #define SETTABLESESSIONITEM_H 00012 00013 #include "SessionItem.h" 00014 00015 class SessionItemId; 00016 00017 /** 00018 * Provides access to set attribute values of a session item. 00019 * 00020 * This class provides a generic session item where the various attribute 00021 * values can be set. Calling ObjectFactory::createObject("SettableSessionItem") 00022 * creates an instance of this class. 00023 * 00024 * SettableSessionItem is used internally and is typically not used by plug-in 00025 * developers. 00026 * 00027 * @see SessionItem 00028 */ 00029 class SettableSessionItem : public SessionItem 00030 { 00031 public: 00032 /** 00033 * Sets the id of the session item. 00034 * 00035 * This method will set the id of the item. It will only work if getId has 00036 * not yet been called. 00037 * 00038 * @param id 00039 * The new id for the SessionItem. 00040 * 00041 * @return Returns \c true if the id was successfully set, or \c false otherwise. 00042 */ 00043 virtual bool setId(const SessionItemId& id) = 0; 00044 00045 /** 00046 * Associates an icon with the session item. 00047 * 00048 * The icon can be used by widgets displaying the session item to 00049 * differentiate between mutliple session item types, or to uniquely 00050 * identify this session item. 00051 * 00052 * @param icon 00053 * The icon to associate with the session item. 00054 */ 00055 virtual void setIcon(const QIcon& icon) = 0; 00056 00057 /** 00058 * Sets the full session item name. 00059 * 00060 * @param name 00061 * The session item name. 00062 * 00063 * @see setDisplayName() 00064 */ 00065 virtual void setName(const std::string& name) = 0; 00066 00067 /** 00068 * Sets the session item name that should be displayed to the user. 00069 * 00070 * The display name can optionally be used to present a shorter name to the 00071 * user. If the display name is not set, the full session item name may be 00072 * displayed to the user instead. 00073 * 00074 * @param displayName 00075 * The name that should be displayed to the user for this session 00076 * item. 00077 * 00078 * @see setName() 00079 */ 00080 virtual void setDisplayName(const std::string& displayName) = 0; 00081 00082 /** 00083 * Sets additional text about the session item to be displayed to the user. 00084 * 00085 * The display text is an optional means by which additional information 00086 * about this session item can be displayed to the user. 00087 * 00088 * @param displayText 00089 * The text string containing additional information about this 00090 * session item to display to the user. 00091 */ 00092 virtual void setDisplayText(const std::string& displayText) = 0; 00093 00094 /** 00095 * Adds a single context menu action to the list of available actions for 00096 * this session item. 00097 * 00098 * This method adds an action to the list of available actions that are 00099 * avaiable when the user right-clicks on a widget that displays or 00100 * contains the session item. This method is typically called with an 00101 * action that should be available regardless of the current state of the 00102 * session or the item. 00103 * 00104 * @param menuAction 00105 * A context menu action that should be displayed when the user 00106 * right-clicks on a widget that displays or contains the session 00107 * item. 00108 * 00109 * @see setContextMenuActions() 00110 */ 00111 virtual void addContextMenuAction(const ContextMenuAction& menuAction) = 0; 00112 00113 /** 00114 * Sets available context menu actions for this session item. 00115 * 00116 * This method sets actions that are available to the user when 00117 * right-clicking on a widget that displays or contains the session item. 00118 * This method is typically called with actions that should be available 00119 * regardless of the current state of the session or the item. 00120 * 00121 * @param actions 00122 * A list of context menu actions that should be displayed when 00123 * the user right-clicks on a widget that displays or contains the 00124 * session item. 00125 * 00126 * @see addContextMenuAction() 00127 */ 00128 virtual void setContextMenuActions(const std::list<ContextMenuAction>& actions) = 0; 00129 00130 /** 00131 * Sets whether the display name and display text are automatically updated 00132 * when a filename is set as the item name. 00133 * 00134 * @param bFilenameDisplay 00135 * If this parameter is \b true, the display name and display text 00136 * will automatically be updated when setName() is called with a 00137 * filename. If this parameter is \b false, the display name and 00138 * display text are not affected when setName() is called. 00139 * 00140 * @see hasFilenameDisplay() 00141 */ 00142 virtual void setFilenameDisplay(bool bFilenameDisplay) = 0; 00143 00144 /** 00145 * Adds a Properties plug-in name to the vector of available properties 00146 * pages for this session item. 00147 * 00148 * This method adds the name of a single Properties plug-in to the vector 00149 * of available properties plug-ins whose widgets are displayed to the user 00150 * in the properties dialog for this session item. 00151 * 00152 * @param plugInName 00153 * The Properties plug-in name to add to the vector of pages that 00154 * should be displayed in the properties dialog for this session 00155 * item. 00156 * 00157 * @see setPropertiesPages() 00158 */ 00159 virtual void addPropertiesPage(const std::string& plugInName) = 0; 00160 00161 /** 00162 * Removes a Properties plug-in name from the vector of available 00163 * properties pages for this session item. 00164 * 00165 * This method removed the name of a single Properties plug-in from the 00166 * vector of available properties plug-ins whose widgets are displayed to 00167 * the user in the properties dialog for this session item. 00168 * 00169 * @param plugInName 00170 * The Properties plug-in name to remove from the vector of pages 00171 * that should be displayed in the properties dialog for this 00172 * session item. 00173 * 00174 * @see addPropertiesPage() 00175 */ 00176 virtual void removePropertiesPage(const std::string& plugInName) = 0; 00177 00178 /** 00179 * Sets the available properties pages for this session item. 00180 * 00181 * This method sets the names of all Properties plug-ins whose widgets are 00182 * displayed to the user in the properties dialog for this session item. 00183 * 00184 * @param plugInNames 00185 * A vector of Properties plug-in names whose widgets should be 00186 * displayed in the properties dialog for this item. 00187 * 00188 * @see addPropertiesPage() 00189 */ 00190 virtual void setPropertiesPages(const std::vector<std::string>& plugInNames) = 0; 00191 00192 /** 00193 * Sets session save validity. 00194 * 00195 * Method sets whether or not the item will be included when saving a 00196 * session. 00197 * 00198 * @param isValid 00199 * Session save validity of the item. 00200 */ 00201 virtual void setValidSessionSaveItem(bool isValid) = 0; 00202 00203 protected: 00204 /** 00205 * This object should be destroyed by calling ObjectFactory::destroyObject(). 00206 */ 00207 virtual ~SettableSessionItem() {} 00208 }; 00209 00210 #endif