X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FEvents%2FEvents_Loop.h;h=94122adbe03100e2d8bb37bb30b1ba58260f6250;hb=aef9c1a87bc7ca357d8dfe47c56ac5edc9935d35;hp=0d1f729bd2442cf59b95681f9e81b8b4faf40d82;hpb=42cd47b33727c9b7f02b43960f8b2633001942ae;p=modules%2Fshaper.git diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h index 0d1f729bd..94122adbe 100644 --- a/src/Events/Events_Loop.h +++ b/src/Events/Events_Loop.h @@ -34,7 +34,7 @@ class Events_Loop /// map from event ID to listeners which must process message without waiting for flush std::map myImmediateListeners; - /// map from event ID to groupped messages (accumulated on flush) + /// map from event ID to groupped messages (accumulated for flush) std::map > myGroups; ///< set of messages that are flushed right now, so they are not grouped @@ -58,7 +58,7 @@ class Events_Loop //! \param isGroup is true for grouping messages if possible EVENTS_EXPORT void send(const std::shared_ptr& theMessage, bool isGroup = true); - //! Registers (or adds if such listener is already registered) a listener + //! Registers (or adds if such listener is already registered) a listener //! that will be called on the event and from the defined sender //! \param theListener the object that will listen (process) the event //! \param theID listen for messages with this ID @@ -77,22 +77,29 @@ class Events_Loop //! Removes messages with the given ID: they are not needed anymore (UPDATE on close) EVENTS_EXPORT void eraseMessages(const Events_ID& theID); - //! Allows to disable flushes: needed in synchronization of document mechanism + //! Allows to disable flushes: needed in synchronization of document mechanism //! (to synchronize all and only then flush create, update, etc in correct order) //! \param theActivate a state about flushe is active. If false, the flush is disabled //! \return the previous active flush state EVENTS_EXPORT bool activateFlushes(const bool theActivate); - + //! Clears all collected messages EVENTS_EXPORT void clear(const Events_ID& theID); - //! Enables flush without grouping for the given message - EVENTS_EXPORT void autoFlush(const Events_ID& theID, const bool theAuto = true); - //! Returns true if the evement is flushed right now EVENTS_EXPORT bool isFlushed(const Events_ID& theID); //! Sets the flag that the event is flished right now EVENTS_EXPORT void setFlushed(const Events_ID& theID, const bool theValue); + + //! Returns true if a loop accumulated events to be flashed + EVENTS_EXPORT bool hasGrouppedEvent(const Events_ID& theID); + +private: + //! Calls "processEvent" for the given listeners. + //! If theFlushedNow for grouped listeners is stores message in listeners. + void sendProcessEvent(const std::shared_ptr& theMessage, + std::list& theListeners, const bool theFlushedNow); + }; #endif