Mana
Loading...
Searching...
No Matches
itemshortcut.h
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2007-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana 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#pragma once
23
24#define SHORTCUT_ITEMS 12
25
30{
31 public:
33
35
39 void load();
40
46 int getItem(int index) const
47 { return mItems[index]; }
48
52 int getItemCount() const
53 { return SHORTCUT_ITEMS; }
54
58 int getItemSelected() const
59 { return mItemSelected; }
60
66 void setItem(int index)
67 { mItems[index] = mItemSelected; }
68
75 void setItems(int index, int itemId)
76 { mItems[index] = itemId; }
77
83 void setItemSelected(int itemId)
84 { mItemSelected = itemId; }
85
90 { return mItemSelected > -1; }
91
95 void removeItem(int index)
96 { mItems[index] = -1; }
97
103 void useItem(int index);
104
105 private:
109 void save();
110
112 int mItemSelected = -1;
114};
115
The class which keeps track of the item shortcuts.
int getItemCount() const
Returns the amount of shortcut items.
void useItem(int index)
Try to use the item specified by the index.
int getItem(int index) const
Returns the shortcut item ID specified by the index.
void setItems(int index, int itemId)
Adds an item to the items store specified by the index.
void setItem(int index)
Adds the selected item ID to the items specified by the index.
void load()
Load the configuration information.
void removeItem(int index)
Remove a item from the shortcut.
int mItems[SHORTCUT_ITEMS]
The items stored.
int getItemSelected() const
Returns the item ID that is currently selected.
void save()
Save the configuration information.
int mItemSelected
The item held by cursor.
bool isItemSelected()
A flag to check if the item is selected.
void setItemSelected(int itemId)
Set the item that is selected.
#define SHORTCUT_ITEMS
ItemShortcut * itemShortcut