aboutsummaryrefslogtreecommitdiff
path: root/CruUI/ui/controls/text_block.h
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-21 22:53:12 +0800
committercrupest <crupest@outlook.com>2018-09-21 22:53:12 +0800
commit82a45e611a2638cff7e3fffc09ba4569ca53a274 (patch)
tree69d6eb024b9aa35949761d6e75df28717ff02e35 /CruUI/ui/controls/text_block.h
parent5f7d3268e3d2ea84a1afc97c209b703bf4092c76 (diff)
downloadcru-82a45e611a2638cff7e3fffc09ba4569ca53a274.tar.gz
cru-82a45e611a2638cff7e3fffc09ba4569ca53a274.tar.bz2
cru-82a45e611a2638cff7e3fffc09ba4569ca53a274.zip
Add selectable switch in text block.
Diffstat (limited to 'CruUI/ui/controls/text_block.h')
-rw-r--r--CruUI/ui/controls/text_block.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/CruUI/ui/controls/text_block.h b/CruUI/ui/controls/text_block.h
index dce83427..b05e7ff2 100644
--- a/CruUI/ui/controls/text_block.h
+++ b/CruUI/ui/controls/text_block.h
@@ -1,6 +1,7 @@
#pragma once
#include <memory>
+#include <optional>
#include "ui/control.h"
@@ -86,6 +87,20 @@ namespace cru
void RemoveTextLayoutHandler(const TextLayoutHandlerPtr& handler);
+ bool IsSelectable() const
+ {
+ return is_selectable_;
+ }
+
+ void SetSelectable(bool is_selectable);
+
+ std::optional<TextRange> GetSelectedRange() const
+ {
+ return selected_range_;
+ }
+
+ void SetSelectedRange(std::optional<TextRange> text_range);
+
protected:
void OnSizeChangedCore(events::SizeChangedEventArgs& args) override final;
void OnDraw(ID2D1DeviceContext* device_context) override;
@@ -114,6 +129,8 @@ namespace cru
Vector<TextLayoutHandlerPtr> text_layout_handlers_;
+ bool is_selectable_ = false;
+
bool is_selecting_ = false;
unsigned mouse_down_position_ = 0;
std::optional<TextRange> selected_range_ = std::nullopt;