ManaPlus
Public Member Functions | Private Attributes
ShopListBox Class Reference

#include <shoplistbox.h>

Inheritance diagram for ShopListBox:
ListBox Widget MouseListener KeyListener Widget2

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)
 
ListModelgetListModel () 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
 
WidgetgetParent () 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 RectgetDimension () 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 ColorgetBaseColor () const
 
void setForegroundColor (const Color &color)
 
const ColorgetForegroundColor () const
 
void setBackgroundColor (const Color &color)
 
const ColorgetBackgroundColor () const
 
virtual void requestFocus ()
 
virtual void requestMoveToTop ()
 
virtual void requestMoveToBottom ()
 
virtual void setFocusHandler (FocusHandler *const focusHandler)
 
FocusHandlergetFocusHandler ()
 
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)
 
FontgetFont () 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 WidgetgetWidgetAt (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 FocusHandlergetInternalFocusHandler ()
 
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 ColorgetThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
 
const ColorgetThemeCharColor (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)
 
WidgetgetWindow () 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
 
ShopItemsmShopItems
 
Color mWarningColor
 
ShopListBoxTypeT mType
 
bool mPriceCheck
 
bool mProtectItems
 

Additional Inherited Members

- Static Public Member Functions inherited from Widget
static void setGlobalFont (Font *const font)
 
static FontgetGloablFont ()
 
static void cleanGlobalFont ()
 
static bool widgetExists (const Widget *const widget)
 
static void distributeWindowResizeEvent ()
 
static WidgetcallPostInit (Widget *const widget)
 
- Data Fields inherited from Widget
Visible mVisible
 
- Protected Types inherited from ListBox
typedef std::list< SelectionListener * > SelectionListenerList
 
typedef SelectionListenerList::iterator SelectionListenerIterator
 
- Protected Types inherited from Widget
typedef std::list< MouseListener * > MouseListenerList
 
typedef MouseListenerList::iterator MouseListenerIterator
 
typedef std::list< KeyListener * > KeyListenerList
 
typedef KeyListenerList::iterator KeyListenerIterator
 
typedef std::list< ActionListener * > ActionListenerList
 
typedef ActionListenerList::iterator ActionListenerIterator
 
typedef std::list< WidgetDeathListener * > WidgetDeathListenerList
 
typedef WidgetDeathListenerList::iterator WidgetDeathListenerIterator
 
typedef std::list< FocusListener * > FocusListenerList
 
typedef FocusListenerList::iterator FocusListenerIterator
 
typedef std::list< WidgetListener * > WidgetListenerList
 
typedef WidgetListenerList::iterator WidgetListenerIterator
 
- Protected Member Functions inherited from Widget
void distributeActionEvent ()
 
void distributeResizedEvent ()
 
void distributeMovedEvent ()
 
void distributeHiddenEvent ()
 
void distributeShownEvent ()
 
- Protected Member Functions inherited from Widget2
 Widget2 (const Widget2 *const widget)
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from KeyListener
 KeyListener ()
 
- Protected Attributes inherited from ListBox
int mSelected
 
ListModelmListModel
 
bool mWrappingEnabled
 
SelectionListenerList mSelectionListeners
 
Color mHighlightColor
 
Color mForegroundSelectedColor
 
Color mForegroundSelectedColor2
 
int mOldSelected
 
int mPadding
 
int mPressedIndex
 
unsigned int mRowHeight
 
int mItemPadding
 
SkinmSkin
 
bool mDistributeMousePressed
 
bool mCenterText
 
- Protected Attributes inherited from Widget
MouseListenerList mMouseListeners
 
KeyListenerList mKeyListeners
 
ActionListenerList mActionListeners
 
WidgetDeathListenerList mDeathListeners
 
FocusListenerList mFocusListeners
 
WidgetListenerList mWidgetListeners
 
Color mForegroundColor
 
Color mBackgroundColor
 
Color mBaseColor
 
Rect mDimension
 
std::string mActionEventId
 
std::string mId
 
FocusHandlermFocusHandler
 
FocusHandlermInternalFocusHandler
 
WidgetmParent
 
FontmCurrentFont
 
unsigned int mFrameSize
 
bool mFocusable
 
bool mTabIn
 
bool mTabOut
 
bool mEnabled
 
bool mAllowLogic
 
bool mMouseConsume
 
bool mRedraw
 
bool mSelectable
 
- Protected Attributes inherited from Widget2
int mPaletteOffset
 
WidgetmWindow
 
Color mForegroundColor2
 
- Static Protected Attributes inherited from ListBox
static float mAlpha = 1.0
 
- Static Protected Attributes inherited from Widget
static FontmGlobalFont = 0
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ShopListBox() [1/2]

ShopListBox::ShopListBox ( const Widget2 *const  widget,
ListModel *const  listModel,
const ShopListBoxTypeT  type 
)

Constructor.

Definition at line 52 of file shoplistbox.cpp.

54  :
55  ListBox(widget, listModel, "shoplistbox.xml"),
56  mPlayerMoney(0),
57  mShopItems(nullptr),
58  mWarningColor(getThemeColor(ThemeColorId::SHOP_WARNING, 255U)),
59  mType(type),
60  mPriceCheck(true),
61  mProtectItems(false)
62 {
64  mHighlightColor = getThemeColor(ThemeColorId::HIGHLIGHT, 255U);
65  mForegroundColor = getThemeColor(ThemeColorId::LISTBOX, 255U);
67 }
int getHeight() const
Definition: font.cpp:362
ListBox(const Widget2 *const widget, ListModel *const listModel, const std::string &skin)
Definition: listbox.cpp:89
Color mHighlightColor
Definition: listbox.h:283
unsigned int mRowHeight
Definition: listbox.h:289
bool mPriceCheck
Definition: shoplistbox.h:110
Color mWarningColor
Definition: shoplistbox.h:107
ShopListBoxTypeT mType
Definition: shoplistbox.h:108
ShopItems * mShopItems
Definition: shoplistbox.h:105
int mPlayerMoney
Definition: shoplistbox.h:99
bool mProtectItems
Definition: shoplistbox.h:111
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:45
Color mForegroundColor
Definition: widget.h:1086
Color mBackgroundColor
Definition: widget.h:1091
Font * getFont() const
Definition: widget.cpp:331

References LinkHighlightMode::BACKGROUND, Widget::getFont(), Font::getHeight(), Widget2::getThemeColor(), Widget::mBackgroundColor, Widget::mForegroundColor, ListBox::mHighlightColor, and ListBox::mRowHeight.

◆ ShopListBox() [2/2]

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.

72  :
73  ListBox(widget, listModel, "shoplistbox.xml"),
74  mPlayerMoney(0),
75  mShopItems(shopListModel),
76  mWarningColor(getThemeColor(ThemeColorId::SHOP_WARNING, 255U)),
77  mType(type),
78  mPriceCheck(true),
79  mProtectItems(false)
80 {
81  mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE);
82  mHighlightColor = getThemeColor(ThemeColorId::HIGHLIGHT, 255U);
83  mForegroundColor = getThemeColor(ThemeColorId::LISTBOX, 255U);
85 }
int getHeight() const
Definition: widget.h:240
const int ITEM_ICON_SIZE
Definition: shoplistbox.cpp:50

References LinkHighlightMode::BACKGROUND, Widget::getFont(), Widget::getHeight(), Widget2::getThemeColor(), ITEM_ICON_SIZE, Widget::mBackgroundColor, Widget::mForegroundColor, ListBox::mHighlightColor, and ListBox::mRowHeight.

Member Function Documentation

◆ adjustSize()

void ShopListBox::adjustSize ( )
virtual

Adjust List draw size

Reimplemented from ListBox.

Definition at line 195 of file shoplistbox.cpp.

196 {
197  BLOCK_START("ShopListBox::adjustSize")
198  if (mListModel != nullptr)
199  {
201  + 2 * mPadding);
202  }
203  BLOCK_END("ShopListBox::adjustSize")
204 }
ListModel * mListModel
Definition: listbox.h:261
int mPadding
Definition: listbox.h:287
virtual int getNumberOfElements()=0
void setHeight(const int height)
Definition: widget.cpp:140
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79

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().

◆ draw()

void ShopListBox::draw ( Graphics *const  graphics)
virtual

Draws the list box.

Reimplemented from ListBox.

Definition at line 92 of file shoplistbox.cpp.

93 {
94  BLOCK_START("ShopListBox::draw")
95  if ((mListModel == nullptr) || (mShopItems == nullptr))
96  {
97  BLOCK_END("ShopListBox::draw")
98  return;
99  }
100 
101  if (settings.guiAlpha != mAlpha)
102  mAlpha = settings.guiAlpha;
103 
104  const unsigned int alpha = CAST_U32(mAlpha * 255.0F);
105  Font *const font = getFont();
106 
107  const int sz = mListModel->getNumberOfElements();
108  const int fontHeigh = getFont()->getHeight();
109  const int width = mDimension.width - 2 * mPadding;
110  // Draw the list elements
111  for (int i = 0, y = 0;
112  i < sz;
113  ++i, y += mRowHeight)
114  {
115  bool needDraw(false);
116  Color temp;
117  Color* backgroundColor = &mBackgroundColor;
118 
119  ShopItem *const item = mShopItems->at(i);
120  if ((item != nullptr) &&
121  (item->getDisabled() ||
122  (mPlayerMoney < item->getPrice() && mPriceCheck) ||
124  {
125  if (i != mSelected)
126  {
127  backgroundColor = &mWarningColor;
128  backgroundColor->a = alpha;
129  }
130  else
131  {
132  temp = mWarningColor;
133  temp.r = (temp.r + mHighlightColor.r) / 2;
134  temp.g = (temp.g + mHighlightColor.g) / 2;
135  temp.b = (temp.b + mHighlightColor.b) / 2;
136  temp.a = alpha;
137  backgroundColor = &temp;
138  }
139  needDraw = true;
140  }
141  else if (i == mSelected)
142  {
143  mHighlightColor.a = alpha;
144  backgroundColor = &mHighlightColor;
145  needDraw = true;
146  }
147  else
148  {
149  mBackgroundColor.a = alpha;
150  }
151 
152  if (needDraw)
153  {
154  graphics->setColor(*backgroundColor);
155  graphics->fillRectangle(Rect(mPadding, y + mPadding,
156  width, mRowHeight));
157  }
158 
159  if ((mShopItems != nullptr) && (item != nullptr))
160  {
161  Image *const icon = item->getImage();
162  if (icon != nullptr)
163  {
164  icon->setAlpha(1.0F);
165  graphics->drawImage(icon, mPadding, y + mPadding);
166  }
167  }
168  if (mSelected == i)
169  {
170  font->drawString(graphics,
175  y + (ITEM_ICON_SIZE - fontHeigh) / 2 + mPadding);
176  }
177  else
178  {
179  font->drawString(graphics,
184  y + (ITEM_ICON_SIZE - fontHeigh) / 2 + mPadding);
185  }
186  }
187  BLOCK_END("ShopListBox::draw")
188 }
#define CAST_U32
Definition: cast.h:31
Definition: color.h:76
unsigned int a
Definition: color.h:251
unsigned int b
Definition: color.h:245
unsigned int r
Definition: color.h:235
unsigned int g
Definition: color.h:240
Definition: font.h:90
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
virtual void fillRectangle(const Rect &rectangle)=0
virtual void setColor(const Color &color)
Definition: graphics.h:320
int getId() const
Definition: item.h:81
Image * getImage() const
Definition: item.h:87
int mSelected
Definition: listbox.h:256
Color mForegroundSelectedColor2
Definition: listbox.h:285
static float mAlpha
Definition: listbox.h:292
Color mForegroundSelectedColor
Definition: listbox.h:284
virtual std::string getElementAt(int i)=0
Definition: rect.h:74
bool getDisabled() const
Definition: shopitem.h:157
ShopItem * at(const size_t i) const
Definition: shopitems.cpp:129
Color mForegroundColor2
Definition: widget2.h:113
Rect mDimension
Definition: widget.h:1101
bool isItemProtected(const int id)
Definition: playerinfo.cpp:515
Settings settings
Definition: settings.cpp:32

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().

◆ getType()

ShopListBoxTypeT ShopListBox::getType ( ) const
inline

Definition at line 95 of file shoplistbox.h.

96  { return mType; }

References mType.

◆ mouseExited()

void ShopListBox::mouseExited ( MouseEvent event)
virtual

Called when the mouse has exited the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 309 of file shoplistbox.cpp.

310 {
311  if (itemPopup == nullptr)
312  return;
313 
314  itemPopup->hide();
315 }
void hide()
Definition: popup.cpp:265
ItemPopup * itemPopup
Definition: itempopup.cpp:64

References Popup::hide(), and itemPopup.

◆ mouseMoved()

void ShopListBox::mouseMoved ( MouseEvent event)
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).

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 211 of file shoplistbox.cpp.

212 {
213  if ((itemPopup == nullptr) || (mRowHeight == 0U))
214  return;
215 
216  if (mShopItems == nullptr)
217  {
218  itemPopup->hide();
219  return;
220  }
221 
222  const int index = (event.getY() - mPadding) / mRowHeight;
223 
224  if (index < 0 || index >= mShopItems->getNumberOfElements())
225  {
226  itemPopup->hide();
227  }
228  else
229  {
230  const Item *const item = mShopItems->at(index);
231  if (item != nullptr)
232  {
233  itemPopup->setItem(item, false);
235  }
236  else
237  {
239  }
240  }
241 }
void setItem(const ItemInfo &item, const ItemColor color, const bool showImage, int id, const int *const cards, const ItemOptionsList *const options)
Definition: itempopup.cpp:189
Definition: item.h:50
void position(const int x, const int y)
Definition: popup.cpp:235
int getNumberOfElements()
Definition: shopitems.h:99
int mMouseX
Definition: viewport.h:154
int mMouseY
Definition: viewport.h:155
void setVisible(Visible visible)
Definition: widget.cpp:225
Viewport * viewport
Definition: viewport.cpp:36
const bool Visible_false
Definition: visible.h:30

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.

◆ mouseReleased()

void ShopListBox::mouseReleased ( MouseEvent event)
virtual

Called when a mouse button has been released on the widget area.

Parameters
eventDescribes the event.

Reimplemented from ListBox.

Definition at line 243 of file shoplistbox.cpp.

244 {
245  ListBox::mouseReleased(event);
246  if (event.getType() == MouseEventType::RELEASED2)
247  {
248  if (dragDrop.isEmpty())
249  return;
250  const DragDropSourceT src = dragDrop.getSource();
253  {
254  return;
255  }
258  src != DragDropSource::Cart)
259  {
260  return;
261  }
262  Inventory *inventory;
263  if (src == DragDropSource::Inventory)
264  inventory = PlayerInfo::getInventory();
265  else if (src == DragDropSource::Cart)
266  inventory = PlayerInfo::getCartInventory();
267  else
268  return;
269  if (inventory == nullptr)
270  return;
271  Item *const item = inventory->getItem(dragDrop.getTag());
273  {
276  nullptr,
277  item,
278  0,
279  0);
280  }
281  else
282  {
285  nullptr,
286  item,
287  0,
288  0);
289  }
290  }
291 
292  if (event.getButton() == MouseButton::RIGHT)
293  {
294  setSelected(std::max(0, getSelectionByMouse(event.getY())));
295 
296  if (mSelected < 0 || mSelected >= mShopItems->getNumberOfElements())
297  return;
298 
299  Item *const item = mShopItems->at(mSelected);
300  if ((popupMenu != nullptr) && (viewport != nullptr))
301  {
303  viewport->mMouseY,
304  item);
305  }
306  }
307 }
DragDropSourceT getSource() const
Definition: dragdrop.h:84
bool isEmpty() const
Definition: dragdrop.h:196
int getTag() const
Definition: dragdrop.h:235
Item * getItem(const int index) const
Definition: inventory.cpp:83
static void showWindow(const ItemAmountWindowUsageT usage, Window *const parent, Item *const item, int maxRange, const int tag)
void mouseReleased(MouseEvent &event)
Definition: listbox.cpp:311
void setSelected(const int selected)
Definition: listbox.cpp:399
virtual int getSelectionByMouse(const int y) const
Definition: listbox.cpp:392
MouseButtonT getButton() const
Definition: mouseevent.h:116
MouseEventTypeT getType() const
Definition: mouseevent.h:155
int getY() const
Definition: mouseevent.h:138
void showItemPopup(const int x, const int y, const Item *const item)
Definition: popupmenu.cpp:1790
DragDrop dragDrop
DragDropSource ::T DragDropSourceT
ServerTypeT getNetworkType()
Definition: net.cpp:189
Inventory * getInventory()
Definition: playerinfo.cpp:195
Inventory * getCartInventory()
Definition: playerinfo.cpp:207
PopupMenu * popupMenu
Definition: popupmenu.cpp:103

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.

◆ safeDraw()

void ShopListBox::safeDraw ( Graphics *const  graphics)
virtual

Reimplemented from ListBox.

Definition at line 190 of file shoplistbox.cpp.

191 {
192  ShopListBox::draw(graphics);
193 }
void draw(Graphics *const graphics)
Definition: shoplistbox.cpp:92

References draw().

◆ setPlayersMoney()

void ShopListBox::setPlayersMoney ( const int  money)

gives information about the current player's money

Definition at line 87 of file shoplistbox.cpp.

88 {
89  mPlayerMoney = money;
90 }

References mPlayerMoney.

Referenced by SellDialog::setMoney(), and BuyDialog::setMoney().

◆ setPriceCheck()

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.

207 {
208  mPriceCheck = check;
209 }

References mPriceCheck.

Referenced by SellDialog::postInit(), and ShopWindow::ShopWindow().

◆ setProtectItems()

void ShopListBox::setProtectItems ( bool  p)
inline

Definition at line 89 of file shoplistbox.h.

90  { mProtectItems = p; }

References mProtectItems.

Referenced by SellDialog::postInit().

◆ setType()

void ShopListBox::setType ( const ShopListBoxTypeT  type)
inline

Definition at line 92 of file shoplistbox.h.

93  { mType = type; }

References mType.

Field Documentation

◆ mPlayerMoney

int ShopListBox::mPlayerMoney
private

Definition at line 99 of file shoplistbox.h.

Referenced by setPlayersMoney().

◆ mPriceCheck

bool ShopListBox::mPriceCheck
private

Definition at line 110 of file shoplistbox.h.

Referenced by draw(), and setPriceCheck().

◆ mProtectItems

bool ShopListBox::mProtectItems
private

Definition at line 111 of file shoplistbox.h.

Referenced by draw(), and setProtectItems().

◆ mShopItems

ShopItems* ShopListBox::mShopItems
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().

◆ mType

ShopListBoxTypeT ShopListBox::mType
private

Definition at line 108 of file shoplistbox.h.

Referenced by getType(), mouseReleased(), and setType().

◆ mWarningColor

Color ShopListBox::mWarningColor
private

Definition at line 107 of file shoplistbox.h.

Referenced by draw().


The documentation for this class was generated from the following files: