ManaPlus
keylistmodel.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2007 Joshua Langley <[email protected]>
4  * Copyright (C) 2009 The Mana World Development Team
5  * Copyright (C) 2009-2010 The Mana Developers
6  * Copyright (C) 2011-2019 The ManaPlus Developers
7  * Copyright (C) 2019-2021 Andrei Karas
8  *
9  * This file is part of The ManaPlus Client.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef GUI_MODELS_KEYLISTMODEL_H
26 #define GUI_MODELS_KEYLISTMODEL_H
27 
28 #include "gui/setupactiondata.h"
29 
30 #include "gui/models/listmodel.h"
31 
32 #include "localconsts.h"
33 
34 extern SetupActionData *const setupActionData[];
35 
42 {
43  public:
45  mDataNum(0),
46  mSelectedData(0),
47  mSize(0)
48  {
49  }
50 
52 
53 
57  { return mSize; }
58 
62  std::string getElementAt(int i) override final
63  { return setupActionData[mSelectedData][i].text; }
64 
68  void setElementAt(const int i, const std::string &caption)
69  { setupActionData[mSelectedData][i].text = caption; }
70 
71  void setSize(const int size) noexcept2
72  { mSize = size; }
73 
74  void setDataNum(const int num) noexcept2
75  { mDataNum = num; }
76 
77  void setSelectedData(const int i) noexcept2
78  { mSelectedData = i; }
79 
81  { return mSelectedData; }
82 
83  private:
84  int mDataNum;
86  int mSize;
87 };
88 
89 #endif // GUI_MODELS_KEYLISTMODEL_H
std::string getElementAt(int i)
Definition: keylistmodel.h:62
int getNumberOfElements()
Definition: keylistmodel.h:56
void setSize(const int size)
Definition: keylistmodel.h:71
void setDataNum(const int num)
Definition: keylistmodel.h:74
int getSelectedData() const
Definition: keylistmodel.h:80
void setElementAt(const int i, const std::string &caption)
Definition: keylistmodel.h:68
void setSelectedData(const int i)
Definition: keylistmodel.h:77
SetupActionData *const setupActionData[]
#define override
Definition: localconsts.h:47
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
int size()
Definition: emotedb.cpp:306
std::string text