ManaPlus
|
#include <shortcutbase.h>
Public Member Functions | |
ShortcutBase (const std::string &itemName, const std::string &colorName, const int maxSize) | |
virtual | ~ShortcutBase () |
void | load () |
void | save () const |
int | getItem (const size_t index) const |
ItemColor | getItemColor (const size_t index) const |
int | getItemCount () const |
int | getItemSelected () const |
void | setItem (const size_t index) |
void | setItems (const size_t index, const int itemId, const ItemColor color) |
void | setItemSelected (const int itemId) |
void | setItemSelected (const Item *const item) |
bool | isItemSelected () const |
void | removeItem (const size_t index) |
void | clear (const bool isSave) |
Private Attributes | |
int * | mItems |
ItemColor * | mItemColors |
std::string | mItemName |
std::string | mColorName |
size_t | mMaxSize |
int | mItemSelected |
ItemColor | mItemColorSelected |
The class which keeps track of the item shortcuts.
Definition at line 39 of file shortcutbase.h.
ShortcutBase::ShortcutBase | ( | const std::string & | itemName, |
const std::string & | colorName, | ||
const int | maxSize | ||
) |
|
virtual |
void ShortcutBase::clear | ( | const bool | isSave | ) |
Definition at line 119 of file shortcutbase.cpp.
References ItemColor_one, mItemColors, mItems, mMaxSize, and save().
Referenced by DropShortcut::DropShortcut(), and ShortcutBase().
|
inline |
Returns the shortcut item ID specified by the index.
index | Index of the shortcut item. |
Definition at line 71 of file shortcutbase.h.
References mItems.
Referenced by VirtShortcutContainer::draw(), DropShortcut::dropFirst(), DropShortcut::dropItem(), VirtShortcutContainer::mouseDragged(), VirtShortcutContainer::mouseMoved(), VirtShortcutContainer::mousePressed(), and VirtShortcutContainer::safeDraw().
|
inline |
Definition at line 74 of file shortcutbase.h.
References mItemColors.
Referenced by VirtShortcutContainer::draw(), DropShortcut::dropFirst(), DropShortcut::dropItem(), VirtShortcutContainer::mouseDragged(), VirtShortcutContainer::mouseMoved(), VirtShortcutContainer::mousePressed(), and VirtShortcutContainer::safeDraw().
|
inline |
Returns the amount of shortcut items.
Definition at line 80 of file shortcutbase.h.
References CAST_S32, and mMaxSize.
Referenced by VirtShortcutContainer::VirtShortcutContainer().
|
inline |
Returns the item ID that is currently selected.
Definition at line 86 of file shortcutbase.h.
References mItemSelected.
|
inline |
A flag to check if the item is selected.
Definition at line 120 of file shortcutbase.h.
References mItemSelected.
Referenced by VirtShortcutContainer::mouseReleased().
void ShortcutBase::load | ( | ) |
Load the configuration information.
Definition at line 54 of file shortcutbase.cpp.
References CAST_S32, fromInt, ConfigurationObject::getValue(), mColorName, mItemColors, mItemName, mItems, mMaxSize, serverConfig, and Catch::toString().
Referenced by DropShortcut::DropShortcut(), and ShortcutBase().
|
inline |
Remove a item from the shortcut.
Definition at line 126 of file shortcutbase.h.
References mItems, and save().
Referenced by VirtShortcutContainer::mouseDragged().
void ShortcutBase::save | ( | ) | const |
Save the configuration information.
Definition at line 74 of file shortcutbase.cpp.
References CAST_S32, ConfigurationObject::deleteKey(), ItemColor_zero, mColorName, mItemColors, mItemName, mItems, mMaxSize, serverConfig, Configuration::setValue(), toInt, and Catch::toString().
Referenced by clear(), removeItem(), setItem(), and setItems().
void ShortcutBase::setItem | ( | const size_t | index | ) |
Adds the selected item ID to the items specified by the index.
index | Index of the items. |
Definition at line 109 of file shortcutbase.cpp.
References mItemColors, mItemColorSelected, mItems, mItemSelected, mMaxSize, and save().
|
inline |
Adds an item to the items store specified by the index.
index | Index of the item. |
itemId | ID of the item. |
Definition at line 102 of file shortcutbase.h.
References mItemColors, mItems, and save().
Referenced by VirtShortcutContainer::mousePressed(), and VirtShortcutContainer::mouseReleased().
|
inline |
Set the item that is selected.
itemId | The ID of the item that is to be assigned. |
Definition at line 112 of file shortcutbase.h.
References mItemSelected.
Referenced by VirtShortcutContainer::mouseReleased().
void ShortcutBase::setItemSelected | ( | const Item *const | item | ) |
Definition at line 95 of file shortcutbase.cpp.
References Item::getColor(), Item::getId(), ItemColor_one, mItemColorSelected, and mItemSelected.
|
private |
Definition at line 135 of file shortcutbase.h.
|
private |
Definition at line 133 of file shortcutbase.h.
Referenced by clear(), getItemColor(), load(), save(), setItem(), setItems(), and ~ShortcutBase().
|
private |
Definition at line 138 of file shortcutbase.h.
Referenced by setItem(), and setItemSelected().
|
private |
Definition at line 134 of file shortcutbase.h.
|
private |
Definition at line 132 of file shortcutbase.h.
Referenced by clear(), getItem(), load(), removeItem(), save(), setItem(), setItems(), and ~ShortcutBase().
|
private |
Definition at line 137 of file shortcutbase.h.
Referenced by getItemSelected(), isItemSelected(), setItem(), and setItemSelected().
|
private |
Definition at line 136 of file shortcutbase.h.
Referenced by clear(), getItemCount(), load(), save(), and setItem().