tbx  0.7.5
Public Types | Public Member Functions | Protected Attributes | List of all members
tbx::WimpMessage Class Reference

Wimp message information. More...

#include <wimpmessagelistener.h>

Public Types

enum  SendType { User = 17, Recorded = 18, Acknowledge = 19 }
 Enumeration specifying the type of message to send.
 
enum  SpecialDestination { Broadcast = 0, Iconbar = -2 }
 Enumeration with special targets for sending messages to.
 

Public Member Functions

 WimpMessage (PollBlock &poll_block)
 Use to refer to a message in an existing wimp poll block. More...
 
 WimpMessage (int message_id, int size)
 Create a new message block for the specified action. More...
 
 WimpMessage (const WimpMessage &other, int size_override=0)
 Create a copy of an existing message. More...
 
 WimpMessage (const WimpMessage &other, bool copy)
 Create a reference or copy to another message. More...
 
WimpMessageoperator= (const WimpMessage &other)
 Assignment creates a copy of an existing message. More...
 
virtual ~WimpMessage ()
 Destructor for WimpMessage. More...
 
int block_size () const
 Get length of block, 20 - 256 bytes, a whole number of words.
 
int sender_task_handle () const
 Get task handle of sender.
 
int my_ref () const
 Get my reference from the message.
 
int your_ref () const
 Get your reference from the message.
 
int message_id () const
 Get the message ID.
 
void my_ref (int ref)
 Set my reference for the message. More...
 
void your_ref (int ref)
 Set your reference for the message. More...
 
void message_id (int id)
 Set the message id for the message. More...
 
int word (int index) const
 Get message word (integer) More...
 
int & word (int index)
 Return reference to message word so it can be updated. More...
 
int operator[] (int index) const
 Get message word (integer) More...
 
int & operator[] (int index)
 Return reference to message word so it can be updated. More...
 
const char * str (int index) const
 Return char * for part of the message. More...
 
char * str (int index)
 Return char * for part of the message. More...
 
int send (SendType type, int destination, int icon_handle=0)
 Send a message to another application. More...
 

Protected Attributes

int * _message_block
 pointer to the message data
 
bool _owns_block
 True if the message data will be deleted when this object is deleted.
 

Detailed Description

Wimp message information.

Constructor & Destructor Documentation

◆ WimpMessage() [1/4]

tbx::WimpMessage::WimpMessage ( PollBlock poll_block)

Use to refer to a message in an existing wimp poll block.

The poll block is NOT deleted when this class is deleted.

Parameters
poll_blockWimp poll block that contains a message

◆ WimpMessage() [2/4]

tbx::WimpMessage::WimpMessage ( int  message_id,
int  size 
)

Create a new message block for the specified action.

Parameters
message_idAction the code for the message.
sizesize of the message block in (32 bit) words

◆ WimpMessage() [3/4]

tbx::WimpMessage::WimpMessage ( const WimpMessage other,
int  size_override = 0 
)

Create a copy of an existing message.

Parameters
othermessage to copy
size_override- specify the size of the message. 0 means use the other message size. if greater then the other message size, the extra space is uninitialised.

◆ WimpMessage() [4/4]

tbx::WimpMessage::WimpMessage ( const WimpMessage other,
bool  copy 
)

Create a reference or copy to another message.

Parameters
othermessage to reference/copy
copytrue to create a copy

◆ ~WimpMessage()

tbx::WimpMessage::~WimpMessage ( void  )
virtual

Destructor for WimpMessage.

Deletes the message block if it owns it.

Member Function Documentation

◆ message_id()

void tbx::WimpMessage::message_id ( int  id)
inline

Set the message id for the message.

Parameters
idnew ID for the message

◆ my_ref()

void tbx::WimpMessage::my_ref ( int  ref)
inline

Set my reference for the message.

Parameters
refnew reference

◆ operator=()

WimpMessage & tbx::WimpMessage::operator= ( const WimpMessage other)

Assignment creates a copy of an existing message.

Parameters
othermessage to copy.

◆ operator[]() [1/2]

int tbx::WimpMessage::operator[] ( int  index) const
inline

Get message word (integer)

Parameters
indexzero based index of the word in the message block. i.e. 0 is at byte offset 0, 1 is at byte offset 4 etc.
Returns
32 bit value at the given index

◆ operator[]() [2/2]

int& tbx::WimpMessage::operator[] ( int  index)
inline

Return reference to message word so it can be updated.

Parameters
indexzero based index of the word in the message block. i.e. 0 is at byte offset 0, 1 is at byte offset 4 etc.
Returns
reference to the 32 bit value at the given index

◆ send()

int tbx::WimpMessage::send ( SendType  type,
int  destination,
int  icon_handle = 0 
)

Send a message to another application.

On exit sender task handle and my ref fields have been updated.

Parameters
typetype of message (User, Recorded, Acknowledge)
destinationtarget for the message. task handle, window handle, -2 for icon bar, 0 for broadcast
icon_handleicon handle to send to if destination is -2.
Returns
task handle of the destination.
Exceptions
OsErrorif send fails

◆ str() [1/2]

const char* tbx::WimpMessage::str ( int  index) const
inline

Return char * for part of the message.

Parameters
indexzero based index of the word in the message block where the string starts. i.e. 0 is at byte offset 0, 1 is at byte offset 4 etc.
Returns
char * pointing to the start of the string

◆ str() [2/2]

char* tbx::WimpMessage::str ( int  index)
inline

Return char * for part of the message.

Parameters
indexzero based index of the word in the message block where the string starts. i.e. 0 is at byte offset 0, 1 is at byte offset 4 etc.
Returns
char * pointing to the start of the string

◆ word() [1/2]

int tbx::WimpMessage::word ( int  index) const
inline

Get message word (integer)

Parameters
indexzero based index of the word in the message block. i.e. 0 is at byte offset 0, 1 is at byte offset 4 etc.
Returns
32 bit value at the given index

◆ word() [2/2]

int& tbx::WimpMessage::word ( int  index)
inline

Return reference to message word so it can be updated.

Parameters
indexzero based index of the word in the message block. i.e. 0 is at byte offset 0, 1 is at byte offset 4 etc.
Returns
reference to the 32 bit value at the given index

◆ your_ref()

void tbx::WimpMessage::your_ref ( int  ref)
inline

Set your reference for the message.

Parameters
refnew reference

The documentation for this class was generated from the following files: