Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
SGUIMessage.h
Go to the documentation of this file.
1/* Copyright (C) 2020 Wildfire Games.
2 * This file is part of 0 A.D.
3 *
4 * 0 A.D. is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * 0 A.D. is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef INCLUDED_SGUIMESSAGE
19#define INCLUDED_SGUIMESSAGE
20
21#include "ps/CStr.h"
22
23/**
24 * Message types.
25 * @see SGUIMessage
26 */
28{
38 GUIM_MOUSE_DBLCLICK_LEFT_ITEM, // Triggered when doubleclicking on a list item
44 GUIM_SETTINGS_UPDATED, // SGUIMessage.m_Value = name of setting
50 GUIM_LOAD, // Called after all objects were added to the GUI.
58 GUIM_TAB, // Used by CInput
60};
61
62/**
63 * Message send to IGUIObject::HandleMessage() in order
64 * to give life to Objects manually with
65 * a derived HandleMessage().
66 */
68{
69 // This should be passed as a const reference or pointer.
71
72 SGUIMessage(EGUIMessageType _type) : type(_type), skipped(false) {}
73 SGUIMessage(EGUIMessageType _type, const CStr& _value) : type(_type), value(_value), skipped(false) {}
74
75 /**
76 * This method can be used to allow other event handlers to process this GUI event,
77 * by default an event is not skipped (only the first handler will process it).
78 *
79 * @param skip true to allow further event handling, false to prevent it
80 */
81 void Skip(bool skip = true) { skipped = skip; }
82
83 /**
84 * Describes what the message regards
85 */
87
88 /**
89 * Optional data
90 */
91 CStr value;
92
93 /**
94 * Flag that specifies if object skipped handling the event
95 */
96 bool skipped;
97};
98
99#endif // INCLUDED_SGUIMESSAGE
EGUIMessageType
Message types.
Definition: SGUIMessage.h:28
@ GUIM_LOAD
Definition: SGUIMessage.h:50
@ GUIM_MOUSE_PRESS_LEFT
Definition: SGUIMessage.h:32
@ GUIM_TAB
Definition: SGUIMessage.h:58
@ GUIM_SETTINGS_UPDATED
Definition: SGUIMessage.h:44
@ GUIM_MOUSE_ENTER
Definition: SGUIMessage.h:30
@ GUIM_MOUSE_WHEEL_UP
Definition: SGUIMessage.h:42
@ GUIM_MOUSE_MOTION
Definition: SGUIMessage.h:49
@ GUIM_MOUSE_DOWN_RIGHT
Definition: SGUIMessage.h:36
@ GUIM_MOUSE_DBLCLICK_LEFT
Definition: SGUIMessage.h:37
@ GUIM_TEXTEDIT
Definition: SGUIMessage.h:59
@ GUIM_DOUBLE_PRESSED_MOUSE_RIGHT
Definition: SGUIMessage.h:55
@ GUIM_PRESSED_MOUSE_RELEASE_RIGHT
Definition: SGUIMessage.h:57
@ GUIM_LOST_FOCUS
Definition: SGUIMessage.h:52
@ GUIM_PRESSED
Definition: SGUIMessage.h:45
@ GUIM_GOT_FOCUS
Definition: SGUIMessage.h:51
@ GUIM_MOUSE_RELEASE_RIGHT
Definition: SGUIMessage.h:41
@ GUIM_PRESSED_MOUSE_RELEASE
Definition: SGUIMessage.h:56
@ GUIM_PRESSED_MOUSE_RIGHT_DISABLED
Definition: SGUIMessage.h:54
@ GUIM_MOUSE_DOWN_LEFT
Definition: SGUIMessage.h:35
@ GUIM_MOUSE_LEAVE
Definition: SGUIMessage.h:31
@ GUIM_MOUSE_PRESS_RIGHT
Definition: SGUIMessage.h:34
@ GUIM_MOUSE_DBLCLICK_RIGHT
Definition: SGUIMessage.h:39
@ GUIM_MOUSE_DBLCLICK_LEFT_ITEM
Definition: SGUIMessage.h:38
@ GUIM_RELEASED
Definition: SGUIMessage.h:47
@ GUIM_PRESSED_MOUSE_RIGHT
Definition: SGUIMessage.h:53
@ GUIM_MOUSE_RELEASE_LEFT
Definition: SGUIMessage.h:40
@ GUIM_DOUBLE_PRESSED
Definition: SGUIMessage.h:48
@ GUIM_MOUSE_OVER
Definition: SGUIMessage.h:29
@ GUIM_MOUSE_PRESS_LEFT_ITEM
Definition: SGUIMessage.h:33
@ GUIM_KEYDOWN
Definition: SGUIMessage.h:46
@ GUIM_MOUSE_WHEEL_DOWN
Definition: SGUIMessage.h:43
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: SGUIMessage.h:68
SGUIMessage(EGUIMessageType _type)
Definition: SGUIMessage.h:72
CStr value
Optional data.
Definition: SGUIMessage.h:91
void Skip(bool skip=true)
This method can be used to allow other event handlers to process this GUI event, by default an event ...
Definition: SGUIMessage.h:81
EGUIMessageType type
Describes what the message regards.
Definition: SGUIMessage.h:86
SGUIMessage(EGUIMessageType _type, const CStr &_value)
Definition: SGUIMessage.h:73
bool skipped
Flag that specifies if object skipped handling the event.
Definition: SGUIMessage.h:96
NONCOPYABLE(SGUIMessage)