![]() |
ManaPlus
|
#include <shoplistbox.h>
Public Member Functions | |
| ShopListBox (const Widget2 *const widget, ListModel *const listModel, const ShopListBoxTypeT type) | |
| ShopListBox (const Widget2 *const widget, ListModel *const listModel, ShopItems *const shopListModel, const ShopListBoxTypeT type) | |
| void | draw (Graphics *const graphics) |
| void | safeDraw (Graphics *const graphics) |
| void | setPlayersMoney (const int money) |
| void | adjustSize () |
| void | setPriceCheck (const bool check) |
| void | mouseMoved (MouseEvent &event) |
| void | mouseReleased (MouseEvent &event) |
| void | mouseExited (MouseEvent &event) |
| void | setProtectItems (bool p) |
| void | setType (const ShopListBoxTypeT type) |
| ShopListBoxTypeT | getType () const |
Public Member Functions inherited from ListBox | |
| ListBox (const Widget2 *const widget, ListModel *const listModel, const std::string &skin) | |
| ~ListBox () | |
| void | postInit () |
| void | updateAlpha () |
| void | keyPressed (KeyEvent &event) |
| void | mouseWheelMovedUp (MouseEvent &event) |
| void | mouseWheelMovedDown (MouseEvent &event) |
| void | mousePressed (MouseEvent &event) |
| void | mouseReleased1 (const MouseEvent &event) |
| void | mouseDragged (MouseEvent &event) |
| void | refocus () |
| void | setDistributeMousePressed (const bool b) |
| void | logic () |
| virtual int | getSelectionByMouse (const int y) const |
| void | setCenter (const bool b) |
| int | getPressedIndex () const |
| virtual unsigned int | getRowHeight () const |
| void | setRowHeight (unsigned int n) |
| int | getSelected () const |
| void | setSelected (const int selected) |
| void | setListModel (ListModel *listModel) |
| ListModel * | getListModel () const |
| bool | isWrappingEnabled () const |
| void | setWrappingEnabled (const bool wrappingEnabled) |
| void | addSelectionListener (SelectionListener *const selectionListener) |
| void | removeSelectionListener (SelectionListener *const selectionListener) |
| void | distributeValueChangedEvent () |
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 |
| 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 () |
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 MouseListener | |
| virtual | ~MouseListener () |
| virtual void | mouseEntered (MouseEvent &event) |
| virtual void | mouseClicked (MouseEvent &event) |
Public Member Functions inherited from KeyListener | |
| virtual | ~KeyListener () |
| virtual void | keyReleased (KeyEvent &event) |
Private Attributes | |
| int | mPlayerMoney |
| ShopItems * | mShopItems |
| Color | mWarningColor |
| ShopListBoxTypeT | mType |
| bool | mPriceCheck |
| bool | mProtectItems |
A list box, meant to be used inside a scroll area. Same as the Guichan list box except this one doesn't have a background, instead completely relying on the scroll area. It also adds selection listener functionality.
Definition at line 40 of file shoplistbox.h.
| ShopListBox::ShopListBox | ( | const Widget2 *const | widget, |
| ListModel *const | listModel, | ||
| const ShopListBoxTypeT | type | ||
| ) |
Constructor.
Definition at line 52 of file shoplistbox.cpp.
References LinkHighlightMode::BACKGROUND, Widget::getFont(), Font::getHeight(), Widget2::getThemeColor(), Widget::mBackgroundColor, Widget::mForegroundColor, ListBox::mHighlightColor, and ListBox::mRowHeight.
| ShopListBox::ShopListBox | ( | const Widget2 *const | widget, |
| ListModel *const | listModel, | ||
| ShopItems *const | shopListModel, | ||
| const ShopListBoxTypeT | type | ||
| ) |
Constructor with shopitems
Definition at line 69 of file shoplistbox.cpp.
References LinkHighlightMode::BACKGROUND, Widget::getFont(), Widget::getHeight(), Widget2::getThemeColor(), ITEM_ICON_SIZE, Widget::mBackgroundColor, Widget::mForegroundColor, ListBox::mHighlightColor, and ListBox::mRowHeight.
|
virtual |
Adjust List draw size
Reimplemented from ListBox.
Definition at line 195 of file shoplistbox.cpp.
References BLOCK_END, BLOCK_START, ListModel::getNumberOfElements(), ListBox::mListModel, ListBox::mPadding, ListBox::mRowHeight, and Widget::setHeight().
Referenced by BuyDialog::addItem(), SellDialog::addItem(), and BuyDialog::reset().
|
virtual |
Draws the list box.
Reimplemented from ListBox.
Definition at line 92 of file shoplistbox.cpp.
References Color::a, ShopItems::at(), Color::b, BLOCK_END, BLOCK_START, CAST_U32, Graphics::drawImage(), Font::drawString(), Graphics::fillRectangle(), Color::g, ShopItem::getDisabled(), ListModel::getElementAt(), Widget::getFont(), Font::getHeight(), Item::getId(), Item::getImage(), ListModel::getNumberOfElements(), Settings::guiAlpha, PlayerInfo::isItemProtected(), ITEM_ICON_SIZE, ListBox::mAlpha, Widget::mBackgroundColor, Widget::mDimension, Widget::mForegroundColor, Widget2::mForegroundColor2, ListBox::mForegroundSelectedColor, ListBox::mForegroundSelectedColor2, ListBox::mHighlightColor, ListBox::mListModel, ListBox::mPadding, mPriceCheck, mProtectItems, ListBox::mRowHeight, ListBox::mSelected, mShopItems, mWarningColor, Color::r, Graphics::setColor(), settings, Rect::width, and y.
Referenced by safeDraw().
|
inline |
|
virtual |
Called when the mouse has exited the widget area.
| event | Describes the event. |
Reimplemented from MouseListener.
Definition at line 309 of file shoplistbox.cpp.
References Popup::hide(), and itemPopup.
|
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 211 of file shoplistbox.cpp.
References ShopItems::at(), ShopItems::getNumberOfElements(), Popup::hide(), itemPopup, Viewport::mMouseX, Viewport::mMouseY, ListBox::mPadding, ListBox::mRowHeight, mShopItems, Popup::position(), ItemPopup::setItem(), Widget::setVisible(), viewport, and Visible_false.
|
virtual |
Called when a mouse button has been released on the widget area.
| event | Describes the event. |
Reimplemented from ListBox.
Definition at line 243 of file shoplistbox.cpp.
References ShopItems::at(), ShopListBoxType::BuyShop, DragDropSource::Cart, dragDrop, MouseEvent::getButton(), PlayerInfo::getCartInventory(), PlayerInfo::getInventory(), Inventory::getItem(), Net::getNetworkType(), ShopItems::getNumberOfElements(), ListBox::getSelectionByMouse(), DragDrop::getSource(), DragDrop::getTag(), MouseEvent::getType(), MouseEvent::getY(), DragDropSource::Inventory, DragDrop::isEmpty(), Viewport::mMouseX, Viewport::mMouseY, ListBox::mouseReleased(), ListBox::mSelected, mShopItems, mType, popupMenu, MouseEventType::RELEASED2, MouseButton::RIGHT, ShopListBoxType::SellShop, ListBox::setSelected(), ItemAmountWindowUsage::ShopBuyAdd, ItemAmountWindowUsage::ShopSellAdd, PopupMenu::showItemPopup(), ItemAmountWindow::showWindow(), ServerType::TMWATHENA, and viewport.
|
virtual |
| void ShopListBox::setPlayersMoney | ( | const int | money | ) |
gives information about the current player's money
Definition at line 87 of file shoplistbox.cpp.
References mPlayerMoney.
Referenced by SellDialog::setMoney(), and BuyDialog::setMoney().
| void ShopListBox::setPriceCheck | ( | const bool | check | ) |
Set on/off the disabling of too expensive items. (Good for selling mode.)
Definition at line 206 of file shoplistbox.cpp.
References mPriceCheck.
Referenced by SellDialog::postInit(), and ShopWindow::ShopWindow().
|
inline |
Definition at line 89 of file shoplistbox.h.
References mProtectItems.
Referenced by SellDialog::postInit().
|
inline |
|
private |
Definition at line 99 of file shoplistbox.h.
Referenced by setPlayersMoney().
|
private |
Definition at line 110 of file shoplistbox.h.
Referenced by draw(), and setPriceCheck().
|
private |
Definition at line 111 of file shoplistbox.h.
Referenced by draw(), and setProtectItems().
|
private |
Keeps another pointer to the same listModel, permitting to use the ShopItems specific functions.
Definition at line 105 of file shoplistbox.h.
Referenced by draw(), mouseMoved(), and mouseReleased().
|
private |
Definition at line 108 of file shoplistbox.h.
Referenced by getType(), mouseReleased(), and setType().
|
private |
Definition at line 107 of file shoplistbox.h.
Referenced by draw().