JX Application Framework
|
#include <JXApplication.h>
Public Types | |
enum | FiberPriority { kEventLoopPriority , kEventHandlerPriority , kIdleTaskPriority , kUrgentTaskPriority } |
Public Member Functions | |
JXApplication (int *argc, char *argv[], const JUtf8Byte *appSignature, const JUtf8Byte **defaultStringData) | |
~JXApplication () override | |
const JString & | GetSignature () const |
void | Run () |
void | Suspend () override |
void | Resume () override |
virtual void | Quit () |
bool | IsQuitting () const |
void | DisplayBusyCursor () |
void | DisplayInactiveCursor () |
void | HideAllWindows () |
Time | GetCurrentTime () const |
void | InstallIdleTask (JXIdleTask *task) |
void | RemoveIdleTask (JXIdleTask *task) |
void | InstallUrgentTask (JXUrgentTask *task) |
JXDisplay * | GetCurrentDisplay () const |
void | SetCurrentDisplay (const JIndex index) |
void | SetCurrentDisplay (JXDisplay *display) |
JSize | GetDisplayCount () const |
JXDisplay * | GetDisplay (const JIndex index) const |
bool | GetDisplayIndex (JXDisplay *display, JIndex *index) const |
const JPtrArray< JXDisplay > * | GetDisplayList () const |
bool | OpenDisplay (const JString &displayName, JIndex *displayIndex) |
bool | DisplayExists (const Display *xDisplay) |
bool | FindDisplay (const Display *xDisplay, JXDisplay **display) |
void | DisplayOpened (JXDisplay *display) |
void | DisplayClosed (JXDisplay *display) |
const JString & | GetRestartCommand () const |
![]() | |
JXDirector (JXDirector *supervisor) | |
~JXDirector () override | |
bool | IsClosing () const |
virtual void | Activate () |
virtual bool | Deactivate () |
bool | IsActive () const |
bool | IsSuspended () const |
bool | HasSubdirectors () const |
bool | GetSubdirectors (const JPtrArray< JXDirector > **list) const |
![]() | |
JBroadcaster () | |
virtual | ~JBroadcaster () |
JBroadcaster & | operator= (const JBroadcaster &source) |
bool | HasSenders () const |
JSize | GetSenderCount () const |
bool | HasRecipients () const |
JSize | GetRecipientCount () const |
virtual JString | ToString () const |
template<class T > | |
void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
Static Public Member Functions | |
static void | StartFiber (const std::function< void()> &f, const FiberPriority priority=kIdleTaskPriority) |
static bool | IsWorkerFiber () |
static void | RemoveCmdLineOption (int *argc, char *argv[], const unsigned long offset, const unsigned long removeCount) |
static int | JXIOErrorHandler (Display *xDisplay) |
static void | Abort (const JXDocumentManager::SafetySaveReason reason, const bool dumpCore) |
static void | StripBaseOptions (JPtrArray< JString > *argList) |
Protected Member Functions | |
void | UpdateCurrentTime () |
bool | Close () override |
void | ReceiveWithFeedback (JBroadcaster *sender, Message *message) override |
virtual void | CleanUpBeforeSuddenDeath (const JXDocumentManager::SafetySaveReason reason) |
![]() | |
JXDirector * | GetSupervisor () const |
bool | CloseAllSubdirectors () |
virtual void | DirectorClosed (JXDirector *theDirector) |
![]() | |
JBroadcaster (const JBroadcaster &source) | |
void | ListenTo (const JBroadcaster *sender) |
void | StopListening (const JBroadcaster *sender) |
void | ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember) |
void | StopListening (const JBroadcaster *sender, const std::type_info &messageType) |
template<class T > | |
void | Send (JBroadcaster *recipient, const T &message) |
template<class T > | |
void | Broadcast (const T &message) |
virtual void | Receive (JBroadcaster *sender, const Message &message) |
void | SendWithFeedback (JBroadcaster *recipient, Message *message) |
void | BroadcastWithFeedback (Message *message) |
virtual void | ReceiveGoingAway (JBroadcaster *sender) |
Friends | |
class | JXWindow |
Initializes global objects and manages the event loop. Urgent tasks are performed after the current event and are then deleted. Idle tasks are performed whenever the event loop is idle. It is safe to delete a JXIdleTask object because it will automatically remove itself from the task list.
JXApplication::JXApplication | ( | int * | argc, |
char * | argv[], | ||
const JUtf8Byte * | appSignature, | ||
const JUtf8Byte ** | defaultStringData | ||
) |
|
override |
|
static |
|
protectedvirtual |
If the server is dead, you cannot call any code that contacts it.
|
overrideprotectedvirtual |
This will fail unless Quit() has been called.
Reimplemented from JXDirector.
void JXApplication::DisplayBusyCursor | ( | ) |
Displays the watch cursor in all windows on all displays.
void JXApplication::DisplayClosed | ( | JXDisplay * | display | ) |
|
inline |
Returns true if the given display hasn't been deleted.
void JXApplication::DisplayInactiveCursor | ( | ) |
Displays the X cursor in all windows on all displays.
void JXApplication::DisplayOpened | ( | JXDisplay * | display | ) |
OpenDisplay() assumes that Append() is called.
Returns true if the given display exists.
|
inline |
|
inline |
|
inline |
|
inline |
Required for X session managers. It is assumed that programs restore their state when run with no arguments.
|
inline |
void JXApplication::HideAllWindows | ( | ) |
void JXApplication::InstallIdleTask | ( | JXIdleTask * | task | ) |
We prepend the task so it will be performed next time if PerformIdleTasks() is executing. This ensures that we will eventually reach the end of the task list.
void JXApplication::InstallUrgentTask | ( | JXUrgentTask * | task | ) |
We immediately create a fiber, so it will run as soon as possible.
|
inline |
|
static |
|
static |
Calls JXApplication::Abort().
|
virtual |
Derived classes can override this to perform additional operations or to give the user a warning. They must call the inherited version in order for it to take effect.
|
overrideprotectedvirtual |
SIGTERM can mean that the system is shutting down.
Reimplemented from JBroadcaster.
|
static |
void JXApplication::RemoveIdleTask | ( | JXIdleTask * | task | ) |
|
overridevirtual |
Reimplemented from JXDirector.
void JXApplication::Run | ( | ) |
When this function returns, JX and JCore have been shut down and the application object has been deleted.
void JXApplication::SetCurrentDisplay | ( | const JIndex | index | ) |
void JXApplication::SetCurrentDisplay | ( | JXDisplay * | display | ) |
|
static |
|
overridevirtual |
Reimplemented from JXDirector.
|
protected |
Calculate our current time from the current timer value.
|
friend |