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

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2018  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "gui/widgets/setupbuttonitem.h"
22
23
#include "gui/widgets/button.h"
24
#include "gui/widgets/horizontcontainer.h"
25
#include "gui/widgets/vertcontainer.h"
26
27
#include "gui/widgets/tabs/setuptabscroll.h"
28
29
#include "debug.h"
30
31
2
SetupButtonItem::SetupButtonItem(const std::string &restrict text,
32
                                 const std::string &restrict description,
33
                                 const std::string &restrict actionEventId,
34
                                 SetupTabScroll *restrict const parent,
35
                                 const std::string &restrict eventName,
36
2
                                 ActionListener *const listener) :
37
    SetupItem(text, description, "", parent, eventName, MainConfig_false),
38
    mHorizont(nullptr),
39
8
    mButton(nullptr)
40
{
41
2
    mValueType = VSTR;
42
2
    mWidget = new Button(this,
43
        text,
44
        actionEventId,
45
        BUTTON_SKIN,
46

2
        listener);
47
2
    createControls();
48
2
}
49
50
4
SetupButtonItem::~SetupButtonItem()
51
{
52
2
    mHorizont = nullptr;
53
2
    mWidget = nullptr;
54
2
    mButton = nullptr;
55
2
}
56
57
void SetupButtonItem::save()
58
{
59
}
60
61
void SetupButtonItem::cancel(const std::string &eventName A_UNUSED)
62
{
63
}
64
65
void SetupButtonItem::externalUpdated(const std::string &eventName A_UNUSED)
66
{
67
}
68
69
void SetupButtonItem::rereadValue()
70
{
71
}
72
73
2
void SetupButtonItem::createControls()
74
{
75
2
    mHorizont = new HorizontContainer(this, 32, 2);
76
77
    // TRANSLATORS: setup item button
78
2
    mHorizont->add(mWidget);
79
80
4
    mParent->getContainer()->add2(mHorizont, true, 4);
81
2
    mParent->addControl(this);
82
//    mWidget->addActionListener(this);
83
2
}
84
85
void SetupButtonItem::fromWidget()
86
{
87
}
88
89
void SetupButtonItem::toWidget()
90
{
91
}
92
93
void SetupButtonItem::action(const ActionEvent &event A_UNUSED)
94
{
95
}
96
97
void SetupButtonItem::apply(const std::string &eventName A_UNUSED)
98
{
99

3
}