ManaPlus
src
gui
windowmenu.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
*
8
* This file is part of The ManaPlus Client.
9
*
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the GNU General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
#ifndef GUI_WINDOWMENU_H
25
#define GUI_WINDOWMENU_H
26
27
#include "
enums/input/inputaction.h
"
28
29
#include "
gui/widgets/container.h
"
30
31
#include "
listeners/actionlistener.h
"
32
#include "
listeners/mouselistener.h
"
33
#include "
listeners/selectionlistener.h
"
34
35
#include "
localconsts.h
"
36
37
class
Button
;
38
class
ImageSet
;
39
40
struct
ButtonInfo
;
41
struct
ButtonText
;
42
49
class
WindowMenu
final
:
public
Container
,
50
public
ConfigListener
,
51
public
ActionListener
,
52
public
SelectionListener
,
53
public
MouseListener
54
{
55
public
:
56
explicit
WindowMenu
(
const
Widget2
*
const
widget);
57
58
A_DELETE_COPY
(
WindowMenu
)
59
60
~WindowMenu
()
override
final
;
61
62
void
action
(
const
ActionEvent
&event)
override
final
;
63
64
void
mousePressed
(
MouseEvent
&event)
override
final
;
65
66
void
mouseMoved
(
MouseEvent
&event)
override
final
;
67
68
void
mouseExited
(
MouseEvent
& event
A_UNUSED
)
override
final
;
69
70
std::map <std::string, ButtonInfo*> &
getButtonNames
()
A_WARN_UNUSED
71
{
return
mButtonNames
; }
72
73
STD_VECTOR <Button*> &
getButtons
()
A_WARN_UNUSED
74
{
return
mButtons
; }
75
76
STD_VECTOR <ButtonText*> &
getButtonTexts
()
A_WARN_UNUSED
77
{
return
mButtonTexts
; }
78
79
void
showButton
(
const
std::string &name,
const
Visible
visible);
80
81
void
loadButtons
();
82
83
void
saveButtons
()
const
;
84
85
void
optionChanged
(
const
std::string &name)
override
final
;
86
87
#ifdef USE_PROFILER
88
void
logicChildren
();
89
#endif
// USE_PROFILER
90
91
protected
:
92
void
drawChildren
(
Graphics
*
const
graphics)
override
final
93
A_NONNULL
(2);
94
95
void
safeDrawChildren
(
Graphics
*
const
graphics)
override
final
96
A_NONNULL
(2);
97
98
private
:
99
inline
void
addButton
(
const
char
*
const
text,
100
const
int
iconNumber,
101
const
std::string &description,
102
int
&
restrict
x
,
int
&
restrict
h,
103
const
InputActionT
key,
104
const
Visible
visible);
105
106
void
updateButtons
();
107
108
Skin
*
mSkin
;
109
ImageSet
*
mImageSet
;
110
int
mPadding
;
111
int
mSpacing
;
112
STD_VECTOR <Button*>
mButtons
;
113
STD_VECTOR <ButtonText*>
mButtonTexts
;
114
std::map <std::string, ButtonInfo*>
mButtonNames
;
115
bool
mHaveMouse
;
116
int
mAutoHide
;
117
bool
mSmallWindow
;
118
};
119
120
extern
WindowMenu
*
windowMenu
;
121
122
#endif
// GUI_WINDOWMENU_H
actionlistener.h
ActionEvent
Definition:
actionevent.h:98
ActionListener
Definition:
actionlistener.h:79
BasicContainer::logicChildren
virtual void logicChildren()
Definition:
basiccontainer.cpp:399
Button
Definition:
button.h:102
ConfigListener
Definition:
configlistener.h:38
Container
Definition:
container.h:39
Graphics
Definition:
graphics.h:109
ImageSet
Definition:
imageset.h:39
MouseEvent
Definition:
mouseevent.h:81
MouseListener
Definition:
mouselistener.h:78
SelectionListener
Definition:
selectionlistener.h:82
Skin
Definition:
skin.h:37
Widget2
Definition:
widget2.h:37
WindowMenu
Definition:
windowmenu.h:54
WindowMenu::loadButtons
void loadButtons()
Definition:
windowmenu.cpp:484
WindowMenu::saveButtons
void saveButtons() const
Definition:
windowmenu.cpp:537
WindowMenu::WindowMenu
WindowMenu(const Widget2 *const widget)
Definition:
windowmenu.cpp:53
WindowMenu::safeDrawChildren
void safeDrawChildren(Graphics *const graphics)
Definition:
windowmenu.cpp:566
WindowMenu::showButton
void showButton(const std::string &name, const Visible visible)
Definition:
windowmenu.cpp:447
WindowMenu::getButtonNames
std::map< std::string, ButtonInfo * > & getButtonNames()
Definition:
windowmenu.h:70
WindowMenu::~WindowMenu
~WindowMenu()
Definition:
windowmenu.cpp:273
WindowMenu::addButton
void addButton(const char *const text, const int iconNumber, const std::string &description, int &x, int &h, const InputActionT key, const Visible visible)
Definition:
windowmenu.cpp:323
WindowMenu::updateButtons
void updateButtons()
Definition:
windowmenu.cpp:459
WindowMenu::mImageSet
ImageSet * mImageSet
Definition:
windowmenu.h:109
WindowMenu::mButtonTexts
std::vector< ButtonText * > mButtonTexts
Definition:
windowmenu.h:113
WindowMenu::getButtonTexts
std::vector< ButtonText * > & getButtonTexts()
Definition:
windowmenu.h:76
WindowMenu::drawChildren
void drawChildren(Graphics *const graphics)
Definition:
windowmenu.cpp:554
WindowMenu::mousePressed
void mousePressed(MouseEvent &event)
Definition:
windowmenu.cpp:377
WindowMenu::mButtonNames
std::map< std::string, ButtonInfo * > mButtonNames
Definition:
windowmenu.h:114
WindowMenu::mouseMoved
void mouseMoved(MouseEvent &event)
Definition:
windowmenu.cpp:399
WindowMenu::getButtons
std::vector< Button * > & getButtons()
Definition:
windowmenu.h:73
WindowMenu::mButtons
std::vector< Button * > mButtons
Definition:
windowmenu.h:112
WindowMenu::mSkin
Skin * mSkin
Definition:
windowmenu.h:108
WindowMenu::mAutoHide
int mAutoHide
Definition:
windowmenu.h:116
WindowMenu::optionChanged
void optionChanged(const std::string &name)
Definition:
windowmenu.cpp:578
WindowMenu::action
void action(const ActionEvent &event)
Definition:
windowmenu.cpp:308
WindowMenu::mHaveMouse
bool mHaveMouse
Definition:
windowmenu.h:115
WindowMenu::mSmallWindow
bool mSmallWindow
Definition:
windowmenu.h:117
WindowMenu::mPadding
int mPadding
Definition:
windowmenu.h:110
WindowMenu::mSpacing
int mSpacing
Definition:
windowmenu.h:111
WindowMenu::mouseExited
void mouseExited(MouseEvent &event)
Definition:
windowmenu.cpp:438
container.h
x
x
Definition:
graphics_calcImageRect.hpp:73
inputaction.h
InputActionT
InputAction ::T InputActionT
Definition:
inputaction.h:717
localconsts.h
restrict
#define restrict
Definition:
localconsts.h:165
A_WARN_UNUSED
#define A_WARN_UNUSED
Definition:
localconsts.h:161
A_NONNULL
#define A_NONNULL(...)
Definition:
localconsts.h:168
final
#define final
Definition:
localconsts.h:46
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition:
localconsts.h:53
A_UNUSED
#define A_UNUSED
Definition:
localconsts.h:160
mouselistener.h
selectionlistener.h
ButtonInfo
Definition:
buttoninfo.h:34
ButtonText
Definition:
buttontext.h:32
Visible
bool Visible
Definition:
visible.h:30
windowMenu
WindowMenu * windowMenu
Definition:
windowmenu.cpp:51
Generated on Wed Mar 17 2021 19:19:07 for ManaPlus by
1.9.1