GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/setupbuttonitem.cpp Lines: 19 27 70.4 %
Date: 2017-11-29 Branches: 8 16 50.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2017  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
4
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
4
                                 ActionListener *const listener) :
37
    SetupItem(text, description, "", parent, eventName, MainConfig_false),
38
    mHorizont(nullptr),
39

16
    mButton(nullptr)
40
{
41
4
    mValueType = VSTR;
42

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

6
}