ManaPlus
|
#include <itemshortcutcontainer.h>
Public Member Functions | |
ItemShortcutContainer (Widget2 *const widget, const unsigned number) | |
~ItemShortcutContainer () | |
void | draw (Graphics *const graphics) |
void | safeDraw (Graphics *const graphics) |
void | mouseDragged (MouseEvent &event) |
void | mousePressed (MouseEvent &event) |
void | mouseReleased (MouseEvent &event) |
void | widgetHidden (const Event &event) |
void | mouseExited (MouseEvent &event) |
void | mouseMoved (MouseEvent &event) |
void | setSkin (const Widget2 *const widget, Skin *const skin) |
Public Member Functions inherited from ShortcutContainer | |
~ShortcutContainer () | |
void | widgetResized (const Event &event) |
void | widgetMoved (const Event &event) |
void | mouseDragged (MouseEvent &event) |
void | mousePressed (MouseEvent &event) |
void | mouseReleased (MouseEvent &event) |
int | getMaxItems () const |
int | getBoxWidth () const |
int | getBoxHeight () const |
void | drawBackground (Graphics *const g) |
void | safeDrawBackground (Graphics *const g) |
Public Member Functions inherited from Widget | |
Widget (const Widget2 *const widget) | |
~Widget () | |
virtual void | drawFrame (Graphics *graphics) |
virtual void | safeDrawFrame (Graphics *graphics) |
void | setFrameSize (const unsigned int frameSize) |
unsigned int | getFrameSize () const |
virtual void | logic () |
Widget * | getParent () const |
void | setWidth (const int width) |
int | getWidth () const |
void | setHeight (const int height) |
int | getHeight () const |
void | setSize (const int width, const int height) |
void | setX (const int x) |
int | getX () const |
void | setY (const int y) |
int | getY () const |
void | setPosition (const int x, const int y) |
void | setDimension (const Rect &dimension) |
const Rect & | getDimension () const |
void | setFocusable (const bool focusable) |
bool | isFocusable () const |
virtual bool | isFocused () const |
void | setEnabled (const bool enabled) |
bool | isEnabled () const |
void | setVisible (Visible visible) |
bool | isVisible () const |
void | setBaseColor (const Color &color) |
const Color & | getBaseColor () const |
void | setForegroundColor (const Color &color) |
const Color & | getForegroundColor () const |
void | setBackgroundColor (const Color &color) |
const Color & | getBackgroundColor () const |
virtual void | requestFocus () |
virtual void | requestMoveToTop () |
virtual void | requestMoveToBottom () |
virtual void | setFocusHandler (FocusHandler *const focusHandler) |
FocusHandler * | getFocusHandler () |
void | addActionListener (ActionListener *const actionListener) |
void | removeActionListener (ActionListener *const actionListener) |
void | addDeathListener (WidgetDeathListener *const deathListener) |
void | removeDeathListener (WidgetDeathListener *const deathListener) |
void | addMouseListener (MouseListener *const mouseListener) |
void | removeMouseListener (MouseListener *const mouseListener) |
void | addKeyListener (KeyListener *const keyListener) |
void | removeKeyListener (KeyListener *const keyListener) |
void | addFocusListener (FocusListener *const focusListener) |
void | removeFocusListener (FocusListener *const focusListener) |
void | addWidgetListener (WidgetListener *const widgetListener) |
void | removeWidgetListener (WidgetListener *const widgetListener) |
void | setActionEventId (const std::string &actionEventId) |
const std::string & | getActionEventId () const |
virtual void | getAbsolutePosition (int &x, int &y) const |
virtual void | setParent (Widget *parent) |
Font * | getFont () const |
void | setFont (Font *const font) |
virtual void | fontChanged () |
bool | isTabInEnabled () const |
void | setTabInEnabled (const bool enabled) |
bool | isTabOutEnabled () const |
void | setTabOutEnabled (const bool enabled) |
void | requestModalFocus () |
virtual void | requestModalMouseInputFocus () |
virtual void | releaseModalFocus () |
virtual void | releaseModalMouseInputFocus () |
virtual bool | isModalFocused () const |
virtual bool | isModalMouseInputFocused () const |
virtual Widget * | getWidgetAt (int x, int y) |
const std::list< MouseListener * > & | getMouseListeners () const A_CONST |
const std::list< KeyListener * > & | getKeyListeners () const A_CONST |
const std::list< FocusListener * > & | getFocusListeners () const A_CONST |
virtual Rect | getChildrenArea () |
virtual FocusHandler * | getInternalFocusHandler () |
void | setInternalFocusHandler (FocusHandler *const internalFocusHandler) |
virtual void | moveToTop (Widget *widget) |
virtual void | moveToBottom (Widget *widget) |
virtual void | focusNext () |
virtual void | focusPrevious () |
virtual void | showWidgetPart (Widget *const widget, const Rect &area) |
void | setId (const std::string &id) |
const std::string & | getId () const |
virtual void | showPart (const Rect &rectangle) |
bool | isAllowLogic () const |
void | setMouseConsume (const bool b) |
bool | isMouseConsume () const |
void | setRedraw (const bool b) |
virtual bool | isSelectable () const |
void | setSelectable (const bool selectable) |
void | windowResized () |
virtual void | postInit () |
Public Member Functions inherited from Widget2 | |
virtual | ~Widget2 () |
const Color & | getThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE |
const Color & | getThemeCharColor (const signed char c, bool &valid) const A_INLINE |
virtual void | setWidget2 (const Widget2 *const widget) |
void | setPalette (int palette) |
void | checkPalette () |
void | setForegroundColor2 (const Color &color) |
Widget * | getWindow () const |
virtual void | setWindow (Widget *const window) |
Public Member Functions inherited from WidgetListener | |
virtual | ~WidgetListener () |
virtual void | widgetShown (const Event &event) |
Public Member Functions inherited from MouseListener | |
virtual | ~MouseListener () |
virtual void | mouseEntered (MouseEvent &event) |
virtual void | mouseClicked (MouseEvent &event) |
virtual void | mouseWheelMovedUp (MouseEvent &event) |
virtual void | mouseWheelMovedDown (MouseEvent &event) |
Private Attributes | |
Color | mEquipedColor |
Color | mEquipedColor2 |
Color | mUnEquipedColor |
Color | mUnEquipedColor2 |
unsigned | mNumber |
int | mKeyOffsetX |
int | mKeyOffsetY |
bool | mItemClicked |
An item shortcut container. Used to quickly use items.
Definition at line 34 of file itemshortcutcontainer.h.
ItemShortcutContainer::ItemShortcutContainer | ( | Widget2 *const | widget, |
const unsigned | number | ||
) |
Constructor. Initializes the graphic.
Definition at line 58 of file itemshortcutcontainer.cpp.
References ItemShortcut::getItemCount(), and ShortcutContainer::mMaxItems.
ItemShortcutContainer::~ItemShortcutContainer | ( | ) |
|
virtual |
Draws the items.
Implements Widget.
Definition at line 96 of file itemshortcutcontainer.cpp.
References BLOCK_END, BLOCK_START, ShortcutContainer::drawBackground(), Graphics::drawImage(), Font::drawString(), Equipped_true, Inventory::findItem(), Widget::getFont(), Item::getImage(), TextCommand::getImage(), PlayerInfo::getInventory(), ItemShortcut::getItem(), ItemShortcut::getItemColor(), InputManager::getKeyValueString(), Item::getQuantity(), SkillDialog::getSkill(), SpellManager::getSpellByItem(), TextCommand::getSymbol(), Font::getWidth(), Settings::guiAlpha, inputManager, TextCommand::isEmpty(), Item::isEquipped(), itemShortcut, ShortcutContainer::mAlpha, ShortcutContainer::mBackgroundImg, ShortcutContainer::mBoxHeight, ShortcutContainer::mBoxWidth, mEquipedColor, mEquipedColor2, Widget::mForegroundColor, ShortcutContainer::mGridWidth, ShortcutContainer::mImageOffsetX, ShortcutContainer::mImageOffsetY, mKeyOffsetX, mKeyOffsetY, ShortcutContainer::mMaxItems, mNumber, ShortcutContainer::mTextOffsetX, ShortcutContainer::mTextOffsetY, mUnEquipedColor, mUnEquipedColor2, settings, InputAction::SHORTCUT_1, Actions::skill(), SKILL_MIN_ID, skillDialog, SPELL_MIN_ID, spellManager, and Catch::toString().
|
virtual |
Handles mouse when dragged.
Reimplemented from MouseListener.
Definition at line 390 of file itemshortcutcontainer.cpp.
References DragDrop::clear(), DragDrop::dragCommand(), dragDrop, DragDrop::dragItem(), DragDrop::dragSkill(), Inventory::findItem(), MouseEvent::getButton(), ShortcutContainer::getIndexFromGrid(), PlayerInfo::getInventory(), ItemShortcut::getItem(), ItemShortcut::getItemColor(), ItemShortcut::getItemData(), SkillDialog::getSkillByItem(), SpellManager::getSpellByItem(), MouseEvent::getX(), MouseEvent::getY(), DragDrop::isEmpty(), itemShortcut, MouseButton::LEFT, mItemClicked, mNumber, ItemShortcut::removeItem(), DragDrop::setItem(), DragDrop::setItemColor(), DragDrop::setItemData(), SHORTCUT_AUTO_TAB, DragDropSource::Shortcuts, Actions::skill(), SKILL_MIN_ID, skillDialog, SPELL_MIN_ID, and spellManager.
|
virtual |
Called when the mouse has exited the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 662 of file itemshortcutcontainer.cpp.
References itemPopup, Widget::setVisible(), skillPopup, spellPopup, and Visible_false.
|
virtual |
Called when the mouse has moved in the widget area and no mouse button has been pressed (i.e no widget is being dragged).
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 573 of file itemshortcutcontainer.cpp.
References data, CastType::Default, Inventory::findItem(), ShortcutContainer::getIndexFromGrid(), PlayerInfo::getInventory(), ItemShortcut::getItem(), ItemShortcut::getItemColor(), ItemShortcut::getItemData(), SkillDialog::getSkillByItem(), SpellManager::getSpellByItem(), MouseEvent::getX(), MouseEvent::getY(), itemPopup, itemShortcut, Viewport::mMouseX, Viewport::mMouseY, mNumber, Popup::position(), ItemPopup::setItem(), SpellPopup::setItem(), Widget::setVisible(), SkillPopup::show(), Actions::skill(), SKILL_MIN_ID, skillDialog, skillPopup, SPELL_MIN_ID, spellManager, spellPopup, splitToIntVector(), toInt, SpellPopup::view(), viewport, and Visible_false.
|
virtual |
Handles mouse when pressed.
Reimplemented from MouseListener.
Definition at line 485 of file itemshortcutcontainer.cpp.
References MouseEvent::getButton(), ShortcutContainer::getIndexFromGrid(), ItemShortcut::getItem(), ItemShortcut::getItemColor(), ItemShortcut::getSelectedItem(), MouseEvent::getX(), MouseEvent::getY(), inventoryWindow, ItemShortcut::isItemSelected(), Window::isWindowVisible(), itemShortcut, MouseButton::LEFT, mItemClicked, Viewport::mMouseX, Viewport::mMouseY, mNumber, popupMenu, MouseButton::RIGHT, ItemShortcut::setItem(), ItemShortcut::setItemSelected(), SpellShortcut::setItemSelected(), PopupMenu::showItemPopup(), SPELL_MIN_ID, spellShortcut, InventoryWindow::unselectItem(), and viewport.
|
virtual |
Handles mouse release.
Reimplemented from MouseListener.
Definition at line 529 of file itemshortcutcontainer.cpp.
References DragDrop::clear(), DragDrop::deselect(), dragDrop, MouseEvent::getButton(), ShortcutContainer::getIndexFromGrid(), DragDrop::getItem(), ItemShortcut::getItem(), DragDrop::getItemColor(), DragDrop::getItemData(), DragDrop::getSource(), DragDrop::getTag(), MouseEvent::getX(), MouseEvent::getY(), DragDrop::isEmpty(), ItemShortcut::isItemSelected(), itemShortcut, MouseButton::LEFT, mItemClicked, mNumber, ItemShortcut::setItem(), ItemShortcut::setItemData(), ItemShortcut::setItemSelected(), DragDropSource::Shortcuts, ItemShortcut::swap(), and ItemShortcut::useItem().
|
virtual |
Implements Widget.
Definition at line 243 of file itemshortcutcontainer.cpp.
References BLOCK_END, BLOCK_START, Graphics::drawImage(), Font::drawString(), Equipped_true, Inventory::findItem(), Widget::getFont(), Item::getImage(), TextCommand::getImage(), PlayerInfo::getInventory(), ItemShortcut::getItem(), ItemShortcut::getItemColor(), InputManager::getKeyValueString(), Item::getQuantity(), SkillDialog::getSkill(), SpellManager::getSpellByItem(), TextCommand::getSymbol(), Font::getWidth(), Settings::guiAlpha, inputManager, TextCommand::isEmpty(), Item::isEquipped(), itemShortcut, ShortcutContainer::mAlpha, ShortcutContainer::mBackgroundImg, ShortcutContainer::mBoxHeight, ShortcutContainer::mBoxWidth, mEquipedColor, mEquipedColor2, Widget::mForegroundColor, ShortcutContainer::mGridWidth, ShortcutContainer::mImageOffsetX, ShortcutContainer::mImageOffsetY, mKeyOffsetX, mKeyOffsetY, ShortcutContainer::mMaxItems, mNumber, ShortcutContainer::mTextOffsetX, ShortcutContainer::mTextOffsetY, mUnEquipedColor, mUnEquipedColor2, ShortcutContainer::safeDrawBackground(), settings, InputAction::SHORTCUT_1, Actions::skill(), SKILL_MIN_ID, skillDialog, SPELL_MIN_ID, spellManager, and Catch::toString().
Reimplemented from ShortcutContainer.
Definition at line 78 of file itemshortcutcontainer.cpp.
References Skin::getOption(), Widget2::getThemeColor(), mEquipedColor, mEquipedColor2, Widget::mForegroundColor, Widget2::mForegroundColor2, mKeyOffsetX, mKeyOffsetY, ShortcutContainer::mSkin, mUnEquipedColor, mUnEquipedColor2, ShortcutContainer::setSkin(), and QuestType::TEXT.
|
virtual |
Invoked when a widget is hidden, i.e it's set to be not visible.
event | Describes the event. |
Reimplemented from WidgetListener.
Definition at line 672 of file itemshortcutcontainer.cpp.
References itemPopup, Widget::setVisible(), spellPopup, and Visible_false.
|
private |
Definition at line 82 of file itemshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 83 of file itemshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 89 of file itemshortcutcontainer.h.
Referenced by mouseDragged(), mousePressed(), and mouseReleased().
|
private |
Definition at line 87 of file itemshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 88 of file itemshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 86 of file itemshortcutcontainer.h.
Referenced by draw(), mouseDragged(), mouseMoved(), mousePressed(), mouseReleased(), and safeDraw().
|
private |
Definition at line 84 of file itemshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 85 of file itemshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().