vkdoom_m/include/zwidget/widgets/textlabel/textlabel.h
Rachael Alexanderson d9b2c00228 Squashed 'libraries/ZWidget/' content from commit 96501b6ef1
git-subtree-dir: libraries/ZWidget
git-subtree-split: 96501b6ef11e8737cd8ccb2451395115b810dfcc
2025-07-30 00:09:28 -04:00

33 lines
584 B
C++

#pragma once
#include "../../core/widget.h"
enum class TextLabelAlignment
{
Left,
Center,
Right
};
class TextLabel : public Widget
{
public:
TextLabel(Widget* parent = nullptr);
void SetText(const std::string& value);
const std::string& GetText() const;
void SetTextAlignment(TextLabelAlignment alignment);
TextLabelAlignment GetTextAlignment() const;
double GetPreferredWidth() const;
double GetPreferredHeight() const;
protected:
void OnPaint(Canvas* canvas) override;
private:
std::string text;
TextLabelAlignment textAlignment = TextLabelAlignment::Left;
};