36#include <guichan/font.hpp>
37#include <guichan/listmodel.hpp>
50 mShopItems(shopListModel)
78 highlightColor.a = alpha;
79 warningColor.a = alpha;
84 const int fontHeight = getFont()->
getHeight();
87 for (
int i = 0, y = 0;
88 i < mListModel->getNumberOfElements();
93 if (shopItem && mPlayerMoney < shopItem->getPrice() &&
mPriceCheck)
101 gcn::Color blend = warningColor;
102 blend.r = (blend.r + highlightColor.r) / 2;
103 blend.g = (blend.g + highlightColor.g) / 2;
104 blend.b = (blend.b + highlightColor.b) / 2;
110 else if (i == mSelected)
120 icon->setAlpha(1.0f);
145 setHeight(
mRowHeight * mListModel->getNumberOfElements());
A central point of control for graphics.
int getHeight() const
Returns the logical height of the screen.
void drawText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, const gcn::Color &color, gcn::Font *font, bool outline=false, bool shadow=false, const std::optional< gcn::Color > &outlineColor={}, const std::optional< gcn::Color > &shadowColor={})
void setColor(const gcn::Color &color) override
bool drawImage(const Image *image, int x, int y)
Blits an image onto the screen.
Defines a class for loading and storing images.
Represents one or more instances of a certain item type.
int getQuantity() const
Returns the number of items.
Image * getImage() const
Returns the item image.
A list box, meant to be used inside a scroll area.
Represents an item in a shop inventory.
This class handles the list of items available in a shop.
ShopItem * at(int i) const
Returns the item number i in the shop.
int getNumberOfElements() override
Returns the number of items in the shop.
ShopListBox(gcn::ListModel *listModel)
void draw(gcn::Graphics *graphics) override
Draws the list box.
void setPriceCheck(bool check)
Set on/off the disabling of too expensive items.
void setPlayersMoney(int money)
gives information about the current player's money
void mouseMoved(gcn::MouseEvent &event) override
Show ItemTooltip.
void mouseExited(gcn::MouseEvent &event) override
Hide ItemTooltip.
unsigned int mRowHeight
Row Height.
ShopItems * mShopItems
Keeps another pointer to the same listModel, permitting to use the ShopItems specific functions.
void adjustSize()
Adjust List draw size.
static const gcn::Color & getThemeColor(int type)
Gets the color associated with the type in the default palette (0).
int getMouseY() const
Returns mouse y in pixels.
int getMouseX() const
Returns mouse x in pixels.
Config config
Global settings (config.xml)
Viewport * viewport
Viewport on the map.
std::string toString(const T &arg)
Converts the given value to a string using std::stringstream.