2828#include " ekg/io/descriptor.hpp"
2929#include " ekg/io/utf.hpp"
3030#include " ekg/io/font.hpp"
31+ #include " ekg/ui/property.hpp"
3132
3233namespace ekg {
3334 struct textbox_color_scheme_t {
@@ -39,6 +40,7 @@ namespace ekg {
3940 ekg::rgba_t <float > text_cursor_foreground {};
4041 ekg::pixel_thickness_t cursor_thickness {2 };
4142 bool caret_cursor {};
43+ ekg::pixel_thickness_t gutter_margin {2 };
4244 };
4345
4446 struct textbox_t {
@@ -51,38 +53,39 @@ namespace ekg {
5153
5254 struct cursor_t {
5355 public:
54- size_t index_a {};
55- size_t index_b {};
56+ ekg:: vec2_t < size_t > a {};
57+ ekg:: vec2_t < size_t > b {};
5658 ekg::rect_t <float > rect {};
5759 public:
58- bool operator == (size_t index) {
59- return index == this ->index_a && index == this ->index_b ;
60+ bool operator == (const ekg:: vec2_t < size_t > & index) {
61+ return index. x == this ->a . x && index. y == this ->a . y && index. x == this -> b . x && index. y == this -> b . y ;
6062 }
6163
62- bool operator > (size_t index) {
63- return index > this ->index_a ;
64+ bool operator > (const ekg:: vec2_t < size_t > & index) {
65+ return ( index. x > this ->a . x && index. y == this -> a . y ) || (index. y > this -> a . y ) ;
6466 }
6567
66- bool operator >= (size_t index) {
67- return index >= this ->index_a ;
68+ bool operator >= (const ekg:: vec2_t < size_t > & index) {
69+ return ( index. x >= this ->a . x && index. y == this -> a . y ) || (index. y > this -> a . y ) ;
6870 }
6971
70- bool operator < (size_t index) {
71- return index < this ->index_b ;
72+ bool operator < (const ekg:: vec2_t < size_t > & index) {
73+ return ( index. x < this ->b . x && index. y == this -> b . y ) || (index. y < this -> b . y ) ;
7274 }
7375
74- bool operator <= (size_t index) {
75- return index <= this ->index_b ;
76+ bool operator <= (const ekg:: vec2_t < size_t > & index) {
77+ return ( index. x <= this ->b . x && index. y == this -> b . y ) || (index. y < this -> b . y ) ;
7678 }
7779
7880 bool operator == (const ekg::textbox_t ::cursor_t &cursor) {
79- return this -> index_a == cursor.index_a && this -> index_b == cursor.index_b ;
81+ return * this == cursor.a && * this == cursor.b ;
8082 }
8183 };
8284
8385 struct widget_t {
8486 public:
8587 ekg::rect_t <float > rect_text_size {};
88+ ekg::property_t scrollbar_property {};
8689 ekg::scrollbar_t scrollbar {};
8790 std::vector<ekg::textbox_t ::cursor_t > cursors {};
8891 std::vector<ekg::textbox_t ::select_draw_layer_t > layers_select {};
0 commit comments