5#include "fifechan/widgets/menuitem.hpp"
13#include "fifechan/font.hpp"
14#include "fifechan/graphics.hpp"
37 if (popup !=
nullptr) {
38 mType = Type::Submenu;
123 if (
mType == Type::Separator) {
144 unsigned char const first =
static_cast<unsigned char>(
mIconGlyph.at(0));
145 if (first >= 0xF0 || first == 0xE2) {
153 }
else if (
mIcon !=
nullptr) {
177 Graphics::Alignment::Right);
181 if (
mType == Type::Submenu) {
200 }
else if (
mIcon !=
nullptr) {
202 textX +=
mIcon->getWidth() + 4;
227 graphics->
drawText(
"[x]", 4, textY, Graphics::Alignment::Left);
231 if (
mType == Type::Submenu) {
245 if (
mType == Type::Separator) {
251 if (
mIcon !=
nullptr) {
259 }
else if (
mType == Type::Checkable) {
261 m.
iconW = font.getWidth(
"[x]");
275 if (
mType == Type::Submenu) {
276 m.
arrowW = font.getWidth(
" >") + 8;
280 int contentH = font.getHeight();
281 if (
mIcon !=
nullptr) {
282 contentH = std::max(contentH,
mIcon->getHeight());
286 contentH = std::max(contentH, iconFontH);
290 m.
height = contentH + vpad;
Abstract interface for font rendering.
virtual int getWidth(std::string const &text) const =0
Gets the width of a string.
virtual int getHeight() const =0
Gets the height of the glyphs in the font.
Abstract interface providing primitive drawing functions (lines, rectangles, etc.).
virtual void drawImage(Image const *image, int srcX, int srcY, int dstX, int dstY, int width, int height)=0
Draws a part of an image.
void drawText(std::string const &text, int x, int y)
Draws text with a default left alignment.
virtual void setFont(Font *font)
Sets the font to use when drawing text.
virtual void setColor(Color const &color)=0
Sets the color to use when drawing.
virtual void fillRectangle(Rectangle const &rectangle)=0
Draws a filled rectangle.
Abstract holder for image data.
Represents a rectangular area (X, Y, Width, Height).
Used replacement tokens by configure_file():
Column layout specification passed to items for rendering.