ManaPlus
|
#include <virtshortcutcontainer.h>
Public Member Functions | |
VirtShortcutContainer (Widget2 *const widget, ShortcutBase *const shortcut) | |
~VirtShortcutContainer () | |
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) |
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 | |
bool | mItemClicked |
Color | mEquipedColor |
Color | mEquipedColor2 |
Color | mUnEquipedColor |
Color | mUnEquipedColor2 |
ShortcutBase * | mShortcut |
An item shortcut container. Used to quickly use items.
Definition at line 35 of file virtshortcutcontainer.h.
VirtShortcutContainer::VirtShortcutContainer | ( | Widget2 *const | widget, |
ShortcutBase *const | shortcut | ||
) |
Constructor. Initializes the graphic.
Definition at line 45 of file virtshortcutcontainer.cpp.
References ShortcutBase::getItemCount(), ShortcutContainer::mMaxItems, and mShortcut.
VirtShortcutContainer::~VirtShortcutContainer | ( | ) |
|
virtual |
Draws the items.
Implements Widget.
Definition at line 77 of file virtshortcutcontainer.cpp.
References BLOCK_END, BLOCK_START, ShortcutContainer::drawBackground(), Graphics::drawImage(), Font::drawString(), Equipped_true, Inventory::findItem(), Widget::getFont(), Item::getImage(), PlayerInfo::getInventory(), ShortcutBase::getItem(), ShortcutBase::getItemColor(), Item::getQuantity(), Font::getWidth(), Settings::guiAlpha, Item::isEquipped(), ShortcutContainer::mAlpha, ShortcutContainer::mBackgroundImg, ShortcutContainer::mBoxHeight, ShortcutContainer::mBoxWidth, mEquipedColor, mEquipedColor2, ShortcutContainer::mGridWidth, ShortcutContainer::mImageOffsetX, ShortcutContainer::mImageOffsetY, ShortcutContainer::mMaxItems, mShortcut, mUnEquipedColor, mUnEquipedColor2, settings, and Catch::toString().
|
virtual |
Handles mouse when dragged.
Reimplemented from ShortcutContainer.
Definition at line 234 of file virtshortcutcontainer.cpp.
References DragDrop::clear(), dragDrop, DragDrop::dragItem(), DragDropSource::Drop, Inventory::findItem(), MouseEvent::getButton(), ShortcutContainer::getIndexFromGrid(), PlayerInfo::getInventory(), ShortcutBase::getItem(), ShortcutBase::getItemColor(), MouseEvent::getX(), MouseEvent::getY(), DragDrop::isEmpty(), MouseButton::LEFT, mItemClicked, mShortcut, and ShortcutBase::removeItem().
|
virtual |
Called when the mouse has exited the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 385 of file virtshortcutcontainer.cpp.
References itemPopup, Widget::setVisible(), 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 352 of file virtshortcutcontainer.cpp.
References Inventory::findItem(), ShortcutContainer::getIndexFromGrid(), PlayerInfo::getInventory(), ShortcutBase::getItem(), ShortcutBase::getItemColor(), MouseEvent::getX(), MouseEvent::getY(), itemPopup, Viewport::mMouseX, Viewport::mMouseY, mShortcut, Popup::position(), ItemPopup::setItem(), Widget::setVisible(), viewport, and Visible_false.
|
virtual |
Handles mouse when pressed.
Reimplemented from ShortcutContainer.
Definition at line 273 of file virtshortcutcontainer.cpp.
References DragDrop::deselect(), dragDrop, Inventory::findItem(), ShortcutContainer::getIndexFromGrid(), PlayerInfo::getInventory(), ShortcutBase::getItem(), ShortcutBase::getItemColor(), DragDrop::getSelected(), DragDrop::getSelectedColor(), MouseEvent::getX(), MouseEvent::getY(), inventoryWindow, DragDrop::isSelected(), MouseButton::LEFT, mItemClicked, Viewport::mMouseX, Viewport::mMouseY, mShortcut, popupMenu, MouseButton::RIGHT, ShortcutBase::setItems(), PopupMenu::showDropPopup(), and viewport.
|
virtual |
Handles mouse release.
Reimplemented from ShortcutContainer.
Definition at line 320 of file virtshortcutcontainer.cpp.
References DragDrop::clear(), DragDrop::deselect(), dragDrop, MouseEvent::getButton(), ShortcutContainer::getIndexFromGrid(), DragDrop::getItem(), DragDrop::getItemColor(), MouseEvent::getX(), MouseEvent::getY(), DragDrop::isEmpty(), ShortcutBase::isItemSelected(), DragDrop::isSourceItemContainer(), MouseButton::LEFT, mItemClicked, mShortcut, ShortcutBase::setItems(), and ShortcutBase::setItemSelected().
|
virtual |
Implements Widget.
Definition at line 154 of file virtshortcutcontainer.cpp.
References BLOCK_END, BLOCK_START, Graphics::drawImage(), Font::drawString(), Equipped_true, Inventory::findItem(), Widget::getFont(), Item::getImage(), PlayerInfo::getInventory(), ShortcutBase::getItem(), ShortcutBase::getItemColor(), Item::getQuantity(), Font::getWidth(), Settings::guiAlpha, Item::isEquipped(), ShortcutContainer::mAlpha, ShortcutContainer::mBackgroundImg, ShortcutContainer::mBoxHeight, ShortcutContainer::mBoxWidth, mEquipedColor, mEquipedColor2, ShortcutContainer::mGridWidth, ShortcutContainer::mImageOffsetX, ShortcutContainer::mImageOffsetY, ShortcutContainer::mMaxItems, mShortcut, mUnEquipedColor, mUnEquipedColor2, ShortcutContainer::safeDrawBackground(), settings, and Catch::toString().
Reimplemented from ShortcutContainer.
Definition at line 66 of file virtshortcutcontainer.cpp.
References Widget2::getThemeColor(), mEquipedColor, mEquipedColor2, mUnEquipedColor, mUnEquipedColor2, and ShortcutContainer::setSkin().
|
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 391 of file virtshortcutcontainer.cpp.
References itemPopup, Widget::setVisible(), and Visible_false.
|
private |
Definition at line 85 of file virtshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 86 of file virtshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 83 of file virtshortcutcontainer.h.
Referenced by mouseDragged(), mousePressed(), and mouseReleased().
|
private |
Definition at line 90 of file virtshortcutcontainer.h.
Referenced by draw(), mouseDragged(), mouseMoved(), mousePressed(), mouseReleased(), safeDraw(), and VirtShortcutContainer().
|
private |
Definition at line 87 of file virtshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().
|
private |
Definition at line 88 of file virtshortcutcontainer.h.
Referenced by draw(), safeDraw(), and setSkin().