GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/tabs/setuptabscroll.h Lines: 2 4 50.0 %
Date: 2021-03-17 Branches: 0 0 0.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
#ifndef GUI_WIDGETS_TABS_SETUPTABSCROLL_H
23
#define GUI_WIDGETS_TABS_SETUPTABSCROLL_H
24
25
#include "gui/widgets/tabs/setuptab.h"
26
27
#include "localconsts.h"
28
29
class SetupItem;
30
class ScrollArea;
31
class VertContainer;
32
33
class SetupTabScroll notfinal : public SetupTab
34
{
35
    public:
36
        explicit SetupTabScroll(const Widget2 *const widget);
37
38
        A_DELETE_COPY(SetupTabScroll)
39
40
        ~SetupTabScroll() override;
41
42
        void addControl(SetupItem *const widget);
43
44
        void addControl(SetupItem *const widget, const std::string &event);
45
46
        VertContainer *getContainer() const noexcept2 A_WARN_UNUSED
47
486
        { return mContainer; }
48
49
        void apply() override;
50
51
        void cancel() override final;
52
53
        void externalUpdated() override;
54
55
        void externalUnloaded() override;
56
57
        void action(const ActionEvent &event A_UNUSED) override final
58
        { }
59
60
        int getPreferredFirstItemSize() const noexcept2 A_WARN_UNUSED
61
136
        { return mPreferredFirstItemSize; }
62
63
        void widgetResized(const Event &event) override final;
64
65
        void reread(const std::string &name);
66
67
        void clear() override final;
68
69
        const std::set<SetupItem*> &getAllItems() const noexcept2
70
        { return mAllItems; }
71
72
    protected:
73
        void removeItems();
74
75
        VertContainer *mContainer;
76
        ScrollArea *mScroll;
77
        std::map<std::string, SetupItem*> mItems;
78
        std::set<SetupItem*> mAllItems;
79
        int mPreferredFirstItemSize;
80
};
81
82
#endif  // GUI_WIDGETS_TABS_SETUPTABSCROLL_H