GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/windows/textselectdialog.h Lines: 0 1 0.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2017  The ManaPlus Developers
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#ifndef GUI_WINDOWS_TEXTSELECTDIALOG_H
24
#define GUI_WINDOWS_TEXTSELECTDIALOG_H
25
26
#include "gui/widgets/window.h"
27
28
#include "enums/simpletypes/allowquit.h"
29
30
#include "listeners/actionlistener.h"
31
#include "listeners/selectionlistener.h"
32
33
class Button;
34
class ScrollArea;
35
class NamesModel;
36
class ListBox;
37
38
class TextSelectDialog notfinal : public Window,
39
                                  public ActionListener,
40
                                  private SelectionListener
41
{
42
    public:
43
        /**
44
         * Constructor.
45
         */
46
        TextSelectDialog(const std::string &name,
47
                         const std::string &selectButton,
48
                         const AllowQuit allowQuit);
49
50
        A_DELETE_COPY(TextSelectDialog)
51
52
        /**
53
         * Destructor
54
         */
55
        ~TextSelectDialog();
56
57
        /**
58
         * Called when receiving actions from the widgets.
59
         */
60
        void action(const ActionEvent &event) override final;
61
62
        /**
63
         * Updates labels according to selected item.
64
         *
65
         * @see SelectionListener::selectionChanged
66
         */
67
        void valueChanged(const SelectionEvent &event) override final;
68
69
        /**
70
         * Sets the visibility of this window.
71
         */
72
        void setVisible(Visible visible) override final;
73
74
        void postInit() override;
75
76
        void addText(const std::string &text);
77
78
        std::string getText() const noexcept2 A_WARN_UNUSED
79
        { return mText; }
80
81
        void setTag(const int tag) noexcept2
82
        { mTag = tag; }
83
84
        int getTag() const noexcept2 A_WARN_UNUSED
85
        { return mTag; }
86
87
    protected:
88
        /**
89
         * Updates the state of buttons and labels.
90
         */
91
        void updateButtonsAndLabels();
92
93
        std::string mSelectButtonName;
94
        std::string mText;
95
        Button *mSelectButton A_NONNULLPOINTER;
96
        Button *mQuitButton A_NONNULLPOINTER;
97
        ListBox *mItemList A_NONNULLPOINTER;
98
        ScrollArea *mScrollArea A_NONNULLPOINTER;
99
        NamesModel *mModel A_NONNULLPOINTER;
100
        AllowQuit mAllowQuit;
101
        int mTag;
102
};
103
104
#endif  // GUI_WINDOWS_TEXTSELECTDIALOG_H