GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/setupbuttonitem.cpp Lines: 20 28 71.4 %
Date: 2021-03-17 Branches: 7 14 50.0 %

Line Branch Exec Source
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
2
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
2
                                 ActionListener *const listener) :
38
    SetupItem(text, description, "", parent, eventName, MainConfig_false),
39
    mHorizont(nullptr),
40
8
    mButton(nullptr)
41
{
42
2
    mValueType = VSTR;
43
2
    mWidget = new Button(this,
44
        text,
45
        actionEventId,
46
        BUTTON_SKIN,
47

2
        listener);
48
2
    createControls();
49
2
}
50
51
4
SetupButtonItem::~SetupButtonItem()
52
{
53
2
    mHorizont = nullptr;
54
2
    mWidget = nullptr;
55
2
    mButton = nullptr;
56
2
}
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
2
void SetupButtonItem::createControls()
75
{
76
2
    mHorizont = new HorizontContainer(this, 32, 2);
77
78
    // TRANSLATORS: setup item button
79
2
    mHorizont->add(mWidget);
80
81
4
    mParent->getContainer()->add2(mHorizont, true, 4);
82
2
    mParent->addControl(this);
83
//    mWidget->addActionListener(this);
84
2
}
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

3
}