ManaPlus
src
gui
widgets
setupbuttonitem.cpp
Go to the documentation of this file.
1
/*
2
* The ManaPlus Client
3
* Copyright (C) 2011-2019 The ManaPlus Developers
4
* Copyright (C) 2019-2021 Andrei Karas
5
*
6
* This file is part of The ManaPlus Client.
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#include "
gui/widgets/setupbuttonitem.h
"
23
24
#include "
gui/widgets/button.h
"
25
#include "
gui/widgets/horizontcontainer.h
"
26
#include "
gui/widgets/vertcontainer.h
"
27
28
#include "
gui/widgets/tabs/setuptabscroll.h
"
29
30
#include "
debug.h
"
31
32
SetupButtonItem::SetupButtonItem
(
const
std::string &
restrict
text,
33
const
std::string &
restrict
description,
34
const
std::string &
restrict
actionEventId,
35
SetupTabScroll
*
restrict
const
parent,
36
const
std::string &
restrict
eventName,
37
ActionListener
*
const
listener
) :
38
SetupItem
(text, description,
""
, parent, eventName,
MainConfig_false
),
39
mHorizont(
nullptr
),
40
mButton(
nullptr
)
41
{
42
mValueType
=
VSTR
;
43
mWidget
=
new
Button
(
this
,
44
text,
45
actionEventId,
46
BUTTON_SKIN
,
47
listener
);
48
createControls
();
49
}
50
51
SetupButtonItem::~SetupButtonItem
()
52
{
53
mHorizont
=
nullptr
;
54
mWidget
=
nullptr
;
55
mButton
=
nullptr
;
56
}
57
58
void
SetupButtonItem::save
()
59
{
60
}
61
62
void
SetupButtonItem::cancel
(
const
std::string &eventName
A_UNUSED
)
63
{
64
}
65
66
void
SetupButtonItem::externalUpdated
(
const
std::string &eventName
A_UNUSED
)
67
{
68
}
69
70
void
SetupButtonItem::rereadValue
()
71
{
72
}
73
74
void
SetupButtonItem::createControls
()
75
{
76
mHorizont
=
new
HorizontContainer
(
this
, 32, 2);
77
78
// TRANSLATORS: setup item button
79
mHorizont
->
add
(
mWidget
);
80
81
mParent
->
getContainer
()->
add2
(
mHorizont
,
true
, 4);
82
mParent
->
addControl
(
this
);
83
// mWidget->addActionListener(this);
84
}
85
86
void
SetupButtonItem::fromWidget
()
87
{
88
}
89
90
void
SetupButtonItem::toWidget
()
91
{
92
}
93
94
void
SetupButtonItem::action
(
const
ActionEvent
&event
A_UNUSED
)
95
{
96
}
97
98
void
SetupButtonItem::apply
(
const
std::string &eventName
A_UNUSED
)
99
{
100
}
button.h
BUTTON_SKIN
const std::string BUTTON_SKIN
Definition:
button.h:89
ActionEvent
Definition:
actionevent.h:98
ActionListener
Definition:
actionlistener.h:79
Button
Definition:
button.h:102
HorizontContainer
Definition:
horizontcontainer.h:41
HorizontContainer::add
void add(Widget *const widget)
Definition:
horizontcontainer.cpp:42
SetupButtonItem::createControls
void createControls()
Definition:
setupbuttonitem.cpp:74
SetupButtonItem::rereadValue
void rereadValue()
Definition:
setupbuttonitem.cpp:70
SetupButtonItem::action
void action(const ActionEvent &event)
Definition:
setupbuttonitem.cpp:94
SetupButtonItem::mHorizont
HorizontContainer * mHorizont
Definition:
setupbuttonitem.h:66
SetupButtonItem::apply
void apply(const std::string &eventName)
Definition:
setupbuttonitem.cpp:98
SetupButtonItem::SetupButtonItem
SetupButtonItem(const std::string &text, const std::string &description, const std::string &actionEventId, SetupTabScroll *const parent, const std::string &eventName, ActionListener *const listener)
Definition:
setupbuttonitem.cpp:32
SetupButtonItem::toWidget
void toWidget()
Definition:
setupbuttonitem.cpp:90
SetupButtonItem::fromWidget
void fromWidget()
Definition:
setupbuttonitem.cpp:86
SetupButtonItem::mButton
Button * mButton
Definition:
setupbuttonitem.h:67
SetupButtonItem::save
void save()
Definition:
setupbuttonitem.cpp:58
SetupButtonItem::~SetupButtonItem
~SetupButtonItem()
Definition:
setupbuttonitem.cpp:51
SetupButtonItem::cancel
void cancel(const std::string &eventName)
Definition:
setupbuttonitem.cpp:62
SetupButtonItem::externalUpdated
void externalUpdated(const std::string &eventName)
Definition:
setupbuttonitem.cpp:66
SetupItem
Definition:
setupitem.h:53
SetupItem::mWidget
Widget * mWidget
Definition:
setupitem.h:143
SetupItem::mParent
SetupTabScroll * mParent
Definition:
setupitem.h:135
SetupItem::VSTR
@ VSTR
Definition:
setupitem.h:58
SetupItem::mValueType
int mValueType
Definition:
setupitem.h:147
SetupTabScroll
Definition:
setuptabscroll.h:34
SetupTabScroll::addControl
void addControl(SetupItem *const widget)
Definition:
setuptabscroll.cpp:74
SetupTabScroll::getContainer
VertContainer * getContainer() const
Definition:
setuptabscroll.h:46
VertContainer::add2
void add2(Widget *const widget, const bool resizable, const int spacing)
Definition:
vertcontainer.cpp:51
debug.h
horizontcontainer.h
restrict
#define restrict
Definition:
localconsts.h:165
nullptr
#define nullptr
Definition:
localconsts.h:45
A_UNUSED
#define A_UNUSED
Definition:
localconsts.h:160
MainConfig_false
const bool MainConfig_false
Definition:
mainconfig.h:30
anonymous_namespace{itemlinkhandler.cpp}::listener
OpenUrlListener listener
Definition:
itemlinkhandler.cpp:56
setupbuttonitem.h
setuptabscroll.h
vertcontainer.h
Generated on Wed Mar 17 2021 19:19:06 for ManaPlus by
1.9.1