Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2011, 12:31:23 AM (13 years ago)
Author:
dafrick
Message:

Merging tutoriallevel2 branch into tutoriallevel3 branch.

Location:
code/branches/tutoriallevel3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel3

  • code/branches/tutoriallevel3/src/modules/notifications/NotificationQueue.h

    r7552 r8453  
    4646
    4747#include "tools/interfaces/Tickable.h"
    48 #include "interfaces/NotificationListener.h"
    4948
    50 namespace orxonox // tolua_export
    51 { // tolua_export
     49namespace orxonox
     50{
    5251
    5352    /**
     
    7877        Displays @ref orxonox::Notification "Notifications" from specific senders.
    7978
    80         There are quite some parameters that influence the behaviour of the NotificationQueue:
     79        There are quite some parameters that influence the behavior of the NotificationQueue:
    8180        - @b name The name of the NotificationQueue. It needs to be unique.
    8281        - @b senders The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
     
    8988    @ingroup Notifications
    9089    */
    91     class _NotificationsExport NotificationQueue // tolua_export
    92         : public Tickable, public NotificationListener
    93     { // tolua_export
     90    class _NotificationsExport NotificationQueue : public Tickable
     91    {
    9492
    9593        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);
     94            NotificationQueue(const std::string& name, const std::string& senders = NotificationListener::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
    9795            virtual ~NotificationQueue();
    98 
    99             //! Destroys the NotificationQueue.
    100             void destroy(bool noGraphics = false); // tolua_export
    10196
    10297            virtual void tick(float dt); //!< To update from time to time.
     
    121116                { return this->maxSize_; }
    122117
    123             void setDisplayTime(unsigned int time); //!< Sets the maximum number of seconds a Notification is displayed.
     118            void setDisplayTime(int time); //!< Sets the maximum number of seconds a Notification is displayed.
    124119            /**
    125120            @brief Returns the time interval the Notification is displayed.
    126121            @return Returns the display time.
    127122            */
    128             inline unsigned int getDisplayTime() const
     123            inline int getDisplayTime() const
    129124                { return this->displayTime_; }
    130125            // tolua_end
     
    144139                { return this->targets_; }
    145140
    146             // tolua_begin
    147141            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
     142            const std::string& getTargets(void) const; //!< Returns a string consisting of the concatenation of the targets.
     143
     144            bool tidy(void); // Pops all Notifications from the NotificationQueue.
     145           
     146        protected:
     147            /**
     148            @brief Is called when a notification was pushed.
     149            @param notification The Notification that was pushed.
     150            */
     151            virtual void notificationPushed(Notification* notification) {}
     152            /**
     153            @brief Is called when a notification was popped.
     154            */
     155            virtual void notificationPopped(void) {}
     156            /**
     157            @brief Is called when a notification was removed.
     158            @param index The index the removed notification was at.
     159            */
     160            virtual void notificationRemoved(unsigned int index) {}
     161           
     162            virtual void clear(bool noGraphics = false); //!< Clears the NotificationQueue by removing all NotificationContainers.
     163
     164        protected:
     165            static const unsigned int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
     166            static const unsigned int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
     167            static const int INF = -1; //!< Constant denoting infinity.
    150168
    151169        private:
    152             static const unsigned int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
    153             static const unsigned int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
    154 
    155170            std::string name_; //!< The name of the NotificationQueue.
    156171
    157172            unsigned int maxSize_; //!< The maximal number of Notifications displayed.
    158173            unsigned int size_; //!< The number of Notifications displayed.
    159             unsigned int displayTime_; //!< The time a Notification is displayed.
     174            int displayTime_; //!< The time a Notification is displayed.
    160175
    161176            bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
     
    169184            NotificationContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
    170185
    171             void create(void); //!< Creates the NotificationQueue in lua.
    172 
    173186            void setName(const std::string& name); //!< Sets the name of the NotificationQueue.
    174187
     
    177190            void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); //!< Removes the Notification that is stored in the input NotificationContainer.
    178191
    179             void clear(bool noGraphics = false); //!< Clears the NotificationQueue by removing all NotificationContainers.
     192    };
    180193
    181     }; // tolua_export
     194}
    182195
    183 } // tolua_export
    184 
    185 #endif /* _NotificationOverlay_H__ */
     196#endif /* _NotificationQueue_H__ */
Note: See TracChangeset for help on using the changeset viewer.