Message loop class for handling window messages and idle processing. This class implements the IMessageLoop interface and manages the message loop for a window. More...
#include <SMsgLoop.h>
Public Member Functions | |
SMessageLoop (IMessageLoop *pParentLoop) | |
Constructor for SMessageLoop. | |
virtual | ~SMessageLoop () |
Destructor for SMessageLoop. | |
BOOL | AddMessageFilter (IMsgFilter *pMessageFilter) OVERRIDE |
Adds a message filter to the message loop. | |
BOOL | RemoveMessageFilter (IMsgFilter *pMessageFilter) OVERRIDE |
Removes a message filter from the message loop. | |
BOOL | AddIdleHandler (IIdleHandler *pIdleHandler) OVERRIDE |
Adds an idle handler to the message loop. | |
BOOL | RemoveIdleHandler (IIdleHandler *pIdleHandler) OVERRIDE |
Removes an idle handler from the message loop. | |
BOOL | PreTranslateMessage (MSG *pMsg) OVERRIDE |
Pre-translates a message before it is dispatched. | |
BOOL | OnIdle (int nIdleCount) OVERRIDE |
Handles idle processing. | |
int | Run () OVERRIDE |
Runs the message loop. | |
BOOL | IsRunning () const OVERRIDE |
Checks if the message loop is running. | |
void | OnMsg (LPMSG pMsg) OVERRIDE |
Processes a single message. | |
void | Quit (int exitCode) OVERRIDE |
Quits the message loop. | |
BOOL | PostTask (IRunnable *runable) OVERRIDE |
Posts a task to the message loop. | |
int | RemoveTasksForObject (void *pObj) OVERRIDE |
Removes all tasks associated with a specific object. | |
void | ExecutePendingTask () OVERRIDE |
Executes all pending tasks. | |
BOOL | PeekMsg (LPMSG pMsg, UINT wMsgFilterMin, UINT wMsgFilterMax, BOOL bRemove) OVERRIDE |
Peeks at a message in the message queue without removing it. | |
BOOL | WaitMsg () OVERRIDE |
Waits for a message in the message queue. | |
int | HandleMsg () OVERRIDE |
Handles a message from the message queue. | |
![]() | |
TObjRefImpl () | |
Constructor that initializes the reference count to 1. | |
virtual | ~TObjRefImpl () |
Virtual destructor. | |
long | AddRef () override |
Increments the reference count. | |
long | Release () override |
Decrements the reference count and deletes the object if the count reaches zero. | |
void | OnFinalRelease () override |
Deletes the object. | |
![]() | |
long | AddRef () PURE |
Increases the reference count. | |
long | Release () PURE |
Decreases the reference count. | |
void | OnFinalRelease () PURE |
Called when the reference count reaches zero and the object is about to be released. | |
Static Public Member Functions | |
static BOOL | IsIdleMessage (MSG *pMsg) |
Checks if a message is an idle message. | |
Protected Member Functions | |
void | RunIdle () |
Runs idle processing. | |
Protected Attributes | |
BOOL | m_bRunning |
BOOL | m_bQuit |
BOOL | m_bDoIdle |
int | m_nIdleCount |
SCriticalSection | m_cs |
SCriticalSection | m_csRunningQueue |
tid_t | m_tid |
SMessageLoopPriv * | m_priv |
![]() | |
LONG | m_cRef |
Reference count. | |
Message loop class for handling window messages and idle processing. This class implements the IMessageLoop interface and manages the message loop for a window.
Definition at line 17 of file SMsgLoop.h.
SMessageLoop::SMessageLoop | ( | IMessageLoop * | pParentLoop | ) |
Constructor for SMessageLoop.
pParentLoop | Pointer to the parent message loop. |
Definition at line 33 of file SMsgLoop.cpp.
|
virtual |
Destructor for SMessageLoop.
Definition at line 43 of file SMsgLoop.cpp.
BOOL SMessageLoop::AddIdleHandler | ( | IIdleHandler * | pIdleHandler | ) |
Adds an idle handler to the message loop.
pIdleHandler | Pointer to the idle handler to add. |
Implements IMessageLoop.
Definition at line 155 of file SMsgLoop.cpp.
BOOL SMessageLoop::AddMessageFilter | ( | IMsgFilter * | pMessageFilter | ) |
Adds a message filter to the message loop.
pMessageFilter | Pointer to the message filter to add. |
Implements IMessageLoop.
Definition at line 168 of file SMsgLoop.cpp.
void SMessageLoop::ExecutePendingTask | ( | ) |
int SMessageLoop::HandleMsg | ( | ) |
Handles a message from the message queue.
Implements IMessageLoop.
Definition at line 269 of file SMsgLoop.cpp.
|
static |
Checks if a message is an idle message.
pMsg | Pointer to the message to check. |
Definition at line 133 of file SMsgLoop.cpp.
BOOL SMessageLoop::IsRunning | ( | ) | const |
Checks if the message loop is running.
Definition at line 221 of file SMsgLoop.cpp.
BOOL SMessageLoop::OnIdle | ( | int | nIdleCount | ) |
Handles idle processing.
nIdleCount | Idle count. |
Implements IMessageLoop.
Definition at line 99 of file SMsgLoop.cpp.
void SMessageLoop::OnMsg | ( | LPMSG | pMsg | ) |
Processes a single message.
pMsg | Pointer to the message to process. |
Implements IMessageLoop.
Definition at line 48 of file SMsgLoop.cpp.
BOOL SMessageLoop::PeekMsg | ( | LPMSG | pMsg, |
UINT | wMsgFilterMin, | ||
UINT | wMsgFilterMax, | ||
BOOL | bRemove ) |
Peeks at a message in the message queue without removing it.
pMsg | Pointer to the message to receive. |
wMsgFilterMin | Minimum message value to peek. |
wMsgFilterMax | Maximum message value to peek. |
bRemove | TRUE to remove the message from the queue, FALSE otherwise. |
Implements IMessageLoop.
Definition at line 247 of file SMsgLoop.cpp.
BOOL SMessageLoop::PostTask | ( | IRunnable * | runable | ) |
Posts a task to the message loop.
runable | Pointer to the task to post. |
Implements IMessageLoop.
Definition at line 174 of file SMsgLoop.cpp.
BOOL SMessageLoop::PreTranslateMessage | ( | MSG * | pMsg | ) |
Pre-translates a message before it is dispatched.
pMsg | Pointer to the message to translate. |
Implements IMessageLoop.
Definition at line 117 of file SMsgLoop.cpp.
void SMessageLoop::Quit | ( | int | exitCode | ) |
Quits the message loop.
exitCode | Exit code for the message loop. |
Implements IMessageLoop.
Definition at line 57 of file SMsgLoop.cpp.
BOOL SMessageLoop::RemoveIdleHandler | ( | IIdleHandler * | pIdleHandler | ) |
Removes an idle handler from the message loop.
pIdleHandler | Pointer to the idle handler to remove. |
Implements IMessageLoop.
Definition at line 148 of file SMsgLoop.cpp.
BOOL SMessageLoop::RemoveMessageFilter | ( | IMsgFilter * | pMessageFilter | ) |
Removes a message filter from the message loop.
pMessageFilter | Pointer to the message filter to remove. |
Implements IMessageLoop.
Definition at line 163 of file SMsgLoop.cpp.
int SMessageLoop::RemoveTasksForObject | ( | void * | pObj | ) |
Removes all tasks associated with a specific object.
pObj | Pointer to the object whose tasks should be removed. |
Implements IMessageLoop.
Definition at line 189 of file SMsgLoop.cpp.
int SMessageLoop::Run | ( | ) |
Runs the message loop.
Implements IMessageLoop.
Definition at line 64 of file SMsgLoop.cpp.
|
protected |
Runs idle processing.
Definition at line 252 of file SMsgLoop.cpp.
BOOL SMessageLoop::WaitMsg | ( | ) |
Waits for a message in the message queue.
Implements IMessageLoop.
Definition at line 261 of file SMsgLoop.cpp.
|
protected |
Definition at line 158 of file SMsgLoop.h.
|
protected |
Definition at line 156 of file SMsgLoop.h.
|
protected |
Definition at line 154 of file SMsgLoop.h.
|
protected |
Definition at line 163 of file SMsgLoop.h.
|
protected |
Definition at line 165 of file SMsgLoop.h.
|
protected |
Definition at line 160 of file SMsgLoop.h.
|
protected |
Definition at line 169 of file SMsgLoop.h.
|
protected |
Definition at line 167 of file SMsgLoop.h.