33#include <guichan/font.hpp>
43 auto rowHeight = ListBox::getRowHeight();
46 if (
auto onlineIcon = theme->getIcon(
"online"))
47 rowHeight = std::max<unsigned>(rowHeight, onlineIcon->getHeight() + 2);
70 graphics->fillRectangle(gcn::Rectangle(0, rowHeight * mSelected,
71 getWidth(), rowHeight));
75 auto onlineIcon = theme->
getIcon(
"online");
76 auto offlineIcon = theme->getIcon(
"offline");
79 for (
int i = 0, y = 0;
80 i < model->getNumberOfElements();
88 Avatar *a = model->getAvatarAt(i);
95 x += icon->getWidth() + 4;
123 if (event.getButton() == gcn::MouseEvent::LEFT)
128 else if (event.getButton() == gcn::MouseEvent::RIGHT)
void mousePressed(gcn::MouseEvent &event) override
AvatarListBox(AvatarListModel *model)
unsigned int getRowHeight() const override
void draw(gcn::Graphics *gcnGraphics) override
Draws the list box.
bool getOnline() const
Returns the avatar's online status.
const std::string & getName() const
Returns the avatar's name.
bool getDisplayBold() const
A central point of control for graphics.
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.
Theme * getTheme() const
The global GUI theme.
Defines a class for loading and storing images.
A list box, meant to be used inside a scroll area.
void mousePressed(gcn::MouseEvent &mouseEvent) override
int getGuiAlpha() const
Get the current GUI alpha value.
static const gcn::Color & getThemeColor(int type)
Gets the color associated with the type in the default palette (0).
const Image * getIcon(const std::string &name) const
gcn::Font * boldFont
Bolded text font.
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.