Declaration of the Message and MessagePosition structures, along with the functions, MessagePosition_ToString(), Message_Initialize(), and Message_ToString(), as used in the HandlerChain Pattern. More...
#include "helpers/dynamicstring.h"
Go to the source code of this file.
Classes | |
struct | MessagePosition |
Position of the message in global coordinates (same scope of coordinates as windows). Although this can handle negative coordinates, the example is careful to use only positive coordinates. More... | |
struct | Message |
Represents a message sent to the windows. A message contains a type and a position. More... | |
Macros | |
#define | __HANDLERCHAIN_MESSAGE_H__ |
Enumerations | |
enum | MessageType { Close = 0 , ButtonDown = 1 , ButtonUp = 2 , Destroy = 3 } |
Type of message handled by MessageWindow. More... | |
Functions | |
bool | MessagePosition_ToString (MessagePosition *position, DynamicString *output) |
Convert a MessagePosition object to a string representation. | |
void | Message_Initialize (Message *message, MessageType type, int x, int y) |
Initialize a Message structure. | |
bool | Message_ToString (Message *message, DynamicString *output) |
Convert a Message object to a string representation. | |
Declaration of the Message and MessagePosition structures, along with the functions, MessagePosition_ToString(), Message_Initialize(), and Message_ToString(), as used in the HandlerChain Pattern.
Definition in file HandlerChain_Message.h.
#define __HANDLERCHAIN_MESSAGE_H__ |
Definition at line 9 of file HandlerChain_Message.h.
enum MessageType |
Type of message handled by MessageWindow.
Definition at line 16 of file HandlerChain_Message.h.
void Message_Initialize | ( | Message * | message, |
MessageType | type, | ||
int | x, | ||
int | y | ||
) |
Initialize a Message structure.
message | The Message structure to initialize. |
type | Value from the MessageType enumeration indicating the type of message being created. |
x | Horizontal position of the message. |
y | Vertical position of the message. |
Definition at line 51 of file HandlerChain_Message.c.
References Message::MessageType, Message::Position, MessagePosition::X, and MessagePosition::Y.
Referenced by _HandleButtonUpMessage(), _HandleChain_DestroyWindows(), _HandleCloseMessage(), and HandlerChain_Exercise().
bool Message_ToString | ( | Message * | message, |
DynamicString * | output | ||
) |
Convert a Message object to a string representation.
message | The Message object to convert. |
output | The string representation of the Message object. Call DynamicString_Initialize() on this object before passing as an argument. |
Definition at line 64 of file HandlerChain_Message.c.
References ButtonDown, ButtonUp, Close, Destroy, DynamicString_Append(), DynamicString_Clear(), DynamicString_Initialize(), formatstring(), MessagePosition_ToString(), Message::MessageType, Message::Position, and DynamicString::string.
bool MessagePosition_ToString | ( | MessagePosition * | position, |
DynamicString * | output | ||
) |
Convert a MessagePosition object to a string representation.
position | The MessagePosition object to convert. |
output | A DynamicString in which to store the string representation of the position argument. Call DynamicString_Initialize() on this object before passing as an argument. |
Definition at line 17 of file HandlerChain_Message.c.
References DynamicString_Append(), formatstring(), MessagePosition::X, and MessagePosition::Y.
Referenced by Message_ToString().