ManaPlus
src
gui
widgets
popup.h
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2004-2009 The Mana World Development Team
4
* Copyright (C) 2009-2010 The Mana Developers
5
* Copyright (C) 2011-2019 The ManaPlus Developers
6
* Copyright (C) 2019-2021 Andrei Karas
7
* Copyright (C) 2009 Aethyra Development Team
8
*
9
* This file is part of The ManaPlus Client.
10
*
11
* This program is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* any later version.
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License
22
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
*/
24
25
#ifndef GUI_WIDGETS_POPUP_H
26
#define GUI_WIDGETS_POPUP_H
27
28
#include "
gui/widgets/container.h
"
29
30
#include "
listeners/mouselistener.h
"
31
#include "
listeners/widgetlistener.h
"
32
33
class
ImageCollection
;
34
class
Skin
;
35
class
WindowContainer
;
36
49
class
Popup
notfinal
:
public
Container
,
50
public
MouseListener
,
51
public
WidgetListener
52
{
53
public
:
62
Popup
(
const
std::string &name,
63
std::string skin);
64
65
A_DELETE_COPY
(
Popup
)
66
67
70
~Popup
()
override
;
71
75
static
void
setWindowContainer
(
WindowContainer
*
const
windowContainer
);
76
80
void
draw
(
Graphics
*
const
graphics)
override
A_NONNULL
(2);
81
82
void
safeDraw
(
Graphics
*
const
graphics)
override
A_NONNULL
(2);
83
87
void
setContentSize
(
int
width,
int
height);
88
92
void
setLocationRelativeTo
(
const
Widget
*
const
widget);
93
94
void
mouseMoved
(
MouseEvent
&event)
override
;
95
99
void
setMinWidth
(
const
int
width);
100
101
int
getMinWidth
() const
noexcept2
A_WARN_UNUSED
102
{
return
mMinWidth
; }
103
107
void
setMinHeight
(
const
int
height);
108
109
int
getMinHeight
() const
noexcept2
A_WARN_UNUSED
110
{
return
mMinHeight
; }
111
115
void
setMaxWidth
(
const
int
width);
116
117
int
getMaxWidth
() const
noexcept2
A_WARN_UNUSED
118
{
return
mMaxWidth
; }
119
123
void
setMaxHeight
(
const
int
height);
124
125
int
getMaxHeight
() const
noexcept2
A_WARN_UNUSED
126
{
return
mMaxHeight
; }
127
135
int
getPadding
() const
noexcept2
A_WARN_UNUSED
136
{
return
mPadding
; }
137
138
void
setPadding
(
int
padding)
noexcept2
139
{
mPadding
= padding; }
140
144
void
setPopupName
(
const
std::string &name)
noexcept2
145
{
mPopupName
= name; }
146
147
const
std::string &
getPopupName
() const
noexcept2
148
{
return
mPopupName
; }
149
154
void
scheduleDelete
();
155
156
// Inherited from BasicContainer
157
158
Rect
getChildrenArea
()
override
;
159
166
void
position
(
const
int
x
,
const
int
y
);
167
168
void
hide
();
169
170
void
widgetResized
(
const
Event
&event)
override
;
171
172
void
widgetMoved
(
const
Event
&event)
override
final
;
173
174
bool
isPopupVisible
() const
noexcept2
175
{
return
mVisible
==
Visible_true
; }
176
177
void
postInit
()
override
178
{
mInit
=
true
; }
179
180
protected
:
181
int
mPadding
;
182
Skin
*
mSkin
;
184
private
:
185
std::string
mPopupName
;
186
ImageCollection
*
mVertexes
A_NONNULLPOINTER
;
187
int
mMinWidth
;
188
int
mMinHeight
;
189
int
mMaxWidth
;
190
int
mMaxHeight
;
191
bool
mInit
;
192
};
193
194
#endif
// GUI_WIDGETS_POPUP_H
Container
Definition:
container.h:39
Event
Definition:
event.h:79
Graphics
Definition:
graphics.h:109
ImageCollection
Definition:
imagecollection.h:32
MouseEvent
Definition:
mouseevent.h:81
MouseListener
Definition:
mouselistener.h:78
Popup
Definition:
popup.h:52
Popup::getPopupName
const std::string & getPopupName() const
Definition:
popup.h:147
Popup::mSkin
Skin * mSkin
Definition:
popup.h:182
Popup::setPadding
void setPadding(int padding)
Definition:
popup.h:138
Popup::scheduleDelete
void scheduleDelete()
Definition:
popup.cpp:230
Popup::getMinWidth
int getMinWidth() const
Definition:
popup.h:101
Popup::setMaxHeight
void setMaxHeight(const int height)
Definition:
popup.cpp:225
Popup::~Popup
~Popup()
Definition:
popup.cpp:84
Popup::setMaxWidth
void setMaxWidth(const int width)
Definition:
popup.cpp:220
Popup::setLocationRelativeTo
void setLocationRelativeTo(const Widget *const widget)
Definition:
popup.cpp:174
Popup::setPopupName
void setPopupName(const std::string &name)
Definition:
popup.h:144
Popup::hide
void hide()
Definition:
popup.cpp:265
Popup::getMaxWidth
int getMaxWidth() const
Definition:
popup.h:117
Popup::mMinHeight
int mMinHeight
Definition:
popup.h:188
Popup::draw
void draw(Graphics *const graphics)
Definition:
popup.cpp:109
Popup::setWindowContainer
static void setWindowContainer(WindowContainer *const windowContainer)
Definition:
popup.cpp:104
Popup::setMinHeight
void setMinHeight(const int height)
Definition:
popup.cpp:207
Popup::widgetMoved
void widgetMoved(const Event &event)
Definition:
popup.cpp:276
Popup::Popup
Popup(const std::string &name, std::string skin)
Definition:
popup.cpp:40
Popup::getPadding
int getPadding() const
Definition:
popup.h:135
Popup::setMinWidth
void setMinWidth(const int width)
Definition:
popup.cpp:194
Popup::mPopupName
std::string mPopupName
Definition:
popup.h:185
Popup::setContentSize
void setContentSize(int width, int height)
Definition:
popup.cpp:155
Popup::safeDraw
void safeDraw(Graphics *const graphics)
Definition:
popup.cpp:133
Popup::getMinHeight
int getMinHeight() const
Definition:
popup.h:109
Popup::mVertexes
ImageCollection * mVertexes
Definition:
popup.h:186
Popup::position
void position(const int x, const int y)
Definition:
popup.cpp:235
Popup::mMinWidth
int mMinWidth
Definition:
popup.h:187
Popup::getChildrenArea
Rect getChildrenArea()
Definition:
popup.cpp:148
Popup::mMaxWidth
int mMaxWidth
Definition:
popup.h:189
Popup::isPopupVisible
bool isPopupVisible() const
Definition:
popup.h:174
Popup::widgetResized
void widgetResized(const Event &event)
Definition:
popup.cpp:271
Popup::mouseMoved
void mouseMoved(MouseEvent &event)
Definition:
popup.cpp:255
Popup::mMaxHeight
int mMaxHeight
Definition:
popup.h:190
Popup::mPadding
int mPadding
Definition:
popup.h:181
Popup::getMaxHeight
int getMaxHeight() const
Definition:
popup.h:125
Popup::postInit
void postInit()
Definition:
popup.h:177
Popup::mInit
bool mInit
Definition:
popup.h:191
Rect
Definition:
rect.h:74
Skin
Definition:
skin.h:37
WidgetListener
Definition:
widgetlistener.h:81
Widget
Definition:
widget.h:99
Widget::mVisible
Visible mVisible
Definition:
widget.h:963
WindowContainer
Definition:
windowcontainer.h:36
container.h
y
y
Definition:
graphics_calcImageRect.hpp:73
x
x
Definition:
graphics_calcImageRect.hpp:73
A_WARN_UNUSED
#define A_WARN_UNUSED
Definition:
localconsts.h:161
notfinal
#define notfinal
Definition:
localconsts.h:261
A_NONNULL
#define A_NONNULL(...)
Definition:
localconsts.h:168
A_NONNULLPOINTER
#define A_NONNULLPOINTER
Definition:
localconsts.h:266
noexcept2
#define noexcept2
Definition:
localconsts.h:50
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition:
localconsts.h:53
mouselistener.h
Visible_true
const bool Visible_true
Definition:
visible.h:30
widgetlistener.h
windowContainer
WindowContainer * windowContainer
Definition:
windowcontainer.cpp:34
Generated on Wed Mar 17 2021 19:19:06 for ManaPlus by
1.9.1