#include <calendarcomponent.h>
Public Member Functions | |
CalendarComponentInstance (EntityInstance &entity, Component &resource) | |
virtual bool | init (utility::ErrorState &errorState) override |
virtual void | update (double deltaTime) override |
void | setDirty () |
const nap::ICalendar & | getCalendar () const |
nap::ICalendar & | getCalendar () |
bool | active (const std::string &itemID) const |
![]() | |
ComponentInstance (EntityInstance &entity, Component &resource) | |
nap::EntityInstance * | getEntityInstance () const |
nap::Component * | getComponent () const |
template<typename T > | |
T * | getComponent () const |
virtual bool | init (utility::ErrorState &errorState) |
![]() | |
Object () | |
virtual | ~Object () |
virtual void | onDestroy () |
Object (Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
Public Attributes | |
nap::Signal< const CalendarEvent & > | eventStarted |
Triggered when a calendar event starts, always on the main thread on update() More... | |
nap::Signal< const CalendarEvent & > | eventEnded |
Triggered when a calendar event ends, always on the main thread on update() More... | |
![]() | |
std::string | mID |
Property: 'mID' unique name of the object. Used as an identifier by the system. More... | |
Additional Inherited Members | |
![]() | |
static bool | isIDProperty (rtti::Instance &object, const rtti::Property &property) |
Notifies listeners when a calendar event starts and ends. Listen to the 'eventStarted' and 'eventEnded' signals to get notified of changes. This component also ensures that the eventEnded signal is called when an item is removed or changed, if that item was previously in session. The state change checks are performed at a regular interval, controlled by the CalendarComponent::Frequency property. Time used = local computer time. TODO: Add support for timezones.
CalendarComponentInstance | ( | EntityInstance & | entity, |
Component & | resource | ||
) |
bool active | ( | const std::string & | itemID | ) | const |
Checks if a specific calendar item is currently active according to this component. Note that this check is often faster than: CalendarEvent::active(), because the active state is cached by this component, making it faster to query, especially when iterating and 'asking' a large number of calendar items.
itemID | the unique id of the calendar item |
nap::ICalendar& getCalendar | ( | ) |
const nap::ICalendar& getCalendar | ( | ) | const |
|
overridevirtual |
Initialize the component based on the resource
errorState | contains the error when initialization fails |
Reimplemented from ComponentInstance.
void setDirty | ( | ) |
Forces a calendar activity check next update call. Call this after updating a calendar item.
|
overridevirtual |
Checks for calendar item state changes if time passed or when dirty. Notifies listeners if an event started or ended.
deltaTime | time in between frames in seconds |
Reimplemented from ComponentInstance.
nap::Signal<const CalendarEvent&> eventEnded |
Triggered when a calendar event ends, always on the main thread on update()
nap::Signal<const CalendarEvent&> eventStarted |
Triggered when a calendar event starts, always on the main thread on update()