aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/components/PopupButton.h6
-rw-r--r--include/cru/ui/controls/TextBlock.h9
-rw-r--r--include/cru/ui/render/TextRenderObject.h2
3 files changed, 17 insertions, 0 deletions
diff --git a/include/cru/ui/components/PopupButton.h b/include/cru/ui/components/PopupButton.h
index 38109fbe..37420ff6 100644
--- a/include/cru/ui/components/PopupButton.h
+++ b/include/cru/ui/components/PopupButton.h
@@ -15,9 +15,15 @@ class CRU_UI_API PopupMenuTextButton : public Component {
public:
ui::controls::Control* GetRootControl() override { return &button_; }
+ ui::controls::Button* GetButton() { return &button_; }
+
String GetButtonText() { return button_text_.GetText(); }
void SetButtonText(String text) { button_text_.SetText(std::move(text)); }
+ void SetButtonTextColor(const Color& color) {
+ button_text_.SetTextColor(color);
+ }
+
void SetMenuItems(std::vector<String> items);
IEvent<Index>* MenuItemSelectedEvent() { return &menu_item_selected_event_; }
diff --git a/include/cru/ui/controls/TextBlock.h b/include/cru/ui/controls/TextBlock.h
index dc47d00a..e43d472f 100644
--- a/include/cru/ui/controls/TextBlock.h
+++ b/include/cru/ui/controls/TextBlock.h
@@ -3,6 +3,7 @@
#include "../render/TextRenderObject.h"
#include "TextHostControlService.h"
+#include "cru/platform/graphics/Brush.h"
namespace cru::ui::controls {
class CRU_UI_API TextBlock : public NoChildControl,
@@ -33,6 +34,14 @@ class CRU_UI_API TextBlock : public NoChildControl,
bool IsSelectable() const;
void SetSelectable(bool value);
+ std::shared_ptr<platform::graphics::IBrush> GetTextBrush() const {
+ return text_render_object_->GetBrush();
+ }
+ void SetTextBrush(std::shared_ptr<platform::graphics::IBrush> brush) {
+ text_render_object_->SetBrush(std::move(brush));
+ }
+ void SetTextColor(const Color& color);
+
gsl::not_null<render::TextRenderObject*> GetTextRenderObject() override;
render::ScrollRenderObject* GetScrollRenderObject() override {
return nullptr;
diff --git a/include/cru/ui/render/TextRenderObject.h b/include/cru/ui/render/TextRenderObject.h
index 079c5680..16aff29d 100644
--- a/include/cru/ui/render/TextRenderObject.h
+++ b/include/cru/ui/render/TextRenderObject.h
@@ -1,6 +1,7 @@
#pragma once
#include "RenderObject.h"
+#include <memory>
#include <string>
namespace cru::ui::render {
@@ -37,6 +38,7 @@ class CRU_UI_API TextRenderObject : public RenderObject {
String GetText() const;
void SetText(String new_text);
+ std::shared_ptr<platform::graphics::IBrush> GetBrush() { return brush_; }
void SetBrush(std::shared_ptr<platform::graphics::IBrush> new_brush);
std::shared_ptr<platform::graphics::IFont> GetFont() const;