bWidgets
Core widget toolkit designed for Blender
bwLabel.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
5#include "bwColor.h"
6#include "bwWidget.h"
7
8namespace bWidgets {
9
10class bwIconInterface;
11
12class bwLabel : public bwWidget {
13 public:
14 bwLabel(std::string text = "",
15 std::optional<unsigned int> width_hint = std::nullopt,
16 std::optional<unsigned int> height_hint = std::nullopt);
17
18 auto getTypeIdentifier() const -> std::string_view override;
19
20 void draw(bwStyle& style) override;
21 void registerProperties() override;
22 auto createHandler() -> std::unique_ptr<bwScreenGraph::EventHandler> override;
23
24 auto getLabel() const -> const std::string* override;
25 auto setLabel(const std::string&) -> bwLabel&;
26 auto setIcon(const bwIconInterface& icon_interface) -> bwLabel&;
27
28 private:
29 std::string text;
30 const class bwIconInterface* icon{nullptr};
31
32 bwColor text_color;
33};
34
35} // namespace bWidgets
Definition: bwColor.h:5
Interface to reference icons from within bWidgets.
Definition: bwIconInterface.h:22
Definition: bwLabel.h:12
auto setIcon(const bwIconInterface &icon_interface) -> bwLabel &
Definition: bwLabel.cc:53
auto createHandler() -> std::unique_ptr< bwScreenGraph::EventHandler > override
Definition: bwLabel.cc:48
auto getTypeIdentifier() const -> std::string_view override
Definition: bwLabel.cc:18
auto getLabel() const -> const std::string *override
Definition: bwLabel.cc:37
bwLabel(std::string text="", std::optional< unsigned int > width_hint=std::nullopt, std::optional< unsigned int > height_hint=std::nullopt)
Definition: bwLabel.cc:10
void registerProperties() override
Definition: bwLabel.cc:32
auto setLabel(const std::string &) -> bwLabel &
Definition: bwLabel.cc:42
void draw(bwStyle &style) override
Definition: bwLabel.cc:23
Definition: bwStyle.h:10
Abstract base class that all widgets derive from.
Definition: bwWidget.h:22
unsigned int height_hint
Definition: bwWidget.h:68
unsigned int width_hint
Definition: bwWidget.h:68
Definition: bwContext.h:3