- Timestamp:
- May 28, 2011, 5:10:01 PM (13 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
- Property svn:mergeinfo changed
/code/branches/tutoriallevel (added) merged: 7828-7831,7894,8370 /code/branches/tutoriallevel2 (added) merged: 8371,8374,8376-8378,8444-8451 /code/branches/tutoriallevel3 (added) merged: 8453,8634,8636
- Property svn:mergeinfo changed
-
code/branches/presentation/src/modules/notifications/NotificationQueue.h
r7552 r8637 45 45 #include "NotificationManager.h" 46 46 47 #include "core/BaseObject.h" 47 48 #include "tools/interfaces/Tickable.h" 48 #include "interfaces/NotificationListener.h" 49 50 namespace orxonox // tolua_export 51 { // tolua_export 49 50 namespace orxonox 51 { 52 52 53 53 /** … … 78 78 Displays @ref orxonox::Notification "Notifications" from specific senders. 79 79 80 There are quite some parameters that influence the behavio ur of the NotificationQueue:80 There are quite some parameters that influence the behavior of the NotificationQueue: 81 81 - @b name The name of the NotificationQueue. It needs to be unique. 82 82 - @b senders The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays. … … 89 89 @ingroup Notifications 90 90 */ 91 class _NotificationsExport NotificationQueue // tolua_export 92 : public Tickable, public NotificationListener 93 { // tolua_export 91 class _NotificationsExport NotificationQueue : public BaseObject, public Tickable 92 { 94 93 95 94 public: 96 NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME); 95 NotificationQueue(BaseObject* creator); 96 NotificationQueue(BaseObject* creator, const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME); 97 97 virtual ~NotificationQueue(); 98 98 99 //! Destroys the NotificationQueue. 100 void destroy(bool noGraphics = false); // tolua_export 101 102 virtual void tick(float dt); //!< To update from time to time. 103 104 void update(void); //!< Updates the NotificationQueue. 105 void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification. 99 virtual void tick(float dt); // To update from time to time. 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 101 102 void update(void); // Updates the NotificationQueue. 103 void update(Notification* notification, const std::time_t & time); // Updates the NotificationQueue by adding an new Notification. 106 104 107 105 // tolua_begin … … 110 108 @return Returns the name. 111 109 */ 112 inline const std::string& getName( ) const113 { return this-> name_; }114 115 void setMaxSize(unsigned int size); // !<Sets the maximum number of displayed Notifications.110 inline const std::string& getName(void) const 111 { return this->BaseObject::getName(); } 112 113 void setMaxSize(unsigned int size); // Sets the maximum number of displayed Notifications. 116 114 /** 117 115 @brief Returns the maximum number of Notifications displayed. 118 116 @return Returns maximum size. 119 117 */ 120 inline unsigned int getMaxSize( ) const118 inline unsigned int getMaxSize(void) const 121 119 { return this->maxSize_; } 122 120 123 void setDisplayTime( unsigned int time); //!<Sets the maximum number of seconds a Notification is displayed.121 void setDisplayTime(int time); // Sets the maximum number of seconds a Notification is displayed. 124 122 /** 125 123 @brief Returns the time interval the Notification is displayed. 126 124 @return Returns the display time. 127 125 */ 128 inline unsigned int getDisplayTime() const126 inline int getDisplayTime(void) const 129 127 { return this->displayTime_; } 130 128 // tolua_end … … 134 132 @return Returns the size of the NotificationQueue. 135 133 */ 136 inline unsigned int getSize( ) const134 inline unsigned int getSize(void) const 137 135 { return this->size_; } 138 136 … … 141 139 @return Returns a set of strings holding the different targets. 142 140 */ 143 inline const std::set<std::string> & getTargetsSet( )141 inline const std::set<std::string> & getTargetsSet(void) 144 142 { return this->targets_; } 145 143 146 // tolua_begin 147 void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue. 148 const std::string& getTargets(void) const; //!< Returns a string consisting of the concatination of the targets. 149 // tolua_end 150 151 private: 144 void setTargets(const std::string & targets); // Set the targets of this NotificationQueue. 145 const std::string& getTargets(void) const; // Returns a string consisting of the concatenation of the targets. 146 147 /** 148 @brief Check whether the NotificationQueue is registered with the NotificationManager. 149 @return Returns true if it is registered, false if not. 150 */ 151 inline bool isRegistered(void) 152 { return this->registered_; } 153 154 bool tidy(void); // Pops all Notifications from the NotificationQueue. 155 156 protected: 157 /** 158 @brief Is called when a notification was pushed. 159 @param notification The Notification that was pushed. 160 */ 161 virtual void notificationPushed(Notification* notification) {} 162 /** 163 @brief Is called when a notification was popped. 164 */ 165 virtual void notificationPopped(void) {} 166 /** 167 @brief Is called when a notification was removed. 168 @param index The index the removed notification was at. 169 */ 170 virtual void notificationRemoved(unsigned int index) {} 171 172 virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers. 173 174 protected: 152 175 static const unsigned int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed. 153 176 static const unsigned int DEFAULT_DISPLAY_TIME = 30; //!< The default display time. 154 155 std::string name_; //!< The name of the NotificationQueue. 156 177 static const int INF = -1; //!< Constant denoting infinity. 178 179 virtual void create(void); // Creates the NotificationQueue. 180 181 private: 182 void initialize(void); // Initializes the NotificationQueue. 183 184 time_t creationTime_; // The time this NotificationQueue was created. 185 157 186 unsigned int maxSize_; //!< The maximal number of Notifications displayed. 158 187 unsigned int size_; //!< The number of Notifications displayed. 159 unsignedint displayTime_; //!< The time a Notification is displayed.188 int displayTime_; //!< The time a Notification is displayed. 160 189 161 190 bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already. … … 169 198 NotificationContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired. 170 199 171 void create(void); //!< Creates the NotificationQueue in lua.172 173 200 void setName(const std::string& name); //!< Sets the name of the NotificationQueue. 174 201 175 void push(Notification* notification, const std::time_t & time); //!< Adds (pushes) a Notification to the NotificationQueue. 176 void pop(void); //!< Removes (pops) the least recently added Notification form the NotificationQueue. 177 void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); //!< Removes the Notification that is stored in the input NotificationContainer. 178 179 void clear(bool noGraphics = false); //!< Clears the NotificationQueue by removing all NotificationContainers. 180 181 }; // tolua_export 182 183 } // tolua_export 184 185 #endif /* _NotificationOverlay_H__ */ 202 void push(Notification* notification, const std::time_t & time); // Adds (pushes) a Notification to the NotificationQueue. 203 void pop(void); // Removes (pops) the least recently added Notification form the NotificationQueue. 204 void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); // Removes the Notification that is stored in the input NotificationContainer. 205 206 }; 207 208 } 209 210 #endif /* _NotificationQueue_H__ */
Note: See TracChangeset
for help on using the changeset viewer.