ManaPlus
Public Member Functions | Private Types | Private Member Functions | Private Attributes
ItemContainer Class Reference

#include <itemcontainer.h>

Inheritance diagram for ItemContainer:
Widget KeyListener MouseListener WidgetListener Widget2

Public Member Functions

 ItemContainer (const Widget2 *const widget, Inventory *const inventory, const int maxColumns, const ShowEmptyRows showEmptyRows, const ForceQuantity forceQuantity)
 
 ~ItemContainer ()
 
void logic ()
 
void draw (Graphics *const graphics)
 
void safeDraw (Graphics *const graphics)
 
void keyPressed (KeyEvent &event)
 
void keyReleased (KeyEvent &event)
 
void mousePressed (MouseEvent &event)
 
void mouseDragged (MouseEvent &event)
 
void mouseReleased (MouseEvent &event)
 
void mouseMoved (MouseEvent &event)
 
void mouseExited (MouseEvent &event)
 
void widgetResized (const Event &event)
 
void widgetMoved (const Event &event)
 
ItemgetSelectedItem () const
 
void selectNone ()
 
void addSelectionListener (SelectionListener *listener)
 
void removeSelectionListener (SelectionListener *listener)
 
void setFilter (const int tag)
 
void setSortType (const int sortType)
 
void setName (const std::string &str)
 
int updateMatrix ()
 
bool getClickCount () const
 
void unsetInventory ()
 
void setInventory (Inventory *const inventory)
 
void setCellBackgroundImage (const std::string &xmlName)
 
void setMaxColumns (const int maxColumns)
 
- 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 ()
 
virtual void postInit ()
 
- 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 KeyListener
virtual ~KeyListener ()
 
- 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)
 
- Public Member Functions inherited from WidgetListener
virtual ~WidgetListener ()
 
virtual void widgetHidden (const Event &event)
 
virtual void widgetShown (const Event &event)
 

Private Types

enum  Direction { Left = 0, Right, Up, Down }
 
enum  SelectionState {
  SEL_NONE = 0, SEL_SELECTED, SEL_SELECTING, SEL_DESELECTING,
  SEL_DRAGGING
}
 
typedef std::list< SelectionListener * > SelectionListenerList
 
typedef SelectionListenerList::iterator SelectionListenerIterator
 

Private Member Functions

void setSelectedIndex (const int index)
 
void adjustHeight ()
 
void distributeValueChangedEvent ()
 
void updateSize ()
 
int getSlotIndex (int x, int y) const
 
int getSlotByXY (int x, int y) const
 

Private Attributes

InventorymInventory
 
ImagemSelImg
 
ImagemProtectedImg
 
ImagemCellBackgroundImg
 
std::string mName
 
int * mShowMatrix
 
SkinmSkin
 
ImageCollectionmVertexes
 
Color mEquipedColor
 
Color mEquipedColor2
 
Color mUnEquipedColor
 
Color mUnEquipedColor2
 
SelectionListenerList mSelectionListeners
 
int mGridColumns
 
int mGridRows
 
int mDrawRows
 
int mSelectedIndex
 
int mLastUsedSlot
 
int mTag
 
int mSortType
 
int mClicks
 
int mBoxWidth
 
int mBoxHeight
 
int mEquippedTextPadding
 
int mPaddingItemX
 
int mPaddingItemY
 
int mMaxColumns
 
SelectionState mSelectionStatus
 
ForceQuantity mForceQuantity
 
ShowEmptyRows mShowEmptyRows
 
bool mDescItems
 

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 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 KeyListener
 KeyListener ()
 
- Protected Member Functions inherited from MouseListener
 MouseListener ()
 
- Protected Member Functions inherited from WidgetListener
 WidgetListener ()
 
- 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 Widget
static FontmGlobalFont = 0
 

Detailed Description

An item container. Used to show items in inventory and trade dialog.

Definition at line 48 of file itemcontainer.h.

Member Typedef Documentation

◆ SelectionListenerIterator

typedef SelectionListenerList::iterator ItemContainer::SelectionListenerIterator
private

Definition at line 201 of file itemcontainer.h.

◆ SelectionListenerList

Definition at line 200 of file itemcontainer.h.

Member Enumeration Documentation

◆ Direction

Enumerator
Left 
Right 
Up 
Down 

Definition at line 142 of file itemcontainer.h.

◆ SelectionState

Enumerator
SEL_NONE 
SEL_SELECTED 
SEL_SELECTING 
SEL_DESELECTING 
SEL_DRAGGING 

Definition at line 150 of file itemcontainer.h.

Constructor & Destructor Documentation

◆ ItemContainer()

ItemContainer::ItemContainer ( const Widget2 *const  widget,
Inventory *const  inventory,
const int  maxColumns,
const ShowEmptyRows  showEmptyRows,
const ForceQuantity  forceQuantity 
)

Definition at line 224 of file itemcontainer.cpp.

References Widget::addKeyListener(), Widget::addMouseListener(), Widget::addWidgetListener(), Widget::mAllowLogic, and Widget::setFocusable().

228  :
229  Widget(widget),
230  KeyListener(),
231  MouseListener(),
232  WidgetListener(),
233  mInventory(inventory),
234  mSelImg(Theme::getImageFromThemeXml("item_selection.xml", "")),
236  mCellBackgroundImg(Theme::getImageFromThemeXml("inventory_cell.xml", "")),
237  mName(),
238  mShowMatrix(nullptr),
239  mSkin(theme != nullptr ? theme->load("itemcontainer.xml", "",
240  true, Theme::getThemePath()) : nullptr),
246  255U)),
248  mGridColumns(1),
249  mGridRows(1),
250  mDrawRows(1),
251  mSelectedIndex(-1),
252  mLastUsedSlot(-1),
253  mTag(0),
254  mSortType(0),
255  mClicks(1),
256  mBoxWidth(mSkin != nullptr ? mSkin->getOption("boxWidth", 35) : 35),
257  mBoxHeight(mSkin != nullptr ? mSkin->getOption("boxHeight", 43) : 43),
259  "equippedTextPadding", 29) : 29),
260  mPaddingItemX(mSkin != nullptr ? mSkin->getOption("paddingItemX", 0) : 0),
261  mPaddingItemY(mSkin != nullptr ? mSkin->getOption("paddingItemY", 0) : 0),
262  mMaxColumns(maxColumns),
264  mForceQuantity(forceQuantity),
265  mShowEmptyRows(showEmptyRows),
266  mDescItems(false)
267 {
268  setFocusable(true);
269  addKeyListener(this);
270  addMouseListener(this);
271  addWidgetListener(this);
272  mAllowLogic = false;
273 }
ForceQuantity mForceQuantity
Color mUnEquipedColor2
SelectionListenerList mSelectionListeners
static Image * getImageFromThemeXml(const std::string &name, const std::string &name2)
Definition: theme.cpp:1135
static std::string getThemePath()
Definition: theme.h:66
std::string mName
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
Definition: theme.cpp:178
int getOption(const std::string &name) const
Definition: skin.h:105
ImageCollection * mVertexes
static Image * getImageFromTheme(const std::string &path)
Definition: theme.cpp:654
Widget(const Widget2 *const widget)
Definition: widget.cpp:84
bool mAllowLogic
Definition: widget.h:1159
void addMouseListener(MouseListener *const mouseListener)
Definition: widget.cpp:291
void addKeyListener(KeyListener *const keyListener)
Definition: widget.cpp:271
Image * mCellBackgroundImg
Color mUnEquipedColor
ShowEmptyRows mShowEmptyRows
Inventory * mInventory
void addWidgetListener(WidgetListener *const widgetListener)
Definition: widget.cpp:301
Theme * theme
Definition: theme.cpp:61
void setFocusable(const bool focusable)
Definition: widget.cpp:191
int mEquippedTextPadding
const Color & getThemeColor(const ThemeColorIdT type, const unsigned int alpha) const A_INLINE
Definition: widget2.h:44
Image * mProtectedImg
SelectionState mSelectionStatus
Color mEquipedColor2

◆ ~ItemContainer()

ItemContainer::~ItemContainer ( )

Destructor.

Definition at line 275 of file itemcontainer.cpp.

References Image::decRef(), delete2, gui, mCellBackgroundImg, mProtectedImg, mSelImg, mShowMatrix, mSkin, mVertexes, Gui::removeDragged(), theme, and Theme::unload().

276 {
277  if (gui != nullptr)
278  gui->removeDragged(this);
279 
280  if (mSelImg != nullptr)
281  {
282  mSelImg->decRef();
283  mSelImg = nullptr;
284  }
285  if (mProtectedImg != nullptr)
286  {
288  mProtectedImg = nullptr;
289  }
290  if (mCellBackgroundImg != nullptr)
291  {
293  mCellBackgroundImg = nullptr;
294  }
295 
296  if (theme != nullptr)
297  theme->unload(mSkin);
298 
299  delete []mShowMatrix;
301 }
void unload(Skin *const skin)
Definition: theme.cpp:249
Gui * gui
Definition: gui.cpp:110
#define delete2(var)
Definition: delete2.h:24
ImageCollection * mVertexes
Image * mCellBackgroundImg
Theme * theme
Definition: theme.cpp:61
void removeDragged(const Widget *const widget)
Definition: gui.cpp:1160
Image * mProtectedImg
void decRef()
Definition: image.cpp:521

Member Function Documentation

◆ addSelectionListener()

void ItemContainer::addSelectionListener ( SelectionListener listener)
inline

Adds a listener to the list that's notified each time a change to the selection occurs.

Definition at line 109 of file itemcontainer.h.

References mSelectionListeners.

Referenced by InventoryWindow::InventoryWindow(), and TradeWindow::TradeWindow().

110  { mSelectionListeners.push_back(listener); }
SelectionListenerList mSelectionListeners

◆ adjustHeight()

void ItemContainer::adjustHeight ( )
private

Determine and set the height of the container.

Definition at line 1131 of file itemcontainer.cpp.

References Inventory::getSize(), mBoxHeight, mDrawRows, mGridColumns, mGridRows, mInventory, mLastUsedSlot, mShowEmptyRows, Widget::setHeight(), ShowEmptyRows_false, ShowEmptyRows_true, and updateMatrix().

Referenced by logic(), setFilter(), and updateSize().

1132 {
1133  if (mGridColumns == 0)
1134  return;
1135 
1137  if (mGridRows == 0 || (mLastUsedSlot + 1) % mGridColumns > 0)
1138  ++mGridRows;
1139 
1140  const int invSize = mInventory->getSize();
1141  int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
1142  std::max(invSize / mGridColumns, mGridRows) : mGridRows;
1143 
1145  {
1146  if (mGridColumns * maxRows < invSize)
1147  maxRows ++;
1148  mGridRows = maxRows;
1149  }
1150 
1151  const int num = updateMatrix();
1153  {
1154  mDrawRows = num / mGridColumns;
1155  if (mDrawRows == 0 || num % mGridColumns > 0)
1156  ++mDrawRows;
1157 
1158  maxRows = mDrawRows;
1159  }
1160  else
1161  {
1162  mDrawRows = mGridRows;
1163  }
1164  setHeight(maxRows * mBoxHeight);
1165 }
const bool ShowEmptyRows_true
Definition: showemptyrows.h:29
const bool ShowEmptyRows_false
Definition: showemptyrows.h:29
ShowEmptyRows mShowEmptyRows
Inventory * mInventory
void setHeight(const int height)
Definition: widget.cpp:139
unsigned getSize() const
Definition: inventory.h:75

◆ distributeValueChangedEvent()

void ItemContainer::distributeValueChangedEvent ( )
private

Sends out selection events to the list of selection listeners.

Definition at line 607 of file itemcontainer.cpp.

References FOR_EACH, and mSelectionListeners.

Referenced by setSelectedIndex().

608 {
610  {
611  if (*i != nullptr)
612  {
613  SelectionEvent event(this);
614  (*i)->valueChanged(event);
615  }
616  }
617 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
SelectionListenerList mSelectionListeners
SelectionListenerList::iterator SelectionListenerIterator

◆ draw()

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

Draws the items.

Implements Widget.

Definition at line 324 of file itemcontainer.cpp.

References _, BLOCK_END, BLOCK_START, Graphics::calcTileCollection(), ImageCollection::clear(), Graphics::drawImage(), Font::drawString(), Graphics::drawTileCollection(), Equipped_true, Graphics::finalize(), ServerCommandType::font, ForceQuantity_true, Widget::getFont(), Item::getId(), Item::getImage(), Inventory::getItem(), Item::getQuantity(), Graphics::getRedraw(), Inventory::getSize(), Font::getWidth(), Item::isEquipped(), PlayerInfo::isItemProtected(), ServerCommandType::item, mBoxHeight, mBoxWidth, mCellBackgroundImg, mDrawRows, mEquipedColor, mEquipedColor2, mEquippedTextPadding, mForceQuantity, mGridColumns, mGridRows, mInventory, mPaddingItemX, mPaddingItemY, mProtectedImg, Widget::mRedraw, mSelectedIndex, mSelImg, mShowEmptyRows, mShowMatrix, mUnEquipedColor, mUnEquipedColor2, mVertexes, Image::setAlpha(), ShowEmptyRows_true, and Catch::toString().

325 {
326  if ((mInventory == nullptr) || (mShowMatrix == nullptr))
327  return;
328 
329  BLOCK_START("ItemContainer::draw")
330  Font *const font = getFont();
331 
332  if (mCellBackgroundImg != nullptr)
333  {
334  if (mRedraw || graphics->getRedraw())
335  {
336  mRedraw = false;
337  mVertexes->clear();
338 
339  const int invSize = mInventory->getSize();
340  const int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
341  std::max(invSize / mGridColumns, mGridRows) : mGridRows;
342  const int maxColumns = mGridColumns > invSize ?
343  invSize : mGridColumns;
344  for (int j = 0; j < maxRows; j++)
345  {
346  const int intY0 = j * mBoxHeight;
347  for (int i = 0; i < maxColumns; i++)
348  {
349  int itemX = i * mBoxWidth;
350  int itemY = intY0;
351  graphics->calcTileCollection(mVertexes,
353  itemX + mPaddingItemX,
354  itemY + mPaddingItemY);
355  }
356  }
357  graphics->finalize(mVertexes);
358  }
359  graphics->drawTileCollection(mVertexes);
360  }
361 
362  for (int j = 0; j < mDrawRows; j++)
363  {
364  const int intY0 = j * mBoxHeight;
365  int itemIndex = j * mGridColumns - 1;
366  for (int i = 0; i < mGridColumns; i++)
367  {
368  int itemX = i * mBoxWidth;
369  int itemY = intY0;
370  itemIndex ++;
371  if (mShowMatrix[itemIndex] < 0)
372  continue;
373 
374  const Item *const item = mInventory->getItem(
375  mShowMatrix[itemIndex]);
376 
377  if ((item == nullptr) || item->getId() == 0)
378  continue;
379 
380  Image *const image = item->getImage();
381  if (image != nullptr)
382  {
383  if (mShowMatrix[itemIndex] == mSelectedIndex)
384  {
385  if (mSelImg != nullptr)
386  graphics->drawImage(mSelImg, itemX, itemY);
387  }
388  image->setAlpha(1.0F); // ensure the image if fully drawn...
389  graphics->drawImage(image,
390  itemX + mPaddingItemX,
391  itemY + mPaddingItemY);
392  if ((mProtectedImg != nullptr) && PlayerInfo::isItemProtected(
393  item->getId()))
394  {
395  graphics->drawImage(mProtectedImg,
396  itemX + mPaddingItemX,
397  itemY + mPaddingItemY);
398  }
399  }
400  }
401  }
402 
403  for (int j = 0; j < mDrawRows; j++)
404  {
405  const int intY0 = j * mBoxHeight;
406  int itemIndex = j * mGridColumns - 1;
407  for (int i = 0; i < mGridColumns; i++)
408  {
409  int itemX = i * mBoxWidth;
410  int itemY = intY0;
411  itemIndex ++;
412  if (mShowMatrix[itemIndex] < 0)
413  continue;
414 
415  const Item *const item = mInventory->getItem(
416  mShowMatrix[itemIndex]);
417 
418  if ((item == nullptr) || item->getId() == 0)
419  continue;
420 
421  // Draw item caption
422  std::string caption;
423  if (item->getQuantity() > 1 ||
425  {
426  caption = toString(item->getQuantity());
427  }
428  else if (item->isEquipped() == Equipped_true)
429  {
430  // TRANSLATORS: Text under equipped items (should be small)
431  caption = _("Eq.");
432  }
433 
434  if (item->isEquipped() == Equipped_true)
435  {
436  font->drawString(graphics,
438  caption,
439  itemX + (mBoxWidth - font->getWidth(caption)) / 2,
440  itemY + mEquippedTextPadding);
441  }
442  else
443  {
444  font->drawString(graphics,
446  caption,
447  itemX + (mBoxWidth - font->getWidth(caption)) / 2,
448  itemY + mEquippedTextPadding);
449  }
450  }
451  }
452  BLOCK_END("ItemContainer::draw")
453 }
Font * getFont() const
Definition: widget.cpp:330
ForceQuantity mForceQuantity
Color mUnEquipedColor2
#define _(s)
Definition: gettext.h:34
const bool ShowEmptyRows_true
Definition: showemptyrows.h:29
virtual void drawTileCollection(const ImageCollection *const vertCol)=0
Definition: font.h:88
Equipped isEquipped() const
Definition: item.h:128
#define BLOCK_START(name)
Definition: perfomance.h:78
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
const bool Equipped_true
Definition: equipped.h:29
virtual void finalize(ImageCollection *const col)
Definition: graphics.h:464
virtual void setAlpha(const float alpha)
Definition: image.cpp:285
int getQuantity() const
Definition: item.h:104
ImageCollection * mVertexes
Definition: item.h:48
Image * mCellBackgroundImg
bool getRedraw() const
Definition: graphics.h:286
Color mUnEquipedColor
ShowEmptyRows mShowEmptyRows
Inventory * mInventory
bool isItemProtected(const int id)
Definition: playerinfo.cpp:511
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
int getId() const
Definition: item.h:80
Image * getImage() const
Definition: item.h:86
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
bool mRedraw
Definition: widget.h:1163
Definition: image.h:61
virtual void calcTileCollection(ImageCollection *const vertCol, const Image *const image, int x, int y)=0
int mEquippedTextPadding
Image * mProtectedImg
Item * getItem(const int index) const
Definition: inventory.cpp:82
const bool ForceQuantity_true
Definition: forcequantity.h:29
Color mEquipedColor2
unsigned getSize() const
Definition: inventory.h:75

◆ getClickCount()

bool ItemContainer::getClickCount ( ) const
inline

Definition at line 128 of file itemcontainer.h.

References mClicks.

129  { return mClicks != 0; }

◆ getSelectedItem()

Item * ItemContainer::getSelectedItem ( ) const

◆ getSlotByXY()

int ItemContainer::getSlotByXY ( int  x,
int  y 
) const
private

Definition at line 1285 of file itemcontainer.cpp.

References mBoxHeight, mBoxWidth, Widget::mDimension, mGridColumns, mGridRows, mShowMatrix, Inventory::NO_SLOT_INDEX, and Rect::width.

Referenced by mouseReleased().

1286 {
1287  if (mShowMatrix == nullptr)
1288  return Inventory::NO_SLOT_INDEX;
1289 
1290  if (x < mDimension.width && y < mDimension.height && x >= 0 && y >= 0)
1291  {
1292  if (x > mBoxWidth * mGridColumns)
1293  return Inventory::NO_SLOT_INDEX;
1294  const int idx = (y / mBoxHeight) * mGridColumns + (x / mBoxWidth);
1295  if (idx >= 0 && idx < mGridRows * mGridColumns)
1296  return idx;
1297  }
1298 
1299  return Inventory::NO_SLOT_INDEX;
1300 }
int width
Definition: rect.h:218
static const int NO_SLOT_INDEX
Definition: inventory.h:57
Rect mDimension
Definition: widget.h:1100

◆ getSlotIndex()

int ItemContainer::getSlotIndex ( int  x,
int  y 
) const
private

Gets the inventory slot index based on the cursor position.

Parameters
xThe X coordinate position.
yThe Y coordinate position.
Returns
The slot index on success, -1 on failure.

Definition at line 1265 of file itemcontainer.cpp.

References mBoxHeight, mBoxWidth, Widget::mDimension, mGridColumns, mGridRows, mShowMatrix, Inventory::NO_SLOT_INDEX, and Rect::width.

Referenced by mouseMoved(), mousePressed(), and mouseReleased().

1266 {
1267  if (mShowMatrix == nullptr)
1268  return Inventory::NO_SLOT_INDEX;
1269 
1270  if (x < mDimension.width && y < mDimension.height && x >= 0 && y >= 0)
1271  {
1272  if (x > mBoxWidth * mGridColumns)
1273  return Inventory::NO_SLOT_INDEX;
1274  const int idx = (y / mBoxHeight) * mGridColumns + (x / mBoxWidth);
1275  if (idx >= 0 && idx < mGridRows * mGridColumns
1276  && mShowMatrix[idx] >= 0)
1277  {
1278  return mShowMatrix[idx];
1279  }
1280  }
1281 
1282  return Inventory::NO_SLOT_INDEX;
1283 }
int width
Definition: rect.h:218
static const int NO_SLOT_INDEX
Definition: inventory.h:57
Rect mDimension
Definition: widget.h:1100

◆ keyPressed()

void ItemContainer::keyPressed ( KeyEvent event)
virtual

Called if a key is pressed when the widget has keyboard focus. If a key is held down the widget will generate multiple key presses.

Parameters
eventDiscribes the event.

Reimplemented from KeyListener.

Definition at line 619 of file itemcontainer.cpp.

620 {
621 }

◆ keyReleased()

void ItemContainer::keyReleased ( KeyEvent event)
virtual

Called if a key is released when the widget has keyboard focus.

Parameters
eventDiscribes the event.

Reimplemented from KeyListener.

Definition at line 623 of file itemcontainer.cpp.

624 {
625 }

◆ logic()

void ItemContainer::logic ( )
virtual

Necessary for checking how full the inventory is.

Reimplemented from Widget.

Definition at line 303 of file itemcontainer.cpp.

References adjustHeight(), BLOCK_END, BLOCK_START, Inventory::getLastUsedSlot(), Widget::logic(), mInventory, and mLastUsedSlot.

304 {
305  BLOCK_START("ItemContainer::logic")
306  Widget::logic();
307 
308  if (mInventory == nullptr)
309  {
310  BLOCK_END("ItemContainer::logic")
311  return;
312  }
313 
314  const int lastUsedSlot = mInventory->getLastUsedSlot();
315 
316  if (lastUsedSlot != mLastUsedSlot)
317  {
318  mLastUsedSlot = lastUsedSlot;
319  adjustHeight();
320  }
321  BLOCK_END("ItemContainer::logic")
322 }
#define BLOCK_START(name)
Definition: perfomance.h:78
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
Inventory * mInventory
Definition: widget.h:97

◆ mouseDragged()

void ItemContainer::mouseDragged ( MouseEvent event)
virtual

Called when the mouse has moved and the mouse has previously been pressed on the widget.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 718 of file itemcontainer.cpp.

References mSelectionStatus, SEL_DRAGGING, and SEL_NONE.

◆ mouseExited()

void ItemContainer::mouseExited ( MouseEvent event)
virtual

Called when the mouse has exited the widget area.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 1106 of file itemcontainer.cpp.

References itemPopup, Widget::setVisible(), and Visible_false.

1107 {
1109 }
void setVisible(Visible visible)
Definition: widget.cpp:224
const bool Visible_false
Definition: visible.h:29
ItemPopup * itemPopup
Definition: itempopup.cpp:63

◆ mouseMoved()

void ItemContainer::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 1087 of file itemcontainer.cpp.

References Inventory::getItem(), getSlotIndex(), MouseEvent::getX(), ServerCommandType::item, itemPopup, mInventory, Viewport::mMouseX, Viewport::mMouseY, Popup::position(), ItemPopup::setItem(), Widget::setVisible(), viewport, and Visible_false.

1088 {
1089  if (mInventory == nullptr)
1090  return;
1091 
1092  const Item *const item = mInventory->getItem(
1093  getSlotIndex(event.getX(), event.getY()));
1094 
1095  if ((item != nullptr) && (viewport != nullptr))
1096  {
1097  itemPopup->setItem(item, false);
1099  }
1100  else
1101  {
1103  }
1104 }
void setVisible(Visible visible)
Definition: widget.cpp:224
int mMouseX
Definition: viewport.h:153
const bool Visible_false
Definition: visible.h:29
void position(const int x, const int y)
Definition: popup.cpp:232
Definition: item.h:48
void setItem(const ItemInfo &item, const ItemColor color, const bool showImage, int id, const int *const cards, const ItemOptionsList *const options)
Definition: itempopup.cpp:188
int mMouseY
Definition: viewport.h:154
Inventory * mInventory
int getX() const
Definition: mouseevent.h:126
int getSlotIndex(int x, int y) const
ItemPopup * itemPopup
Definition: itempopup.cpp:63
Item * getItem(const int index) const
Definition: inventory.cpp:82
Viewport * viewport
Definition: viewport.cpp:35

◆ mousePressed()

void ItemContainer::mousePressed ( MouseEvent event)
virtual

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

NOTE: A mouse press is NOT equal to a mouse click. Use mouseClickMessage to check for mouse clicks.

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 627 of file itemcontainer.cpp.

References ChatWindow::addItemText(), InventoryType::Cart, DragDropSource::Cart, CAST_S32, chatWindow, InventoryType::Craft, DragDropSource::Craft, DragDrop::deselect(), dragDrop, DragDrop::dragItem(), DragDropSource::Empty, Item::getId(), Item::getInfo(), Inventory::getItem(), ItemInfo::getName(), getSlotIndex(), ShortcutWindow::getTabIndex(), Inventory::getType(), MouseEvent::getX(), DragDropSource::Inventory, InventoryType::Inventory, ServerCommandType::item, itemShortcut, itemShortcutWindow, MouseButton::LEFT, InventoryType::MailEdit, DragDropSource::MailEdit, InventoryType::MailView, DragDropSource::MailView, mClicks, mDescItems, mInventory, mSelectedIndex, mSelectionStatus, Inventory::NO_SLOT_INDEX, InventoryType::Npc, DragDropSource::Npc, MouseButton::RIGHT, SEL_DESELECTING, SEL_SELECTING, DragDrop::select(), selectNone(), ShopWindow::setItemSelected(), ItemShortcut::setItemSelected(), setSelectedIndex(), shopWindow, SHORTCUT_TABS, DragDropSource::Storage, InventoryType::Storage, DragDropSource::Trade, InventoryType::Trade, InventoryType::TypeEnd, and InventoryType::Vending.

628 {
629  if (mInventory == nullptr)
630  return;
631 
632  const MouseButtonT button = event.getButton();
633  mClicks = event.getClickCount();
634 
635  if (button == MouseButton::LEFT || button == MouseButton::RIGHT)
636  {
637  event.consume();
638  const int index = getSlotIndex(event.getX(), event.getY());
639  if (index == Inventory::NO_SLOT_INDEX)
640  return;
641 
642  Item *const item = mInventory->getItem(index);
643 
644  // put item name into chat window
645  if ((item != nullptr) && mDescItems && (chatWindow != nullptr))
647 
649  switch (mInventory->getType())
650  {
653  break;
656  break;
658  src = DragDropSource::Trade;
659  break;
660  case InventoryType::Npc:
661  src = DragDropSource::Npc;
662  break;
663  case InventoryType::Cart:
664  src = DragDropSource::Cart;
665  break;
668  break;
671  break;
673  src = DragDropSource::Craft;
674  break;
675  default:
678  break;
679  }
680  if (src == DragDropSource::MailView)
681  return;
682  if (mSelectedIndex == index && mClicks != 2)
683  {
684  dragDrop.dragItem(item, src, index);
685  dragDrop.select(item);
687  }
688  else if ((item != nullptr) && (item->getId() != 0))
689  {
690  if (index >= 0)
691  {
692  dragDrop.dragItem(item, src, index);
693  dragDrop.select(item);
694  setSelectedIndex(index);
696 
697  if (itemShortcutWindow != nullptr)
698  {
699  const int num = itemShortcutWindow->getTabIndex();
700  if (num >= 0 && num < CAST_S32(SHORTCUT_TABS))
701  {
702  if (itemShortcut[num] != nullptr)
703  itemShortcut[num]->setItemSelected(item);
704  }
705  }
706  if (shopWindow != nullptr)
707  shopWindow->setItemSelected(item->getId());
708  }
709  }
710  else
711  {
712  dragDrop.deselect();
713  selectNone();
714  }
715  }
716 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:88
void setItemSelected(const int itemId)
Definition: itemshortcut.h:125
DragDropSource ::T DragDropSourceT
DragDrop dragDrop
const std::string & getName() const
Definition: iteminfo.h:73
static const int NO_SLOT_INDEX
Definition: inventory.h:57
void dragItem(const Item *const item, const DragDropSourceT source, const int tag)
Definition: dragdrop.h:86
#define CAST_S32
Definition: cast.h:29
int getTabIndex() const
Definition: item.h:48
void deselect()
Definition: dragdrop.h:212
ShortcutWindow * itemShortcutWindow
const unsigned int SHORTCUT_TABS
Definition: itemshortcut.h:27
const ItemInfo & getInfo() const
Definition: item.h:170
ItemShortcut * itemShortcut[SHORTCUT_TABS]
Inventory * mInventory
ShopWindow * shopWindow
Definition: shopwindow.cpp:99
int getId() const
Definition: item.h:80
void setSelectedIndex(const int index)
void setItemSelected(const int id)
Definition: shopwindow.h:106
void addItemText(const std::string &item)
int getX() const
Definition: mouseevent.h:126
void select(const Item *const item)
Definition: dragdrop.h:198
int getSlotIndex(int x, int y) const
SelectionState mSelectionStatus
Item * getItem(const int index) const
Definition: inventory.cpp:82
MouseButton ::T MouseButtonT
Definition: mousebutton.h:77
InventoryTypeT getType() const
Definition: inventory.h:175

◆ mouseReleased()

void ItemContainer::mouseReleased ( MouseEvent event)
virtual

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

Parameters
eventDescribes the event.

Reimplemented from MouseListener.

Definition at line 724 of file itemcontainer.cpp.

References Net::Mail2Handler::addItem(), Net::TradeHandler::addItem(), Inventory::addVirtualItem(), InventoryType::Cart, DragDropSource::Cart, InventoryWindow::combineItems(), InventoryType::Craft, DragDropSource::Craft, ItemAmountWindowUsage::CraftAdd, dragDrop, DragDropSource::Empty, Settings::enableNewMailSystem, Equipm_false, Equipped_false, Equipped_true, PlayerInfo::getCartInventory(), Item::getColor(), Net::NpcHandler::getCurrentNpcDialog(), Item::getDamaged(), Item::getFavorite(), Item::getId(), Item::getIdentified(), MailEditWindow::getInventory(), PlayerInfo::getInventory(), Item::getInvIndex(), Inventory::getItem(), Net::getNetworkType(), Item::getQuantity(), getSlotByXY(), getSlotIndex(), DragDrop::getSource(), PlayerInfo::getStorageInventory(), Item::getTag(), DragDrop::getTag(), MouseEvent::getType(), Inventory::getType(), Item::getType(), MouseEvent::getX(), inputManager, DragDropSource::Inventory, InventoryType::Inventory, inventoryHandler, inventoryWindow, InputManager::isActionActive(), DragDrop::isEmpty(), Item::isEquipped(), PlayerInfo::isItemProtected(), ServerCommandType::item, ServerCommandType::item2, mail2Handler, ItemAmountWindowUsage::MailAdd, InventoryType::MailEdit, DragDropSource::MailEdit, mailEditWindow, InventoryType::MailView, DragDropSource::MailView, mClicks, mInventory, Net::InventoryHandler::moveItem(), Inventory::moveItem(), Net::InventoryHandler::moveItem2(), mSelectedIndex, mSelectionStatus, Inventory::NO_SLOT_INDEX, InventoryType::Npc, DragDropSource::Npc, npcHandler, MouseEventType::RELEASED2, Net::Mail2Handler::removeItem(), Inventory::removeItemAt(), SEL_DESELECTING, SEL_DRAGGING, SEL_NONE, SEL_SELECTED, SEL_SELECTING, selectNone(), Inventory::setItem(), Item::setTag(), settings, ItemAmountWindow::showWindow(), InputAction::STOP_ATTACK, DragDropSource::Storage, InventoryType::Storage, ServerType::TMWATHENA, DragDropSource::Trade, InventoryType::Trade, tradeHandler, InventoryType::TypeEnd, InventoryType::Vending, Inventory::virtualRemove(), and Inventory::virtualRestore().

725 {
726  if (mClicks == 2 ||
727  inventoryHandler == nullptr ||
728  tradeHandler == nullptr)
729  {
730  return;
731  }
732 
733  switch (mSelectionStatus)
734  {
735  case SEL_SELECTING:
737  break;
738  case SEL_DESELECTING:
739  selectNone();
740  break;
741  case SEL_DRAGGING:
743  break;
744  case SEL_NONE:
745  case SEL_SELECTED:
746  default:
747  break;
748  };
749 
750  if (dragDrop.isEmpty())
751  {
752  const int index = getSlotIndex(event.getX(), event.getY());
753  if (index == Inventory::NO_SLOT_INDEX)
754  return;
755  if (index == mSelectedIndex || mSelectedIndex == -1)
756  return;
758  selectNone();
759  }
760  else if (mInventory != nullptr)
761  {
762  const DragDropSourceT src = dragDrop.getSource();
764  switch (mInventory->getType())
765  {
768  break;
771  break;
773  dst = DragDropSource::Trade;
774  break;
775  case InventoryType::Npc:
776  dst = DragDropSource::Npc;
777  break;
780  break;
783  break;
784  case InventoryType::Cart:
785  dst = DragDropSource::Cart;
786  break;
788  dst = DragDropSource::Craft;
789  break;
790  default:
793  break;
794  }
795  InventoryTypeT srcContainer = InventoryType::TypeEnd;
796  InventoryTypeT dstContainer = InventoryType::TypeEnd;
797  bool checkProtection(false);
798  Inventory *inventory = nullptr;
799  if (src == DragDropSource::Inventory
800  && dst == DragDropSource::Storage)
801  {
802  srcContainer = InventoryType::Inventory;
803  dstContainer = InventoryType::Storage;
804  inventory = PlayerInfo::getInventory();
805  }
806  else if (src == DragDropSource::Storage
807  && dst == DragDropSource::Inventory)
808  {
809  srcContainer = InventoryType::Storage;
810  dstContainer = InventoryType::Inventory;
811  inventory = PlayerInfo::getStorageInventory();
812  }
813  if (src == DragDropSource::Inventory
814  && dst == DragDropSource::Cart)
815  {
816  srcContainer = InventoryType::Inventory;
817  dstContainer = InventoryType::Cart;
818  inventory = PlayerInfo::getInventory();
819  }
820  if (src == DragDropSource::Inventory
821  && dst == DragDropSource::Inventory)
822  {
824  return;
825  const int index = getSlotIndex(event.getX(), event.getY());
826  if (index == Inventory::NO_SLOT_INDEX)
827  return;
828  if (index == mSelectedIndex || mSelectedIndex == -1)
829  return;
830  if (inventoryWindow != nullptr)
832  return;
833  }
834  else if (src == DragDropSource::Cart
835  && dst == DragDropSource::Inventory)
836  {
837  srcContainer = InventoryType::Cart;
838  dstContainer = InventoryType::Inventory;
839  inventory = PlayerInfo::getCartInventory();
840  }
841  else if (src == DragDropSource::Cart
842  && dst == DragDropSource::Storage)
843  {
844  srcContainer = InventoryType::Cart;
845  dstContainer = InventoryType::Storage;
846  inventory = PlayerInfo::getCartInventory();
847  }
848  else if (src == DragDropSource::Storage
849  && dst == DragDropSource::Cart)
850  {
851  srcContainer = InventoryType::Storage;
852  dstContainer = InventoryType::Cart;
853  inventory = PlayerInfo::getStorageInventory();
854  }
855  if (src == DragDropSource::Inventory
856  && dst == DragDropSource::Trade)
857  {
858  checkProtection = true;
859  inventory = PlayerInfo::getInventory();
860  }
861  else if (src == DragDropSource::Inventory &&
862  dst == DragDropSource::Npc)
863  {
864  inventory = PlayerInfo::getInventory();
865  if (inventory != nullptr)
866  {
867  Item *const item = inventory->getItem(dragDrop.getTag());
869  item,
870  getSlotByXY(event.getX(), event.getY()),
871  1))
872  {
873  inventory->virtualRemove(item, 1);
874  }
875  }
876  return;
877  }
878  else if (src == DragDropSource::Inventory &&
880  {
881  inventory = PlayerInfo::getInventory();
882  if (inventory == nullptr)
883  return;
884  Item *const item = inventory->getItem(dragDrop.getTag());
885  if (item == nullptr)
886  return;
888  {
889  if (item->getQuantity() > 1
891  {
895  item,
896  0,
897  0);
898  }
899  else
900  {
901  mail2Handler->addItem(item, 1);
902  }
903  }
904  else
905  {
907  item,
908  getSlotByXY(event.getX(), event.getY()),
909  1))
910  {
911  inventory->virtualRemove(item, 1);
912  }
913  }
914  return;
915  }
916  else if (src == DragDropSource::Npc)
917  {
918  inventory = PlayerInfo::getInventory();
919  if (dst == DragDropSource::Npc)
920  {
921  const Item *const item = mInventory->getItem(
922  dragDrop.getTag());
923  const int index = getSlotByXY(event.getX(), event.getY());
924  if (index == Inventory::NO_SLOT_INDEX)
925  {
926  if (inventory != nullptr)
927  inventory->virtualRestore(item, 1);
929  return;
930  }
931  mInventory->removeItemAt(index);
932  mInventory->setItem(index,
933  item->getId(),
934  item->getType(),
935  1,
936  1,
937  item->getColor(),
938  item->getIdentified(),
939  item->getDamaged(),
940  item->getFavorite(),
941  Equipm_false,
943  Item *const item2 = mInventory->getItem(index);
944  if (item2 != nullptr)
945  item2->setTag(item->getTag());
947  }
948  else
949  {
950  if (inventory != nullptr)
951  {
952  const Item *const item = inventory->getItem(
953  dragDrop.getTag());
954  if (item != nullptr)
955  {
956  inventory->virtualRestore(item, 1);
958  }
959  }
960  return;
961  }
962  }
963  else if (src == DragDropSource::Inventory &&
964  dst == DragDropSource::Craft)
965  {
966  inventory = PlayerInfo::getInventory();
967  if (inventory != nullptr)
968  {
969  Item *const item = inventory->getItem(dragDrop.getTag());
970  if ((item == nullptr) || item->isEquipped() == Equipped_true)
971  return;
972  const int slot = getSlotByXY(event.getX(), event.getY());
973  if (item->getQuantity() > 1
975  {
979  item,
980  0,
981  slot);
982  }
983  else
984  {
986  item,
987  slot,
988  1))
989  {
990  inventory->virtualRemove(item, 1);
991  }
992  }
993  }
994  return;
995  }
996  else if (src == DragDropSource::Craft)
997  {
998  inventory = PlayerInfo::getInventory();
999  if (dst == DragDropSource::Craft)
1000  {
1001  const Item *const item = mInventory->getItem(
1002  dragDrop.getTag());
1003  const int index = getSlotByXY(event.getX(), event.getY());
1004  if (index == Inventory::NO_SLOT_INDEX)
1005  {
1006  if (inventory != nullptr)
1007  {
1008  inventory->virtualRestore(item,
1009  item->getQuantity());
1011  }
1012  return;
1013  }
1014  mInventory->moveItem(index, dragDrop.getTag());
1015  }
1016  else
1017  {
1018  if (inventory != nullptr)
1019  {
1020  const Item *const item = inventory->getItem(
1021  dragDrop.getTag());
1022  if (item != nullptr)
1023  {
1024  inventory->virtualRestore(item,
1025  item->getQuantity());
1027  }
1028  }
1029  return;
1030  }
1031  }
1032  else if (src == DragDropSource::MailEdit)
1033  {
1034  if (event.getType() == MouseEventType::RELEASED2)
1035  return;
1037  {
1038  if (mailEditWindow == nullptr)
1039  return;
1040  inventory = mailEditWindow->getInventory();
1041  if (inventory == nullptr)
1042  return;
1043  const Item *const item = inventory->getItem(dragDrop.getTag());
1044  if (item == nullptr)
1045  return;
1046  mail2Handler->removeItem(item->getTag(),
1047  item->getQuantity());
1048  }
1049  else
1050  {
1051  inventory = PlayerInfo::getInventory();
1052  if (inventory == nullptr)
1053  return;
1054  const Item *const item = inventory->getItem(dragDrop.getTag());
1055  if (item == nullptr)
1056  return;
1058  }
1059  return;
1060  }
1061 
1062  if (inventory != nullptr)
1063  {
1064  const Item *const item = inventory->getItem(dragDrop.getTag());
1065  if (item != nullptr)
1066  {
1067  if (srcContainer != InventoryType::TypeEnd)
1068  { // inventory <--> storage, cart
1069  inventoryHandler->moveItem2(srcContainer,
1070  item->getInvIndex(),
1071  item->getQuantity(),
1072  dstContainer);
1073  }
1074  else
1075  { // inventory --> trade
1076  if (!checkProtection || !PlayerInfo::isItemProtected(
1077  item->getId()))
1078  {
1079  tradeHandler->addItem(item, item->getQuantity());
1080  }
1081  }
1082  }
1083  }
1084  }
1085 }
int getInvIndex() const
Definition: item.h:164
virtual void moveItem2(const InventoryTypeT source, const int slot, const int amount, const InventoryTypeT destination) const =0
int getTag() const
Definition: item.h:230
int getTag() const
Definition: dragdrop.h:234
DragDropSource ::T DragDropSourceT
InventoryType ::T InventoryTypeT
Definition: inventorytype.h:41
Equipped isEquipped() const
Definition: item.h:128
Inventory * getInventory()
Definition: playerinfo.cpp:192
virtual void addItem(const Item *const item, const int amount) const =0
static void showWindow(const ItemAmountWindowUsageT usage, Window *const parent, Item *const item, int maxRange, const int tag)
DragDrop dragDrop
void virtualRemove(Item *const item, const int amount)
Definition: inventory.cpp:484
void moveItem(const int index1, const int index2)
Definition: inventory.cpp:536
Net::Mail2Handler * mail2Handler
Definition: net.cpp:104
const bool Equipped_true
Definition: equipped.h:29
bool isEmpty() const
Definition: dragdrop.h:195
virtual void addItem(const Item *const item, const int amount) const
Definition: tradehandler.h:51
InventoryWindow * inventoryWindow
static const int NO_SLOT_INDEX
Definition: inventory.h:57
Damaged getDamaged() const
Definition: item.h:198
void removeItemAt(const int index)
Definition: inventory.cpp:253
const bool Equipped_false
Definition: equipped.h:29
bool isActionActive(const InputActionT index) const
virtual bool addVirtualItem(const Item *const item, int index, const int amount)
Definition: inventory.cpp:438
virtual void removeItem(const int index, const int amount) const =0
virtual NpcDialog * getCurrentNpcDialog() const =0
Settings settings
Definition: settings.cpp:31
Inventory * getCartInventory()
Definition: playerinfo.cpp:204
int getQuantity() const
Definition: item.h:104
virtual void setItem(const int index, const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped)
Definition: inventory.cpp:140
void setTag(const int tag)
Definition: item.h:227
void combineItems(const int index1, const int index2)
ItemColor getColor() const
Definition: item.h:180
Definition: item.h:48
Inventory * getStorageInventory()
Definition: playerinfo.cpp:197
Net::InventoryHandler * inventoryHandler
Definition: net.cpp:82
Inventory * mInventory
ServerTypeT getNetworkType()
Definition: net.cpp:178
MouseEventTypeT getType() const
Definition: mouseevent.h:154
bool isItemProtected(const int id)
Definition: playerinfo.cpp:511
int getId() const
Definition: item.h:80
Net::TradeHandler * tradeHandler
Definition: net.cpp:91
Identified getIdentified() const
Definition: item.h:192
ItemTypeT getType() const
Definition: item.h:224
Net::NpcHandler * npcHandler
Definition: net.cpp:86
int getX() const
Definition: mouseevent.h:126
InputManager inputManager
MailEditWindow * mailEditWindow
DragDropSourceT getSource() const
Definition: dragdrop.h:83
int getSlotIndex(int x, int y) const
virtual void moveItem(const int oldIndex, const int newIndex) const =0
Item * getItem(const int index) const
Definition: inventory.cpp:82
SelectionState mSelectionStatus
int getSlotByXY(int x, int y) const
InventoryTypeT getType() const
Definition: inventory.h:175
bool enableNewMailSystem
Definition: settings.h:163
Inventory * getInventory() const
const bool Equipm_false
Definition: equipm.h:29
void virtualRestore(const Item *const item, const int amount)
Definition: inventory.cpp:516
Favorite getFavorite() const
Definition: item.h:204

◆ removeSelectionListener()

void ItemContainer::removeSelectionListener ( SelectionListener listener)
inline

Removes a listener from the list that's notified each time a change to the selection occurs.

Definition at line 116 of file itemcontainer.h.

References mSelectionListeners, setFilter(), and setSortType().

117  { mSelectionListeners.remove(listener); }
SelectionListenerList mSelectionListeners

◆ safeDraw()

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

Implements Widget.

Definition at line 455 of file itemcontainer.cpp.

References _, BLOCK_END, BLOCK_START, Graphics::drawImage(), Font::drawString(), Equipped_true, ServerCommandType::font, ForceQuantity_true, Widget::getFont(), Item::getId(), Item::getImage(), Inventory::getItem(), Item::getQuantity(), Inventory::getSize(), Font::getWidth(), Item::isEquipped(), PlayerInfo::isItemProtected(), ServerCommandType::item, mBoxHeight, mBoxWidth, mCellBackgroundImg, mDrawRows, mEquipedColor, mEquipedColor2, mEquippedTextPadding, mForceQuantity, mGridColumns, mGridRows, mInventory, mPaddingItemX, mPaddingItemY, mProtectedImg, mSelectedIndex, mSelImg, mShowEmptyRows, mShowMatrix, mUnEquipedColor, mUnEquipedColor2, Image::setAlpha(), ShowEmptyRows_true, and Catch::toString().

456 {
457  if ((mInventory == nullptr) || (mShowMatrix == nullptr))
458  return;
459 
460  BLOCK_START("ItemContainer::draw")
461  Font *const font = getFont();
462 
463  if (mCellBackgroundImg != nullptr)
464  {
465  const int invSize = mInventory->getSize();
466  const int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
467  std::max(invSize / mGridColumns, mGridRows) : mGridRows;
468  const int maxColumns = mGridColumns > invSize ?
469  invSize : mGridColumns;
470  for (int j = 0; j < maxRows; j++)
471  {
472  const int intY0 = j * mBoxHeight;
473  for (int i = 0; i < maxColumns; i++)
474  {
475  int itemX = i * mBoxWidth;
476  int itemY = intY0;
477  graphics->drawImage(mCellBackgroundImg,
478  itemX + mPaddingItemX,
479  itemY + mPaddingItemY);
480  }
481  }
482  }
483 
484  for (int j = 0; j < mDrawRows; j++)
485  {
486  const int intY0 = j * mBoxHeight;
487  int itemIndex = j * mGridColumns - 1;
488  for (int i = 0; i < mGridColumns; i++)
489  {
490  int itemX = i * mBoxWidth;
491  int itemY = intY0;
492  itemIndex ++;
493  if (mShowMatrix[itemIndex] < 0)
494  continue;
495 
496  const Item *const item = mInventory->getItem(
497  mShowMatrix[itemIndex]);
498 
499  if ((item == nullptr) || item->getId() == 0)
500  continue;
501 
502  Image *const image = item->getImage();
503  if (image != nullptr)
504  {
505  if (mShowMatrix[itemIndex] == mSelectedIndex)
506  {
507  if (mSelImg != nullptr)
508  graphics->drawImage(mSelImg, itemX, itemY);
509  }
510  image->setAlpha(1.0F); // ensure the image if fully drawn...
511  graphics->drawImage(image,
512  itemX + mPaddingItemX,
513  itemY + mPaddingItemY);
514  if ((mProtectedImg != nullptr) && PlayerInfo::isItemProtected(
515  item->getId()))
516  {
517  graphics->drawImage(mProtectedImg,
518  itemX + mPaddingItemX,
519  itemY + mPaddingItemY);
520  }
521  }
522  }
523  }
524 
525  for (int j = 0; j < mDrawRows; j++)
526  {
527  const int intY0 = j * mBoxHeight;
528  int itemIndex = j * mGridColumns - 1;
529  for (int i = 0; i < mGridColumns; i++)
530  {
531  int itemX = i * mBoxWidth;
532  int itemY = intY0;
533  itemIndex ++;
534  if (mShowMatrix[itemIndex] < 0)
535  continue;
536 
537  const Item *const item = mInventory->getItem(
538  mShowMatrix[itemIndex]);
539 
540  if ((item == nullptr) || item->getId() == 0)
541  continue;
542 
543  // Draw item caption
544  std::string caption;
545  if (item->getQuantity() > 1 ||
547  {
548  caption = toString(item->getQuantity());
549  }
550  else if (item->isEquipped() == Equipped_true)
551  {
552  // TRANSLATORS: Text under equipped items (should be small)
553  caption = _("Eq.");
554  }
555 
556  if (item->isEquipped() == Equipped_true)
557  {
558  font->drawString(graphics,
560  caption,
561  itemX + (mBoxWidth - font->getWidth(caption)) / 2,
562  itemY + mEquippedTextPadding);
563  }
564  else
565  {
566  font->drawString(graphics,
568  caption,
569  itemX + (mBoxWidth - font->getWidth(caption)) / 2,
570  itemY + mEquippedTextPadding);
571  }
572  }
573  }
574  BLOCK_END("ItemContainer::draw")
575 }
Font * getFont() const
Definition: widget.cpp:330
ForceQuantity mForceQuantity
Color mUnEquipedColor2
#define _(s)
Definition: gettext.h:34
const bool ShowEmptyRows_true
Definition: showemptyrows.h:29
Definition: font.h:88
Equipped isEquipped() const
Definition: item.h:128
#define BLOCK_START(name)
Definition: perfomance.h:78
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
const bool Equipped_true
Definition: equipped.h:29
virtual void setAlpha(const float alpha)
Definition: image.cpp:285
int getQuantity() const
Definition: item.h:104
Definition: item.h:48
Image * mCellBackgroundImg
Color mUnEquipedColor
ShowEmptyRows mShowEmptyRows
Inventory * mInventory
bool isItemProtected(const int id)
Definition: playerinfo.cpp:511
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
int getId() const
Definition: item.h:80
Image * getImage() const
Definition: item.h:86
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
Definition: image.h:61
int mEquippedTextPadding
Image * mProtectedImg
Item * getItem(const int index) const
Definition: inventory.cpp:82
const bool ForceQuantity_true
Definition: forcequantity.h:29
Color mEquipedColor2
unsigned getSize() const
Definition: inventory.h:75

◆ selectNone()

void ItemContainer::selectNone ( )

Sets selected item to NULL.

Definition at line 577 of file itemcontainer.cpp.

References DragDrop::clear(), dragDrop, mSelectionStatus, SEL_NONE, and setSelectedIndex().

Referenced by mousePressed(), mouseReleased(), InventoryWindow::unselectItem(), and TradeWindow::valueChanged().

578 {
579  dragDrop.clear();
580 
581  setSelectedIndex(-1);
583 /*
584  if (outfitWindow)
585  outfitWindow->setItemSelected(-1);
586  if (shopWindow)
587  shopWindow->setItemSelected(-1);
588 */
589 }
void clear()
Definition: dragdrop.h:182
DragDrop dragDrop
void setSelectedIndex(const int index)
SelectionState mSelectionStatus

◆ setCellBackgroundImage()

void ItemContainer::setCellBackgroundImage ( const std::string &  xmlName)

Definition at line 1314 of file itemcontainer.cpp.

References Image::decRef(), Theme::getImageFromThemeXml(), mCellBackgroundImg, and Widget::mRedraw.

Referenced by NpcDialog::placeItemInputControls(), and setInventory().

1315 {
1316  if (mCellBackgroundImg != nullptr)
1319  mRedraw = true;
1320 }
static Image * getImageFromThemeXml(const std::string &name, const std::string &name2)
Definition: theme.cpp:1135
Image * mCellBackgroundImg
bool mRedraw
Definition: widget.h:1163
void decRef()
Definition: image.cpp:521

◆ setFilter()

void ItemContainer::setFilter ( const int  tag)

Definition at line 1302 of file itemcontainer.cpp.

References adjustHeight(), and mTag.

Referenced by InventoryWindow::action(), and removeSelectionListener().

1303 {
1304  mTag = tag;
1305  adjustHeight();
1306 }

◆ setInventory()

void ItemContainer::setInventory ( Inventory *const  inventory)
inline

Definition at line 134 of file itemcontainer.h.

References mInventory, setCellBackgroundImage(), and setMaxColumns().

Referenced by NpcDialog::placeItemInputControls().

135  { mInventory = inventory; }
Inventory * mInventory

◆ setMaxColumns()

void ItemContainer::setMaxColumns ( const int  maxColumns)

Definition at line 1322 of file itemcontainer.cpp.

References mMaxColumns, and updateSize().

Referenced by NpcDialog::placeItemInputControls(), and setInventory().

1323 {
1324  mMaxColumns = maxColumns;
1325  updateSize();
1326 }

◆ setName()

void ItemContainer::setName ( const std::string &  str)
inline

Definition at line 123 of file itemcontainer.h.

References mName, ServerCommandType::str, and updateMatrix().

Referenced by InventoryWindow::action().

◆ setSelectedIndex()

void ItemContainer::setSelectedIndex ( const int  index)
private

Sets the currently selected item.

Definition at line 591 of file itemcontainer.cpp.

References distributeValueChangedEvent(), and mSelectedIndex.

Referenced by mousePressed(), and selectNone().

592 {
593  if (mSelectedIndex != newIndex)
594  {
595  mSelectedIndex = newIndex;
597  }
598 }
void distributeValueChangedEvent()

◆ setSortType()

void ItemContainer::setSortType ( const int  sortType)

Definition at line 1308 of file itemcontainer.cpp.

References mSortType, and updateMatrix().

Referenced by InventoryWindow::action(), InventoryWindow::postInit(), and removeSelectionListener().

1309 {
1310  mSortType = sortType;
1311  updateMatrix();
1312 }

◆ unsetInventory()

void ItemContainer::unsetInventory ( )
inline

Definition at line 131 of file itemcontainer.h.

References mInventory.

Referenced by InventoryWindow::unsetInventory().

132  { mInventory = nullptr; }
Inventory * mInventory

◆ updateMatrix()

int ItemContainer::updateMatrix ( )

Definition at line 1167 of file itemcontainer.cpp.

References CAST_S32, CAST_SIZE, FOR_EACH, Item::getId(), Item::getInfo(), Inventory::getItem(), ItemInfo::getName(), Item::getQuantity(), Inventory::getSize(), Item::isHaveTag(), ServerCommandType::item, anonymous_namespace{itemcontainer.cpp}::itemAlphaInvSorter, anonymous_namespace{itemcontainer.cpp}::itemAmountInvSorter, anonymous_namespace{itemcontainer.cpp}::itemIdInvSorter, anonymous_namespace{itemcontainer.cpp}::itemTypeInvSorter, anonymous_namespace{itemcontainer.cpp}::itemWeightInvSorter, mGridColumns, mGridRows, mInventory, mName, Widget::mRedraw, mShowEmptyRows, mShowMatrix, mSortType, mTag, ShowEmptyRows_true, and Catch::toLower().

Referenced by InventoryWindow::action(), adjustHeight(), setName(), setSortType(), InventoryWindow::slotsChanged(), MailViewWindow::updateItems(), and MailEditWindow::updateItems().

1168 {
1169  if (mInventory == nullptr)
1170  return 0;
1171 
1172  mRedraw = true;
1173  delete []mShowMatrix;
1175 
1176  STD_VECTOR<ItemIdPair*> sortedItems;
1177  int i = 0;
1178  int j = 0;
1179 
1180  std::string temp = mName;
1181  toLower(temp);
1182 
1183  const unsigned int invSize = mInventory->getSize();
1184  for (unsigned int idx = 0; idx < invSize; idx ++)
1185  {
1186  Item *const item = mInventory->getItem(idx);
1187 
1188  if (item == nullptr ||
1189  item->getId() == 0 ||
1190  !item->isHaveTag(mTag) ||
1191  item->getQuantity() == 0)
1192  {
1194  sortedItems.push_back(new ItemIdPair(idx, nullptr));
1195  continue;
1196  }
1197 
1198  if (!item->isHaveTag(mTag))
1199  continue;
1200 
1201  if (mName.empty())
1202  {
1203  sortedItems.push_back(new ItemIdPair(idx, item));
1204  continue;
1205  }
1206  std::string name = item->getInfo().getName();
1207  toLower(name);
1208  if (name.find(temp) != std::string::npos)
1209  sortedItems.push_back(new ItemIdPair(idx, item));
1210  }
1211 
1212  switch (mSortType)
1213  {
1214  case 0:
1215  default:
1216  break;
1217  case 1:
1218  std::sort(sortedItems.begin(), sortedItems.end(),
1220  break;
1221  case 2:
1222  std::sort(sortedItems.begin(), sortedItems.end(), itemIdInvSorter);
1223  break;
1224  case 3:
1225  std::sort(sortedItems.begin(), sortedItems.end(),
1227  break;
1228  case 4:
1229  std::sort(sortedItems.begin(), sortedItems.end(),
1231  break;
1232  case 5:
1233  std::sort(sortedItems.begin(), sortedItems.end(),
1235  break;
1236  }
1237 
1238  int jMult = j * mGridColumns;
1239  const int maxSize = mGridRows * mGridColumns;
1240  FOR_EACH (STD_VECTOR<ItemIdPair*>::const_iterator, iter, sortedItems)
1241  {
1242  if (jMult >= maxSize)
1243  break;
1244 
1245  mShowMatrix[jMult + i] = (*iter)->mId;
1246 
1247  i ++;
1248  if (i >= mGridColumns)
1249  {
1250  i = 0;
1251  j ++;
1252  jMult += mGridColumns;
1253  }
1254  }
1255 
1256  for (int idx = j * mGridColumns + i; idx < maxSize; idx ++)
1257  mShowMatrix[idx] = -1;
1258 
1259  const int num = CAST_S32(sortedItems.size());
1260  for (size_t idx = 0, sz = num; idx < sz; idx ++)
1261  delete sortedItems[idx];
1262  return num;
1263 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
const bool ShowEmptyRows_true
Definition: showemptyrows.h:29
class anonymous_namespace{itemcontainer.cpp}::SortItemIdFunctor itemIdInvSorter
class anonymous_namespace{itemcontainer.cpp}::SortItemAlphaFunctor itemAlphaInvSorter
std::string mName
class anonymous_namespace{itemcontainer.cpp}::SortItemTypeFunctor itemTypeInvSorter
const std::string & getName() const
Definition: iteminfo.h:73
class anonymous_namespace{itemcontainer.cpp}::SortItemAmountFunctor itemAmountInvSorter
#define CAST_S32
Definition: cast.h:29
int getQuantity() const
Definition: item.h:104
Definition: item.h:48
std::string toLower(std::string const &s)
const ItemInfo & getInfo() const
Definition: item.h:170
ShowEmptyRows mShowEmptyRows
Inventory * mInventory
class anonymous_namespace{itemcontainer.cpp}::SortItemWeightFunctor itemWeightInvSorter
int getId() const
Definition: item.h:80
bool mRedraw
Definition: widget.h:1163
#define CAST_SIZE
Definition: cast.h:33
bool isHaveTag(const int tagId) const
Definition: item.cpp:118
Item * getItem(const int index) const
Definition: inventory.cpp:82
unsigned getSize() const
Definition: inventory.h:75

◆ updateSize()

void ItemContainer::updateSize ( )
private

Definition at line 1116 of file itemcontainer.cpp.

References adjustHeight(), mBoxWidth, Widget::mDimension, mGridColumns, mMaxColumns, Widget::mRedraw, and Rect::width.

Referenced by setMaxColumns(), and widgetResized().

1117 {
1118  mGridColumns = std::min(mMaxColumns,
1119  std::max(1, mDimension.width / mBoxWidth));
1120  if (mGridColumns > mMaxColumns)
1122  adjustHeight();
1123  mRedraw = true;
1124 }
int width
Definition: rect.h:218
bool mRedraw
Definition: widget.h:1163
Rect mDimension
Definition: widget.h:1100

◆ widgetMoved()

void ItemContainer::widgetMoved ( const Event event)
virtual

Invoked when a widget is moved.

Parameters
eventDescribes the event.

Reimplemented from WidgetListener.

Definition at line 1126 of file itemcontainer.cpp.

References Widget::mRedraw.

1127 {
1128  mRedraw = true;
1129 }
bool mRedraw
Definition: widget.h:1163

◆ widgetResized()

void ItemContainer::widgetResized ( const Event event)
virtual

Invoked when a widget changes its size.

Parameters
eventDescribes the event.

Reimplemented from WidgetListener.

Definition at line 1111 of file itemcontainer.cpp.

References updateSize().

1112 {
1113  updateSize();
1114 }

Field Documentation

◆ mBoxHeight

int ItemContainer::mBoxHeight
private

Definition at line 212 of file itemcontainer.h.

Referenced by adjustHeight(), draw(), getSlotByXY(), getSlotIndex(), and safeDraw().

◆ mBoxWidth

int ItemContainer::mBoxWidth
private

Definition at line 211 of file itemcontainer.h.

Referenced by draw(), getSlotByXY(), getSlotIndex(), safeDraw(), and updateSize().

◆ mCellBackgroundImg

Image* ItemContainer::mCellBackgroundImg
private

Definition at line 190 of file itemcontainer.h.

Referenced by draw(), safeDraw(), setCellBackgroundImage(), and ~ItemContainer().

◆ mClicks

int ItemContainer::mClicks
private

Definition at line 210 of file itemcontainer.h.

Referenced by getClickCount(), mousePressed(), and mouseReleased().

◆ mDescItems

bool ItemContainer::mDescItems
private

Definition at line 220 of file itemcontainer.h.

Referenced by mousePressed().

◆ mDrawRows

int ItemContainer::mDrawRows
private

Definition at line 205 of file itemcontainer.h.

Referenced by adjustHeight(), draw(), and safeDraw().

◆ mEquipedColor

Color ItemContainer::mEquipedColor
private

Definition at line 196 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mEquipedColor2

Color ItemContainer::mEquipedColor2
private

Definition at line 197 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mEquippedTextPadding

int ItemContainer::mEquippedTextPadding
private

Definition at line 213 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mForceQuantity

ForceQuantity ItemContainer::mForceQuantity
private

Definition at line 218 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mGridColumns

int ItemContainer::mGridColumns
private

◆ mGridRows

int ItemContainer::mGridRows
private

Definition at line 204 of file itemcontainer.h.

Referenced by adjustHeight(), draw(), getSlotByXY(), getSlotIndex(), safeDraw(), and updateMatrix().

◆ mInventory

Inventory* ItemContainer::mInventory
private

◆ mLastUsedSlot

int ItemContainer::mLastUsedSlot
private

Definition at line 207 of file itemcontainer.h.

Referenced by adjustHeight(), and logic().

◆ mMaxColumns

int ItemContainer::mMaxColumns
private

Definition at line 216 of file itemcontainer.h.

Referenced by setMaxColumns(), and updateSize().

◆ mName

std::string ItemContainer::mName
private

Definition at line 191 of file itemcontainer.h.

Referenced by setName(), and updateMatrix().

◆ mPaddingItemX

int ItemContainer::mPaddingItemX
private

Definition at line 214 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mPaddingItemY

int ItemContainer::mPaddingItemY
private

Definition at line 215 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mProtectedImg

Image* ItemContainer::mProtectedImg
private

Definition at line 189 of file itemcontainer.h.

Referenced by draw(), safeDraw(), and ~ItemContainer().

◆ mSelectedIndex

int ItemContainer::mSelectedIndex
private

◆ mSelectionListeners

SelectionListenerList ItemContainer::mSelectionListeners
private

◆ mSelectionStatus

SelectionState ItemContainer::mSelectionStatus
private

Definition at line 217 of file itemcontainer.h.

Referenced by mouseDragged(), mousePressed(), mouseReleased(), and selectNone().

◆ mSelImg

Image* ItemContainer::mSelImg
private

Definition at line 188 of file itemcontainer.h.

Referenced by draw(), safeDraw(), and ~ItemContainer().

◆ mShowEmptyRows

ShowEmptyRows ItemContainer::mShowEmptyRows
private

Definition at line 219 of file itemcontainer.h.

Referenced by adjustHeight(), draw(), safeDraw(), and updateMatrix().

◆ mShowMatrix

int* ItemContainer::mShowMatrix
private

Definition at line 193 of file itemcontainer.h.

Referenced by draw(), getSlotByXY(), getSlotIndex(), safeDraw(), updateMatrix(), and ~ItemContainer().

◆ mSkin

Skin* ItemContainer::mSkin
private

Definition at line 194 of file itemcontainer.h.

Referenced by ~ItemContainer().

◆ mSortType

int ItemContainer::mSortType
private

Definition at line 209 of file itemcontainer.h.

Referenced by setSortType(), and updateMatrix().

◆ mTag

int ItemContainer::mTag
private

Definition at line 208 of file itemcontainer.h.

Referenced by setFilter(), and updateMatrix().

◆ mUnEquipedColor

Color ItemContainer::mUnEquipedColor
private

Definition at line 198 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mUnEquipedColor2

Color ItemContainer::mUnEquipedColor2
private

Definition at line 199 of file itemcontainer.h.

Referenced by draw(), and safeDraw().

◆ mVertexes

ImageCollection* ItemContainer::mVertexes
private

Definition at line 195 of file itemcontainer.h.

Referenced by draw(), and ~ItemContainer().


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