aboutsummaryrefslogtreecommitdiff
path: root/include/cru/ui
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/ui')
-rw-r--r--include/cru/ui/control.hpp6
-rw-r--r--include/cru/ui/controls/text_box.hpp6
-rw-r--r--include/cru/ui/render/scroll_render_object.hpp30
3 files changed, 36 insertions, 6 deletions
diff --git a/include/cru/ui/control.hpp b/include/cru/ui/control.hpp
index 30dc589a..d66405e6 100644
--- a/include/cru/ui/control.hpp
+++ b/include/cru/ui/control.hpp
@@ -147,12 +147,6 @@ class Control : public Object {
private:
bool is_mouse_over_ = false;
- struct {
- bool left;
- bool middle;
- bool right;
- } click_map_;
-
std::shared_ptr<platform::native::ICursor> cursor_ = nullptr;
};
} // namespace cru::ui
diff --git a/include/cru/ui/controls/text_box.hpp b/include/cru/ui/controls/text_box.hpp
index c0160658..15fcb734 100644
--- a/include/cru/ui/controls/text_box.hpp
+++ b/include/cru/ui/controls/text_box.hpp
@@ -2,6 +2,8 @@
#include "../no_child_control.hpp"
#include "base.hpp"
+#include <memory>
+
namespace cru::ui::controls {
template <typename TControl>
class TextControlService;
@@ -10,6 +12,8 @@ class TextBox : public NoChildControl {
public:
static constexpr std::string_view control_type = "TextBox";
+ static TextBox* Create() { return new TextBox(); }
+
protected:
TextBox();
@@ -21,6 +25,8 @@ class TextBox : public NoChildControl {
std::string_view GetControlType() const final { return control_type; }
+ render::RenderObject* GetRenderObject() const override;
+
render::TextRenderObject* GetTextRenderObject();
const TextBoxBorderStyle& GetBorderStyle();
diff --git a/include/cru/ui/render/scroll_render_object.hpp b/include/cru/ui/render/scroll_render_object.hpp
new file mode 100644
index 00000000..1527db6c
--- /dev/null
+++ b/include/cru/ui/render/scroll_render_object.hpp
@@ -0,0 +1,30 @@
+#pragma once
+#include "render_object.hpp"
+
+#include "cru/platform/graph/util/painter.hpp"
+
+namespace cru::ui::render {
+class ScrollRenderObject : public RenderObject {
+ public:
+ ScrollRenderObject() : RenderObject(ChildMode::Single) {}
+
+ CRU_DELETE_COPY(ScrollRenderObject)
+ CRU_DELETE_MOVE(ScrollRenderObject)
+
+ ~ScrollRenderObject() override = default;
+
+ void Draw(platform::graph::IPainter* painter) override;
+
+ RenderObject* HitTest(const Point& point) override;
+
+ Point GetScrollOffset() { return scroll_offset_; }
+ void SetScrollOffset(const Point& offset);
+
+ protected:
+ void OnAddChild(RenderObject* new_child, Index position) override;
+ void OnRemoveChild(RenderObject* removed_child, Index position) override;
+
+ private:
+ Point scroll_offset_;
+};
+} // namespace cru::ui::render