text cursor in text editor & const in Rect2i
This commit is contained in:
parent
ec4ef2d2e7
commit
a49527540f
3 changed files with 14 additions and 5 deletions
|
@ -272,7 +272,7 @@ struct Rect2 {
|
||||||
|
|
||||||
return new_rect;
|
return new_rect;
|
||||||
};
|
};
|
||||||
bool has_point(const Point2& p_point) const {
|
inline bool has_point(const Point2& p_point) const {
|
||||||
if (p_point.x < pos.x)
|
if (p_point.x < pos.x)
|
||||||
return false;
|
return false;
|
||||||
if (p_point.y < pos.y)
|
if (p_point.y < pos.y)
|
||||||
|
@ -286,12 +286,12 @@ struct Rect2 {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool no_area() const { return (size.width<=0 || size.height<=0 ); }
|
inline bool no_area() const { return (size.width<=0 || size.height<=0 ); }
|
||||||
|
|
||||||
bool operator==(const Rect2& p_rect) const { return pos==p_rect.pos && size==p_rect.size; }
|
bool operator==(const Rect2& p_rect) const { return pos==p_rect.pos && size==p_rect.size; }
|
||||||
bool operator!=(const Rect2& p_rect) const { return pos!=p_rect.pos || size!=p_rect.size; }
|
bool operator!=(const Rect2& p_rect) const { return pos!=p_rect.pos || size!=p_rect.size; }
|
||||||
|
|
||||||
Rect2 grow(real_t p_by) const {
|
inline Rect2 grow(real_t p_by) const {
|
||||||
|
|
||||||
Rect2 g=*this;
|
Rect2 g=*this;
|
||||||
g.pos.x-=p_by;
|
g.pos.x-=p_by;
|
||||||
|
@ -463,7 +463,7 @@ struct Rect2i {
|
||||||
|
|
||||||
return new_rect;
|
return new_rect;
|
||||||
};
|
};
|
||||||
bool has_point(const Point2& p_point) {
|
bool has_point(const Point2& p_point) const {
|
||||||
if (p_point.x < pos.x)
|
if (p_point.x < pos.x)
|
||||||
return false;
|
return false;
|
||||||
if (p_point.y < pos.y)
|
if (p_point.y < pos.y)
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#define TAB_PIXELS
|
#define TAB_PIXELS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool _is_text_char(CharType c) {
|
static bool _is_text_char(CharType c) {
|
||||||
|
|
||||||
return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_';
|
return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_';
|
||||||
|
@ -2038,6 +2037,14 @@ void TextEdit::insert_text_at_cursor(const String& p_text) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Control::CursorShape TextEdit::get_cursor_shape(const Point2& p_pos) const {
|
||||||
|
if(completion_active && completion_rect.has_point(p_pos)) {
|
||||||
|
return CURSOR_ARROW;
|
||||||
|
}
|
||||||
|
return CURSOR_IBEAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TextEdit::set_text(String p_text){
|
void TextEdit::set_text(String p_text){
|
||||||
|
|
||||||
setting_text=true;
|
setting_text=true;
|
||||||
|
|
|
@ -280,6 +280,8 @@ public:
|
||||||
SEARCH_WHOLE_WORDS=2,
|
SEARCH_WHOLE_WORDS=2,
|
||||||
SEARCH_BACKWARDS=4
|
SEARCH_BACKWARDS=4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual CursorShape get_cursor_shape(const Point2& p_pos=Point2i()) const;
|
||||||
|
|
||||||
//void delete_char();
|
//void delete_char();
|
||||||
//void delete_line();
|
//void delete_line();
|
||||||
|
|
Loading…
Reference in a new issue