RunLoop Class Reference

#include <runloop.h>

详细描述

Run loop interface. Use this interface to implement an application UI event run loop. Usually there already is a default implementation, but there might be cases where different UI toolkits are available for a system. Depending on the project's requirements the adequate one can be selected (via command line or project option). Only one run loop will be active for the run time of an application.

Public Types

using  TimerCallback = void(*)(void *self)

公共成员函数

  MAXON_OBSERVABLE_STATIC ( Result < void >, ObservableExitLoop,(), ObservableCombinerRunAllAggregateErrorsComponent)
  MAXON_OBSERVABLE_STATIC ( Result < void >, ObservableActivationChange,( Bool becomesActive), ObservableCombinerRunAllAggregateErrorsComponent)
  MAXON_OBSERVABLE_STATIC ( Bool , ObservableRunLoopMessage,(const void *message), ObservableCombinerRunAllBoolUntilTrue)

静态公共成员函数

static MAXON_METHOD Result < void >  EnterLoop ()
static MAXON_METHOD void  ExitLoop ()
static MAXON_METHOD void  TriggerMainThreadQueue ()
static MAXON_METHOD Result < Timer * >  AddTimer ( TimeValue interval, TimeValue delay, TimeValue tolerance, TimerCallback callback, void *self)
static MAXON_METHOD void  RemoveTimer (Timer *timer)
static MAXON_METHOD void  GetLinuxDefaultDisplayAndScreen (void *&display, int &screen)
static MAXON_METHOD void **  PrivateGetMainThreadQueueTrigger ()
static MAXON_METHOD void  PrivateSetWaitInterval ( TimeValue waitInterval)
static MAXON_METHOD void  PrivateSetDefaultDisplayAndScreen (void *display, int screen)

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( RunLoop , MAXON_REFERENCE_NONE , "net.maxon.interface.runloop")

Member Typedef Documentation

◆  TimerCallback

using TimerCallback = void (*)(void* self)

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( RunLoop   ,
MAXON_REFERENCE_NONE   ,
"net.maxon.interface.runloop"   
)
private

◆  EnterLoop()

static MAXON_METHOD Result <void> EnterLoop ( )
static

Enters the main thread run loop. Returns IllegalArgumentError if there's no run loop. Errors returned by subscribers to ObservableExitLoop() will be returned as AggregatedError .

返回
OK on success.

◆  ExitLoop()

static MAXON_METHOD void ExitLoop ( )
static

Asks the main thread run loop to exit. THREADSAFE.

◆  TriggerMainThreadQueue()

static MAXON_METHOD void TriggerMainThreadQueue ( )
static

Notifies the main thread event loop that it should execute jobs. THREADSAFE.

◆  AddTimer()

static MAXON_METHOD Result <Timer*> AddTimer ( TimeValue   interval ,
TimeValue   delay ,
TimeValue   tolerance ,
TimerCallback   callback ,
void *  self  
)
static

Schedules a job to be called periodically at the specified interval on the main thread. If the interval is 0.0 the timer is fired once after the specified delay. For each AddTimer() call you must call RemoveTimer() to remove it. Otherwise the timer runs forever or (for a one-shot timer) at least its memory will leak. If the run loop does not support timers a nullptr is returned (this is not an error). In this case the timer implementation has to enqueue jobs on the main thread (which is less efficient but works).

参数
[in] interval Timer interval.
[in] delay Delay until the timer fires the first time.
[in] tolerance Maximum tolerance of execution (used for timer coalescing).
[in] callback To be called by the timer (periodically).
[in] self Pointer to callback data.
返回
OK on success.

◆  RemoveTimer()

static MAXON_METHOD void RemoveTimer ( Timer *  timer )
static

Removes a timer created with AddTimer.

参数
[in] timer Timer interval.

◆  GetLinuxDefaultDisplayAndScreen()

static MAXON_METHOD void GetLinuxDefaultDisplayAndScreen ( void *&  display ,
int &  screen  
)
static

Returns the default display for the Linux runloop.

参数
[out] display A reference which will hold the display pointer. The pointer can be cast to Display.
[out] screen The screen.

◆  MAXON_OBSERVABLE_STATIC() [1/3]

MAXON_OBSERVABLE_STATIC ( Result < void >  ,
ObservableExitLoop  ,
()  ,
ObservableCombinerRunAllAggregateErrorsComponent   
)

Notifies the observers that the run loop will exit.

◆  MAXON_OBSERVABLE_STATIC() [2/3]

MAXON_OBSERVABLE_STATIC ( Result < void >  ,
ObservableActivationChange  ,
( Bool becomesActive)  ,
ObservableCombinerRunAllAggregateErrorsComponent   
)

Notifies the observers that the application changes from active to inactive.

◆  MAXON_OBSERVABLE_STATIC() [3/3]

MAXON_OBSERVABLE_STATIC ( Bool   ,
ObservableRunLoopMessage  ,
(const void *message)  ,
ObservableCombinerRunAllBoolUntilTrue   
)

Invokes the observer(s) with a pointer to the current event. The observer might return true if it already handled the event and it should be discarded.

注意
This observable is OS-specific and may only be used to work around bugs or shortcomings in UI toolkits/window managers. I must not be used for regular event handling or forwarding. Linux & Windows only.

◆  PrivateGetMainThreadQueueTrigger()

static MAXON_METHOD void** PrivateGetMainThreadQueueTrigger ( )
static

◆  PrivateSetWaitInterval()

static MAXON_METHOD void PrivateSetWaitInterval ( TimeValue   waitInterval )
static

◆  PrivateSetDefaultDisplayAndScreen()

static MAXON_METHOD void PrivateSetDefaultDisplayAndScreen ( void *  display ,
int  screen  
)
static