wavelength 1.0.0
Loading...
Searching...
No Matches
uicomponentselectmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5#include "msg/message.h"
6#include "os/mem.h"
7#include "os/prnstream.h"
8
9class UIComponent;
10class UIPanel;
11class UIScreen;
12
20
29public:
36 ~UIComponentSelectMsg() override = default;
37
48 UIComponentSelectMsg(UIComponent *pComponent, UIPanel *pPanel, UIScreen *pScreen, int nButton)
49 : mComponent(pComponent), mPanel(pPanel), mScreen(pScreen), mButton(nButton) {
50 }
51
58 void *operator new(size_t nSize) {
59 return PoolMemAlloc(static_cast<int>(nSize), "UIComponentSelectMsg", 0);
60 }
61
67 void operator delete(void *pBlock) {
68 PoolMemFree(pBlock);
69 }
70
78 Message *Clone() override {
79 return new UIComponentSelectMsg(*this);
80 }
81
89 int Type() override {
91 }
92
100 const char *GetName() const override {
101 return "UIComponentSelectMsg";
102 }
103
111 void PrintExtra(PrnStream &stream) const override;
112
115 return mComponent;
116 }
117
119 UIPanel *GetPanel() const {
120 return mPanel;
121 }
122
125 return mScreen;
126 }
127
129 int GetButton() const {
130 return mButton;
131 }
132
133private:
134 UIComponent *mComponent;
135 UIPanel *mPanel;
136 UIScreen *mScreen;
137 int mButton;
138};
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Text output stream.
Definition prnstream.h:16
UIComponent * GetComponent() const
Definition uicomponentselectmsg.h:114
void PrintExtra(PrnStream &stream) const override
Write the names of the component, the panel, and the screen.
const char * GetName() const override
Report this message's class name.
Definition uicomponentselectmsg.h:100
UIComponentSelectMsg(UIComponent *pComponent, UIPanel *pPanel, UIScreen *pScreen, int nButton)
Construct the message.
Definition uicomponentselectmsg.h:48
~UIComponentSelectMsg() override=default
Destroy the object.
UIPanel * GetPanel() const
Definition uicomponentselectmsg.h:119
int Type() override
Report this message's registered identity.
Definition uicomponentselectmsg.h:89
Message * Clone() override
Produce a heap copy of this message.
Definition uicomponentselectmsg.h:78
UIScreen * GetScreen() const
Definition uicomponentselectmsg.h:124
int GetButton() const
Definition uicomponentselectmsg.h:129
One control of a front-end panel, such as a label, a button, or a list.
Definition uicomponent.h:21
Group of components drawn from one .rnd file, which a screen shows.
Definition uipanel.h:35
One front-end screen, a set of panels shown together with one panel holding the focus.
Definition uiscreen.h:35
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.
int g_nUIComponentSelectMsgType
Identity that UIComponentSelectMsg::Type() reports.