GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/linepart.h Lines: 9 11 81.8 %
Date: 2021-03-17 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009  Aethyra Development Team
4
 *  Copyright (C) 2011-2019  The ManaPlus Developers
5
 *  Copyright (C) 2019-2021  Andrei Karas
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_WIDGETS_LINEPART_H
24
#define GUI_WIDGETS_LINEPART_H
25
26
#include "gui/color.h"
27
28
#include <string>
29
30
#include "localconsts.h"
31
32
class Image;
33
34
class LinePart final
35
{
36
    public:
37
        LinePart(const int x, const int y, const Color &color,
38
                 const Color &color2, const std::string &text,
39
6
                 const bool bold) :
40
            mX(x),
41
            mY(y),
42
            mColor(color),
43
            mColor2(color2),
44
            mText(text),
45
            mType(0),
46
            mImage(nullptr),
47
12
            mBold(bold)
48
        {
49
        }
50
51
        LinePart(const int x, const int y, const Color &color,
52
                 const Color &color2, Image *const image) :
53
            mX(x),
54
            mY(y),
55
            mColor(color),
56
            mColor2(color2),
57
            mText(),
58
            mType(1),
59
            mImage(image),
60
            mBold(false)
61
        {
62
        }
63
64
7
        LinePart(const LinePart &l) :
65
7
            mX(l.mX),
66
7
            mY(l.mY),
67
            mColor(l.mColor),
68
            mColor2(l.mColor2),
69
            mText(l.mText),
70
7
            mType(l.mType),
71
7
            mImage(l.mImage),
72
35
            mBold(l.mBold)
73
        {
74
7
        }
75
76
        LinePart &operator=(const LinePart &l)
77
        {
78
            mX = l.mX;
79
            mY = l.mY;
80
            mColor = l.mColor;
81
            mColor2 = l.mColor2;
82
            mText = l.mText;
83
            mType = l.mType;
84
            mImage = l.mImage;
85
            mBold = l.mBold;
86
            return *this;
87
        }
88
89
        A_DEFAULT_COPY(LinePart)
90
91
        ~LinePart();
92
93
        int mX;
94
        int mY;
95
        Color mColor;
96
        Color mColor2;
97
        std::string mText;
98
        unsigned char mType;
99
        Image *mImage;
100
        bool mBold;
101
};
102
103
#endif  // GUI_WIDGETS_LINEPART_H