ManaPlus
colormodel.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-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_MODELS_COLORMODEL_H
23 #define GUI_MODELS_COLORMODEL_H
24 
25 #include "utils/stringvector.h"
26 
27 #include "gui/colorpair.h"
28 
29 #include "gui/models/listmodel.h"
30 
31 #include "localconsts.h"
32 
33 class Color;
34 class Widget2;
35 
36 class ColorModel final : public ListModel
37 {
38  public:
39  ColorModel();
40 
42 
43  ~ColorModel() override final;
44 
45  int getNumberOfElements() override final A_WARN_UNUSED;
46 
47  std::string getElementAt(int i) override final A_WARN_UNUSED;
48 
49  const ColorPair *getColorAt(const int i)
51 
53  { return mNames; }
54 
56  { return mNames.size(); }
57 
58  void add(const std::string &name,
59  const Color *const color1,
60  const Color *const color2);
61 
62  static ColorModel *createDefault(const Widget2 *const widget)
64 
65  protected:
67  STD_VECTOR<ColorPair> mColors;
68 };
69 
70 #endif // GUI_MODELS_COLORMODEL_H
std::vector< ColorPair > mColors
Definition: colormodel.h:67
void add(const std::string &name, const Color *const color1, const Color *const color2)
Definition: colormodel.cpp:61
StringVect mNames
Definition: colormodel.h:66
static ColorModel * createDefault(const Widget2 *const widget)
Definition: colormodel.cpp:72
size_t size()
Definition: colormodel.h:55
StringVect & getNames()
Definition: colormodel.h:52
int getNumberOfElements()
Definition: colormodel.cpp:41
const ColorPair * getColorAt(const int i) const
Definition: colormodel.cpp:53
std::string getElementAt(int i)
Definition: colormodel.cpp:46
Definition: color.h:76
#define RETURNS_NONNULL
Definition: localconsts.h:167
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
std::vector< std::string > StringVect
Definition: stringvector.h:29