Mana
Loading...
Searching...
No Matches
src
gui
widgets
popup.h
Go to the documentation of this file.
1
/*
2
* The Mana Client
3
* Copyright (C) 2004-2009 The Mana World Development Team
4
* Copyright (C) 2009-2012 The Mana Developers
5
* Copyright (C) 2009 Aethyra Development Team
6
*
7
* This file is part of The Mana Client.
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
*/
22
23
#pragma once
24
25
#include "
guichanfwd.h
"
26
27
#include "
gui/widgets/container.h
"
28
#include "
resources/theme.h
"
29
30
#include <guichan/mouselistener.hpp>
31
32
class
Skin
;
33
class
WindowContainer
;
34
47
class
Popup
:
public
Container
,
public
gcn::MouseListener
48
{
49
public
:
58
explicit
Popup
(
const
std::string &name = std::string(),
59
SkinType
skinType =
SkinType::Popup
);
60
64
~Popup
()
override
;
65
69
static
void
setWindowContainer
(
WindowContainer
*
windowContainer
);
70
71
// Container interface
72
void
add
(gcn::Widget *widget)
override
;
73
void
add
(gcn::Widget *widget,
int
x,
int
y)
override
;
74
78
void
draw
(gcn::Graphics *
graphics
)
override
;
79
83
void
drawFrame
(gcn::Graphics *
graphics
)
override
;
84
88
void
setContentSize
(
int
width,
int
height);
89
93
void
setLocationRelativeTo
(gcn::Widget *widget);
94
95
void
mouseMoved
(gcn::MouseEvent &event)
override
;
96
100
void
setMinWidth
(
int
width);
101
102
int
getMinWidth
()
const
{
return
mMinWidth
; }
103
107
void
setMinHeight
(
int
height);
108
109
int
getMinHeight
()
const
{
return
mMinHeight
; }
110
114
void
setMaxWidth
(
int
width);
115
116
int
getMaxWidth
()
const
{
return
mMaxWidth
; }
117
121
void
setMaxHeight
(
int
height);
122
123
int
getMaxHeight
()
const
{
return
mMaxHeight
; }
124
132
int
getPadding
()
const
{
return
mPadding
; }
133
134
void
setPadding
(
int
padding) {
mPadding
= padding; }
135
139
void
setPopupName
(
const
std::string &name)
140
{
mPopupName
= name; }
141
142
const
std::string &
getPopupName
()
const
143
{
return
mPopupName
; }
144
149
void
scheduleDelete
();
150
151
// Inherited from BasicContainer
152
153
gcn::Rectangle
getChildrenArea
()
override
;
154
161
void
position
(
int
x,
int
y);
162
166
const
Skin
&
getSkin
()
const
;
167
168
private
:
169
void
widgetAdded
(gcn::Widget *widget)
const
;
170
171
std::string
mPopupName
;
172
int
mMinWidth
= 100;
173
int
mMinHeight
= 40;
174
int
mMaxWidth
;
175
int
mMaxHeight
;
176
int
mPadding
;
178
SkinType
mSkinType
;
179
};
Container
A widget container.
Definition
container.h:41
Popup
A light version of the Window class.
Definition
popup.h:48
Popup::mSkinType
SkinType mSkinType
The skin type used when drawing the popup widget.
Definition
popup.h:178
Popup::getSkin
const Skin & getSkin() const
Returns the Skin used by this popup.
Definition
popup.cpp:200
Popup::setWindowContainer
static void setWindowContainer(WindowContainer *windowContainer)
Sets the window container to be used by new popups.
Definition
popup.cpp:64
Popup::setPadding
void setPadding(int padding)
Definition
popup.h:134
Popup::scheduleDelete
void scheduleDelete()
Schedule this popup for deletion.
Definition
popup.cpp:178
Popup::getMinWidth
int getMinWidth() const
Definition
popup.h:102
Popup::setMinHeight
void setMinHeight(int height)
Sets the minimum height of the popup.
Definition
popup.cpp:163
Popup::add
void add(gcn::Widget *widget) override
Definition
popup.cpp:69
Popup::mouseMoved
void mouseMoved(gcn::MouseEvent &event) override
Definition
popup.cpp:205
Popup::setPopupName
void setPopupName(const std::string &name)
Sets the name of the popup.
Definition
popup.h:139
Popup::setMinWidth
void setMinWidth(int width)
Sets the minimum width of the popup.
Definition
popup.cpp:158
Popup::getMaxWidth
int getMaxWidth() const
Definition
popup.h:116
Popup::mMinHeight
int mMinHeight
Minimum popup height.
Definition
popup.h:173
Popup::drawFrame
void drawFrame(gcn::Graphics *graphics) override
Draws the popup frame.
Definition
popup.cpp:112
Popup::getPadding
int getPadding() const
Gets the padding of the popup.
Definition
popup.h:132
Popup::draw
void draw(gcn::Graphics *graphics) override
Draws the popup.
Definition
popup.cpp:104
Popup::mPopupName
std::string mPopupName
Name of the popup.
Definition
popup.h:171
Popup::setContentSize
void setContentSize(int width, int height)
Sets the size of this popup.
Definition
popup.cpp:127
Popup::~Popup
~Popup() override
Destructor.
Definition
popup.cpp:59
Popup::getMinHeight
int getMinHeight() const
Definition
popup.h:109
Popup::mMinWidth
int mMinWidth
Minimum popup width.
Definition
popup.h:172
Popup::setMaxWidth
void setMaxWidth(int width)
Sets the maximum width of the popup.
Definition
popup.cpp:168
Popup::getPopupName
const std::string & getPopupName() const
Definition
popup.h:142
Popup::mMaxWidth
int mMaxWidth
Maximum popup width.
Definition
popup.h:174
Popup::setMaxHeight
void setMaxHeight(int height)
Sets the minimum height of the popup.
Definition
popup.cpp:173
Popup::widgetAdded
void widgetAdded(gcn::Widget *widget) const
Definition
popup.cpp:81
Popup::position
void position(int x, int y)
Sets the location to display the popup.
Definition
popup.cpp:183
Popup::getChildrenArea
gcn::Rectangle getChildrenArea() override
Definition
popup.cpp:120
Popup::mMaxHeight
int mMaxHeight
Maximum popup height.
Definition
popup.h:175
Popup::mPadding
int mPadding
Holds the padding of the popup.
Definition
popup.h:176
Popup::getMaxHeight
int getMaxHeight() const
Definition
popup.h:123
Popup::setLocationRelativeTo
void setLocationRelativeTo(gcn::Widget *widget)
Sets the location relative to the given widget.
Definition
popup.cpp:144
Skin
Definition
theme.h:154
WindowContainer
A window container.
Definition
windowcontainer.h:35
graphics
Graphics * graphics
Definition
client.cpp:104
container.h
guichanfwd.h
theme.h
SkinType
SkinType
Definition
theme.h:69
SkinType::Popup
@ Popup
windowContainer
WindowContainer * windowContainer
Definition
windowcontainer.cpp:29
Generated by
1.9.8