Manages and executes instances of CGUICommand.
More...
#include <GUICommandHandler.h>
Manages and executes instances of CGUICommand.
If a command ought to be executed, the method Execute() must be called. The command is not executed right away. Instead, it is enqueued according to its priority. The framework processes queued commands in each GUI main loop cycle. Processing a command means executing its Do() method.
◆ CreateInstance()
static void CGUICommandHandler::CreateInstance |
( |
| ) |
|
|
static |
◆ DeleteInstance()
static void CGUICommandHandler::DeleteInstance |
( |
| ) |
|
|
static |
◆ DumpCommands()
void CGUICommandHandler::DumpCommands |
( |
| ) |
|
Outputs debugging information about the commands in the queues. Thus, you can monitor the commands of each queue. This is only available if GUI_TRACE_LEVEL is set to GUI_TRACE_DEBUG
◆ DumpQueues()
void CGUICommandHandler::DumpQueues |
( |
| ) |
const |
Outputs debugging information about the number of commands in the queues. This is useful for example to check whether when switching to a new dialog and back to the former one the number of command remains the same. For most applications this invariant applies.
◆ Execute()
Adds a command to the 'waiting commands' queue according to its waiting time and priority. The command will be executed (its CGUICommand::Do() method will be called) later.
Commands with the shortest waiting times are executed first. If any commands have the same waiting times, the ones with higher priorities are executed first. For commands with the same time and priority the execution order may be arbitrary.
- Attention
- Note that any command placed into the queue will be owned by the command handler. Do not delete the command yourself as commands are implemented as smart-pointers.
- Parameters
-
pkCommand | Pointer to the command object to be added. |
- Returns
- True if the command was successfully added, False if not.
◆ GetIdleTime()
eC_UInt CGUICommandHandler::GetIdleTime |
( |
| ) |
|
Returns the time in milliseconds until the next command in the 'working' or 'waiting' queue wishes to be processed again.
- Returns
- Idle time or 1000ms if no command is waiting.
◆ IsCommandInQueue()
eC_Bool CGUICommandHandler::IsCommandInQueue |
( |
CGUICommandPtr |
pkCommand | ) |
|
Checks if the given command is currently enqueued in the command handler and waiting to be processed.
- Parameters
-
pkCommand | Pointer to the command object which is to be checked |
- Returns
- True if the command is enqueued in the command handler. False otherwise.
◆ RemoveCommand()
Removes the given command from the command handler.
- Parameters
-
pkCommand | Pointer to the command object to be removed. |
◆ SetMaxWorkingCmds()
void CGUICommandHandler::SetMaxWorkingCmds |
( |
const eC_UInt & |
uiMaxNoOfWorkingCmds | ) |
|
|
inline |
Set the maximum number of commands in the internal working queue. There are two internal queues, the waiting queue and the working queue. The Execute() method enqueues a command in the waiting queue. The Process() method moves commands from the waiting into the working queue until either the waiting queue is empty or the maximum number of commands in the working queue is reached. Only commands in the working queue are actually executed.
Note that if this number is too low and there are a lot of unfinished commands in the working queue, some commands in the waiting queue may never be executed. The default value is 100 commands.
- Parameters
-
uiMaxNoOfWorkingCmds | The maximum number of commands in the working queue. |
◆ CGUI
◆ CGUICommand
◆ CGUIComponentManager
The documentation for this class was generated from the following file: