Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLGUI_GUIMESSAGE_H__
00024 #define __PLGUI_GUIMESSAGE_H__
00025 #pragma once
00026
00027
00028
00029
00030
00031 #include <PLMath/Vector2i.h>
00032 #include "PLGui/PLGui.h"
00033
00034
00035
00036
00037
00038 namespace PLGui {
00039
00040
00041
00042
00043
00044 class Widget;
00045 class Graphics;
00046 class DataObject;
00047 class Timer;
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 class GuiMessage {
00058
00059
00060
00061
00062
00063 public:
00064 static PLGUI_API GuiMessage OnWakeup();
00065 static PLGUI_API GuiMessage OnExit();
00066 static PLGUI_API GuiMessage OnTimer(Timer *pTimer);
00067 static PLGUI_API GuiMessage OnUserMessage(Widget *pWidget, PLCore::uint32 nData, void *pData);
00068 static PLGUI_API GuiMessage OnInternalMessage(PLCore::uint32 nData, PLCore::uint32 nExtData);
00069 static PLGUI_API GuiMessage OnThemeChanged(Widget *pWidget);
00070 static PLGUI_API GuiMessage OnUpdateContent(Widget *pWidget);
00071 static PLGUI_API GuiMessage OnUpdateChildWidget(Widget *pWidget, Widget *pChildWidget);
00072 static PLGUI_API GuiMessage OnAddChildWidget(Widget *pWidget, Widget *pChildWidget);
00073 static PLGUI_API GuiMessage OnRemoveChildWidget(Widget *pWidget, Widget *pChildWidget);
00074 static PLGUI_API GuiMessage OnClose(Widget *pWidget);
00075 static PLGUI_API GuiMessage OnCreate(Widget *pWidget);
00076 static PLGUI_API GuiMessage OnDestroy(Widget *pWidget);
00077 static PLGUI_API GuiMessage OnShow(Widget *pWidget);
00078 static PLGUI_API GuiMessage OnHide(Widget *pWidget);
00079 static PLGUI_API GuiMessage OnEnable(Widget *pWidget);
00080 static PLGUI_API GuiMessage OnDisable(Widget *pWidget);
00081 static PLGUI_API GuiMessage OnGetFocus(Widget *pWidget);
00082 static PLGUI_API GuiMessage OnLooseFocus(Widget *pWidget);
00083 static PLGUI_API GuiMessage OnActivate(Widget *pWidget, bool bActivate);
00084 static PLGUI_API GuiMessage OnDrawBackground(Widget *pWidget, Graphics *pGraphics);
00085 static PLGUI_API GuiMessage OnDraw(Widget *pWidget, Graphics *pGraphics);
00086 static PLGUI_API GuiMessage OnMove(Widget *pWidget, const PLMath::Vector2i &vPos);
00087 static PLGUI_API GuiMessage OnSize(Widget *pWidget, const PLMath::Vector2i &vSize);
00088 static PLGUI_API GuiMessage OnWindowState(Widget *pWidget, EWindowState nWindowState);
00089 static PLGUI_API GuiMessage OnEnterFullscreen(Widget *pWidget);
00090 static PLGUI_API GuiMessage OnLeaveFullscreen(Widget *pWidget);
00091 static PLGUI_API GuiMessage OnPreferredSize(Widget *pWidget, const PLMath::Vector2i &vSize);
00092 static PLGUI_API GuiMessage OnAdjustContent(Widget *pWidget);
00093 static PLGUI_API GuiMessage OnMouseEnter(Widget *pWidget);
00094 static PLGUI_API GuiMessage OnMouseLeave(Widget *pWidget);
00095 static PLGUI_API GuiMessage OnMouseOver(Widget *pWidget, bool bMouseOver);
00096 static PLGUI_API GuiMessage OnMouseMove(Widget *pWidget, const PLMath::Vector2i &vPos);
00097 static PLGUI_API GuiMessage OnMouseHover(Widget *pWidget);
00098 static PLGUI_API GuiMessage OnMousePosUpdate(Widget *pWidget, const PLMath::Vector2i &vPos);
00099 static PLGUI_API GuiMessage OnMouseButtonDown(Widget *pWidget, EMouseButton nButton, const PLMath::Vector2i &vPos);
00100 static PLGUI_API GuiMessage OnMouseButtonUp(Widget *pWidget, EMouseButton nButton, const PLMath::Vector2i &vPos);
00101 static PLGUI_API GuiMessage OnMouseButtonClick(Widget *pWidget, EMouseButton nButton, const PLMath::Vector2i &vPos);
00102 static PLGUI_API GuiMessage OnMouseButtonDoubleClick(Widget *pWidget, EMouseButton nButton, const PLMath::Vector2i &vPos);
00103 static PLGUI_API GuiMessage OnMouseWheel(Widget *pWidget, int nDelta);
00104 static PLGUI_API GuiMessage OnKeyDown(Widget *pWidget, PLCore::uint32 nKey, PLCore::uint32 nModifiers);
00105 static PLGUI_API GuiMessage OnKeyUp(Widget *pWidget, PLCore::uint32 nKey, PLCore::uint32 nModifiers);
00106 static PLGUI_API GuiMessage OnHotkey(Widget *pWidget, PLCore::uint32 nHotkey);
00107 static PLGUI_API GuiMessage OnDrop(Widget *pWidget, DataObject *pDataObject);
00108
00109
00110
00111
00112
00113 public:
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 PLGUI_API GuiMessage(Widget *pWidget = nullptr, EMessageType nType = MessageOnUnknown);
00124
00125
00126
00127
00128
00129
00130
00131
00132 PLGUI_API GuiMessage(const GuiMessage &cOther);
00133
00134
00135
00136
00137
00138 PLGUI_API ~GuiMessage();
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150 PLGUI_API bool operator ==(const GuiMessage &cOther) const;
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162 PLGUI_API GuiMessage &operator =(const GuiMessage &cOther);
00163
00164
00165
00166
00167
00168
00169
00170
00171 PLGUI_API PLCore::String ToString() const;
00172
00173
00174
00175
00176
00177
00178
00179
00180 inline Widget *GetWidget() const {
00181 return m_pWidget;
00182 }
00183
00184
00185
00186
00187
00188
00189
00190
00191 inline EMessageType GetType() const {
00192 return m_nType;
00193 }
00194
00195
00196
00197
00198
00199
00200
00201
00202 inline PLCore::uint32 GetData() const {
00203 return m_nData;
00204 }
00205
00206
00207
00208
00209
00210
00211
00212
00213 inline int GetDelta() const {
00214 return m_nDelta;
00215 }
00216
00217
00218
00219
00220
00221
00222
00223
00224 inline EWindowState GetWindowState() const {
00225 return m_nWindowState;
00226 }
00227
00228
00229
00230
00231
00232
00233
00234
00235 inline EMouseButton GetMouseButton() const {
00236 return m_nMouseButton;
00237 }
00238
00239
00240
00241
00242
00243
00244
00245
00246 inline PLCore::uint32 GetKey() const {
00247 return m_nKey;
00248 }
00249
00250
00251
00252
00253
00254
00255
00256
00257 inline bool GetState() const {
00258 return m_bState;
00259 }
00260
00261
00262
00263
00264
00265
00266
00267
00268 inline void *GetDataPointer() const {
00269 return m_pDataPtr;
00270 }
00271
00272
00273
00274
00275
00276
00277
00278
00279 inline PLCore::uint32 GetExtData() const {
00280 return m_nExtData;
00281 }
00282
00283
00284
00285
00286
00287
00288
00289
00290 inline DataObject *GetDataObject() const {
00291 return m_pDataObject;
00292 }
00293
00294
00295
00296
00297
00298
00299
00300
00301 inline Widget *GetChildWidget() const {
00302 return m_pChildWidget;
00303 }
00304
00305
00306
00307
00308
00309
00310
00311
00312 inline Graphics *GetGraphics() const {
00313 return m_pGraphics;
00314 }
00315
00316
00317
00318
00319
00320
00321
00322
00323 inline Timer *GetTimer() const {
00324 return m_pTimer;
00325 }
00326
00327
00328
00329
00330
00331
00332
00333
00334 inline const PLCore::uint32 GetModifiers() const {
00335 return m_nModifiers;
00336 }
00337
00338
00339
00340
00341
00342
00343
00344
00345 inline const PLMath::Vector2i &GetPosSize() const {
00346 return m_vPosSize;
00347 }
00348
00349
00350
00351
00352
00353 protected:
00354
00355 Widget *m_pWidget;
00356
00357
00358 EMessageType m_nType;
00359
00360
00361 union {
00362 PLCore::uint32 m_nData;
00363 int m_nDelta;
00364 EWindowState m_nWindowState;
00365 EMouseButton m_nMouseButton;
00366 PLCore::uint32 m_nKey;
00367 bool m_bState;
00368 };
00369
00370
00371 union {
00372 void *m_pDataPtr;
00373 PLCore::uint32 m_nExtData;
00374 DataObject *m_pDataObject;
00375 Widget *m_pChildWidget;
00376 Graphics *m_pGraphics;
00377 Timer *m_pTimer;
00378 PLCore::uint32 m_nModifiers;
00379 };
00380
00381
00382 PLMath::Vector2i m_vPosSize;
00383
00384
00385 };
00386
00387
00388
00389
00390
00391 }
00392
00393
00394 #endif // __PLGUI_GUIMESSAGE_H__