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