Instances and commands

EsCommandAddButton

void EsCommandAddButton(EsCommand *command, EsButton *button);

Attaches a button to the command. The button follows the command's enabled state, check state and callback.

EsCommandByID

EsCommand *EsCommandByID(ES_INSTANCE_TYPE *instance, uint32_t stableID);

Returns the command with the given stable ID. Asserts if the command does not exist.

EsCommandRegister

EsCommand *EsCommandRegister(EsCommand *command, ES_INSTANCE_TYPE *instance, STRING title, EsCommandCallback callback, uint32_t stableID, EsCString cDefaultKeyboardShortcut = ES_NULL, bool enabled = false);

IDs >= 0xF0000000 reserved by the system.

EsCommandSetCallback

void EsCommandSetCallback(EsCommand *command, EsCommandCallback callback);

Sets the command's callback and updates all attached buttons. If the callback is null, the command is disabled.

EsCommandSetDisabled

void EsCommandSetDisabled(EsCommand *command, bool disabled);

Enables or disables the command and all of the buttons attached to it.

EsCommandSetCheck

void EsCommandSetCheck(EsCommand *command, EsCheckState check, bool sendUpdatedMessage);

Sets the command's check state and updates all attached buttons. If sendUpdatedMessage is true, each button sends its updated message.

EsInstanceOpenReference

void EsInstanceOpenReference(ES_INSTANCE_TYPE *_instance);

Increments the instance's reference count. This must be done with the message mutex acquired.

EsInstanceCloseReference

void EsInstanceCloseReference(ES_INSTANCE_TYPE *_instance);

Sends ES_MSG_INSTANCE_DESTROY when all references closed.

EsInstanceClose

void EsInstanceClose(ES_INSTANCE_TYPE *instance);

Sends ES_MSG_INSTANCE_CLOSE, and closes the window's reference to the instance.

EsInstanceSetActiveUndoManager

void EsInstanceSetActiveUndoManager(ES_INSTANCE_TYPE *instance, EsUndoManager *manager);

Sets the active undo manager for the instance. It ends the group on the previous manager. This must be done with the message mutex acquired.

EsInstanceSetClassEditor

void EsInstanceSetClassEditor(ES_INSTANCE_TYPE *instance, const EsInstanceClassEditorSettings *settings);

Sets the instance as a document editor. This customizes the File menu for editing documents. The strings in the settings must remain valid for the life of the instance.

EsInstanceSetClassViewer

void EsInstanceSetClassViewer(ES_INSTANCE_TYPE *instance, const EsInstanceClassViewerSettings *settings);

Sets the instance as a document viewer. The File menu will not have the New or Save items.

EsInstanceGetStartupRequest

EsApplicationStartupRequest EsInstanceGetStartupRequest(ES_INSTANCE_TYPE *instance);

Returns the request that was used to start the instance. If there is none, returns an empty request.

EsInstanceOpenComplete

void EsInstanceOpenComplete(ES_INSTANCE_TYPE *instance, EsFileStore *file, bool success, STRING errorText = BLANK_STRING);

Called after the application handles ES_MSG_INSTANCE_OPEN. On failure, it shows an error dialog. On success, it clears the modified state and marks the file store operation as complete.

EsInstanceSaveComplete

void EsInstanceSaveComplete(ES_INSTANCE_TYPE *instance, EsFileStore *file, bool success);

Called after the application handles ES_MSG_INSTANCE_SAVE. It flushes the file store on success and updates the modified state.

EsInstanceSetModified

void EsInstanceSetModified(ES_INSTANCE_TYPE *instance, bool modified);

Sets the document modified state. It enables or disables the Save command and tells the desktop. It does nothing for viewer instances.

EsUserTaskStart

EsError EsUserTaskStart(EsUserTaskCallback callback, EsGeneric data, STRING title, uint32_t iconID);

Starts a background task on its own thread. The user sees a progress window. This must be done with the message mutex acquired.

EsUserTaskSetProgress

void EsUserTaskSetProgress(EsUserTask *task, double progress, EsFileOffsetDifference bytesPerSecond);

Set bytesPerSecond to -1 if not applicable.

EsUserTaskIsRunning

bool EsUserTaskIsRunning(EsUserTask *task);

Returns false if the task was cancelled.