Changeset 13 in flair-dev for trunk/include/FlairCore/Widget.h
- Timestamp:
- Apr 8, 2016, 3:39:24 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/FlairCore/Widget.h
r2 r13 21 21 class FrameworkManager_impl; 22 22 23 namespace flair 24 { 25 namespace gui 26 { 23 namespace flair { 24 namespace gui { 27 25 28 /*! \class Widget 29 * 30 * \brief Abstract class for all Framework's widget classes 31 * 32 * A widget is an object to display on the ground station. \n 33 * Communication with ground station is done through xml files; properties of theses files 34 * are modified through appropriate method. \n 35 * A xml file is used for default values of the Widget, if it has been specified in the 36 * constructor of the FrameworkManager. 37 */ 38 class Widget: public core::Object 39 { 40 friend class core::FrameworkManager; 41 friend class ::Widget_impl; 42 friend class ::FrameworkManager_impl; 26 /*! \class Widget 27 * 28 * \brief Abstract class for all Framework's widget classes 29 * 30 * A widget is an object to display on the ground station. \n 31 * Communication with ground station is done through xml files; properties of 32 *theses files 33 * are modified through appropriate method. \n 34 * A xml file is used for default values of the Widget, if it has been specified 35 *in the 36 * constructor of the FrameworkManager. 37 */ 38 class Widget : public core::Object { 39 friend class core::FrameworkManager; 40 friend class ::Widget_impl; 41 friend class ::FrameworkManager_impl; 43 42 44 public: 45 /*! 46 * \brief Constructor 47 * 48 * Construct a Widget, the xml file specified to the FrameworkManager's 49 * constructor is sued for default values. \n 50 * Two Widget with same parent must have different names. If a brother Widget already 51 * has the same name, the name of the new one will be automatically changed. \n 52 * Type must agree with predifined (hard coded) types 53 * in ground station code. 54 * 55 * \param parent parent 56 * \param name name 57 * \param type type 58 */ 59 Widget(const Widget* parent,std::string name,std::string type); 43 public: 44 /*! 45 * \brief Constructor 46 * 47 * Construct a Widget, the xml file specified to the FrameworkManager's 48 * constructor is sued for default values. \n 49 * Two Widget with same parent must have different names. If a brother Widget 50 *already 51 * has the same name, the name of the new one will be automatically changed. \n 52 * Type must agree with predifined (hard coded) types 53 * in ground station code. 54 * 55 * \param parent parent 56 * \param name name 57 * \param type type 58 */ 59 Widget(const Widget *parent, std::string name, std::string type); 60 60 61 62 63 64 65 61 /*! 62 * \brief Destructor 63 * 64 */ 65 virtual ~Widget(); 66 66 67 68 69 70 71 72 73 74 75 76 67 /*! 68 * \brief Set enabled 69 * 70 * Enable or disable the Widget on the ground station. \n 71 * A disabled widget is greyed out on the ground station 72 * and in unmodifiable. 73 * 74 * \param status 75 */ 76 void setEnabled(bool status); 77 77 78 79 80 81 82 83 78 /*! 79 * \brief Is enabled? 80 * 81 * \return true if widget is enabled 82 */ 83 bool isEnabled(void) const; 84 84 85 86 87 88 89 * The property will be saved in the configuration xml and also used to configure the ground station.90 *91 * \param prop property to set and save92 * \param value valueto set and save93 */94 template <typename T>95 void SetPersistentXmlProp(std::string prop,T value);85 protected: 86 /*! 87 * \brief Set a persistent xml property 88 * 89 * The property will be saved in the configuration xml and also used to 90 *configure the ground station. 91 * 92 * \param prop property to set and save 93 * \param value value to set and save 94 */ 95 template <typename T> void SetPersistentXmlProp(std::string prop, T value); 96 96 97 /*! 98 * \brief Get a persistent xml property 99 * 100 * Get the property from the xml file. If no corresponding property is found in the xml, value remains unchanged. \n 101 * Thus value can be initialized with a default value before calling this method. 102 * 103 * \param prop property to get 104 * \param value value to store the result 105 * \return true if value was changed 106 */ 107 template <typename T> 108 bool GetPersistentXmlProp(std::string prop,T &value); 97 /*! 98 * \brief Get a persistent xml property 99 * 100 * Get the property from the xml file. If no corresponding property is found in 101 *the xml, value remains unchanged. \n 102 * Thus value can be initialized with a default value before calling this 103 *method. 104 * 105 * \param prop property to get 106 * \param value value to store the result 107 * \return true if value was changed 108 */ 109 template <typename T> bool GetPersistentXmlProp(std::string prop, T &value); 109 110 110 /*! 111 * \brief Set a volatile xml property 112 * 113 * This property should be used to configure the ground station (one time init). \n 114 * The property will be destroyed after calling SendXml() as it should no be used anymore. 115 * 116 * \param prop property to set 117 * \param value value to set 118 * \param node if sepcified, node to set; otherwise use the node of the Widget 119 */ 120 template <typename T> 121 void SetVolatileXmlProp(std::string prop,T value,xmlNodePtr node=NULL); 111 /*! 112 * \brief Set a volatile xml property 113 * 114 * This property should be used to configure the ground station (one time 115 *init). \n 116 * The property will be destroyed after calling SendXml() as it should no be 117 *used anymore. 118 * 119 * \param prop property to set 120 * \param value value to set 121 * \param node if sepcified, node to set; otherwise use the node of the Widget 122 */ 123 template <typename T> 124 void SetVolatileXmlProp(std::string prop, T value, xmlNodePtr node = NULL); 122 125 123 /*! 124 * \brief Send xml 125 * 126 * Send Widget's xml to ground station. \n 127 * New changes will be taken into account by ground station. \n 128 * All volatile properties will be erased after calling ths method, as they should not be used anymore. 129 */ 130 void SendXml(void); 126 /*! 127 * \brief Send xml 128 * 129 * Send Widget's xml to ground station. \n 130 * New changes will be taken into account by ground station. \n 131 * All volatile properties will be erased after calling ths method, as they 132 *should not be used anymore. 133 */ 134 void SendXml(void); 131 135 132 133 134 135 136 137 138 139 136 /*! 137 * \brief Xml event 138 * 139 * This method must be reimplemented to handle a xml event. \n 140 * It is automatically called when something changed from 141 * ground station. \n 142 */ 143 virtual void XmlEvent(void){}; 140 144 141 142 class Widget_impl*pimpl_;143 145 private: 146 class Widget_impl *pimpl_; 147 }; 144 148 145 149 } // end namespace gui
Note:
See TracChangeset
for help on using the changeset viewer.