ManaPlus
|
#include <spellshortcutcontainer.h>
Public Member Functions | |
SpellShortcutContainer (Widget2 *const widget, const unsigned number) | |
~SpellShortcutContainer () | |
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) |
int | getItemByIndex (const int index) const |
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 | |
unsigned int | mNumber |
bool | mSpellClicked |
An item shortcut container. Used to quickly use items.
Definition at line 33 of file spellshortcutcontainer.h.
SpellShortcutContainer::SpellShortcutContainer | ( | Widget2 *const | widget, |
const unsigned | number | ||
) |
Constructor. Initializes the graphic.
Definition at line 43 of file spellshortcutcontainer.cpp.
References SpellShortcut::getSpellsCount(), ShortcutContainer::mMaxItems, and spellShortcut.
SpellShortcutContainer::~SpellShortcutContainer | ( | ) |
|
virtual |
Draws the items.
Implements Widget.
Definition at line 67 of file spellshortcutcontainer.cpp.
References BLOCK_END, BLOCK_START, ShortcutContainer::drawBackground(), Graphics::drawImage(), Graphics::drawRectangle(), Font::drawString(), Widget::getFont(), TextCommand::getImage(), getItemByIndex(), SpellShortcut::getSelectedItem(), SpellManager::getSpell(), TextCommand::getSymbol(), Settings::guiAlpha, TextCommand::isEmpty(), ShortcutContainer::mAlpha, ShortcutContainer::mBackgroundImg, ShortcutContainer::mBoxHeight, ShortcutContainer::mBoxWidth, Widget::mForegroundColor, Widget2::mForegroundColor2, ShortcutContainer::mGridWidth, ShortcutContainer::mImageOffsetX, ShortcutContainer::mImageOffsetY, ShortcutContainer::mMaxItems, ShortcutContainer::mTextOffsetX, ShortcutContainer::mTextOffsetY, Graphics::setColor(), settings, spellManager, and spellShortcut.
int SpellShortcutContainer::getItemByIndex | ( | const int | index | ) | const |
Definition at line 374 of file spellshortcutcontainer.cpp.
References SpellShortcut::getItem(), mNumber, SPELL_SHORTCUT_ITEMS, and spellShortcut.
Referenced by draw(), mouseDragged(), mouseMoved(), mousePressed(), mouseReleased(), and safeDraw().
|
virtual |
Handles mouse when dragged.
Reimplemented from ShortcutContainer.
Definition at line 193 of file spellshortcutcontainer.cpp.
References DragDrop::clear(), DragDrop::dragCommand(), dragDrop, MouseEvent::getButton(), TextCommand::getId(), ShortcutContainer::getIndexFromGrid(), getItemByIndex(), SpellManager::getSpell(), MouseEvent::getX(), MouseEvent::getY(), DragDrop::isEmpty(), MouseButton::LEFT, mSpellClicked, DragDrop::setItem(), SPELL_MIN_ID, spellManager, and DragDropSource::Spells.
|
virtual |
Called when the mouse has exited the widget area.
event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 362 of file spellshortcutcontainer.cpp.
References Widget::setVisible(), 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 334 of file spellshortcutcontainer.cpp.
References ShortcutContainer::getIndexFromGrid(), getItemByIndex(), SpellManager::getSpell(), MouseEvent::getX(), MouseEvent::getY(), TextCommand::isEmpty(), Viewport::mMouseX, Viewport::mMouseY, SpellPopup::setItem(), Widget::setVisible(), spellManager, spellPopup, spellShortcut, SpellPopup::view(), viewport, and Visible_false.
|
virtual |
Handles mouse when pressed.
Reimplemented from ShortcutContainer.
Definition at line 224 of file spellshortcutcontainer.cpp.
References ShortcutContainer::getIndexFromGrid(), getItemByIndex(), MouseEvent::getX(), MouseEvent::getY(), SpellManager::invoke(), MouseButton::LEFT, MouseButton::MIDDLE, mSpellClicked, spellManager, and spellShortcut.
|
virtual |
Handles mouse release.
Reimplemented from ShortcutContainer.
Definition at line 250 of file spellshortcutcontainer.cpp.
References CAST_S32, DragDrop::clear(), DragDrop::deselect(), dragDrop, TextCommand::getId(), ShortcutContainer::getIndexFromGrid(), getItemByIndex(), SpellShortcut::getSelectedItem(), DragDrop::getSource(), SpellManager::getSpell(), ShortcutWindow::getTabIndex(), DragDrop::getTag(), MouseEvent::getX(), MouseEvent::getY(), DragDrop::isEmpty(), TextCommand::isEmpty(), itemShortcut, itemShortcutWindow, MouseButton::LEFT, Viewport::mMouseX, Viewport::mMouseY, mNumber, mSpellClicked, popupMenu, MouseButton::RIGHT, SpellManager::save(), ItemShortcut::setItemSelected(), SpellShortcut::setItemSelected(), SHORTCUT_TABS, PopupMenu::showSpellPopup(), SPELL_MIN_ID, SPELL_SHORTCUT_ITEMS, spellManager, DragDropSource::Spells, spellShortcut, SpellManager::swap(), and viewport.
|
virtual |
Implements Widget.
Definition at line 130 of file spellshortcutcontainer.cpp.
References BLOCK_END, BLOCK_START, Graphics::drawImage(), Graphics::drawRectangle(), Font::drawString(), Widget::getFont(), TextCommand::getImage(), getItemByIndex(), SpellShortcut::getSelectedItem(), SpellManager::getSpell(), TextCommand::getSymbol(), Settings::guiAlpha, TextCommand::isEmpty(), ShortcutContainer::mAlpha, ShortcutContainer::mBackgroundImg, ShortcutContainer::mBoxHeight, ShortcutContainer::mBoxWidth, Widget::mForegroundColor, Widget2::mForegroundColor2, ShortcutContainer::mGridWidth, ShortcutContainer::mImageOffsetX, ShortcutContainer::mImageOffsetY, ShortcutContainer::mMaxItems, ShortcutContainer::mTextOffsetX, ShortcutContainer::mTextOffsetY, ShortcutContainer::safeDrawBackground(), Graphics::setColor(), settings, spellManager, and spellShortcut.
Reimplemented from ShortcutContainer.
Definition at line 59 of file spellshortcutcontainer.cpp.
References Widget2::getThemeColor(), Widget::mForegroundColor, Widget2::mForegroundColor2, 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 368 of file spellshortcutcontainer.cpp.
References Widget::setVisible(), spellPopup, and Visible_false.
|
private |
Definition at line 83 of file spellshortcutcontainer.h.
Referenced by getItemByIndex(), and mouseReleased().
|
private |
Definition at line 84 of file spellshortcutcontainer.h.
Referenced by mouseDragged(), mousePressed(), and mouseReleased().