| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/gui/graph_element.h" |
| 34 |
|
| 35 |
class HBoxContainer; |
| 36 |
|
| 37 |
class GraphFrame : public GraphElement { |
| 38 |
GDCLASS(GraphFrame, GraphElement); |
| 39 |
|
| 40 |
struct ThemeCache { |
| 41 |
Ref<StyleBox> panel; |
| 42 |
Ref<StyleBox> panel_selected; |
| 43 |
Ref<StyleBox> titlebar; |
| 44 |
Ref<StyleBox> titlebar_selected; |
| 45 |
|
| 46 |
Ref<Texture2D> resizer; |
| 47 |
Color resizer_color; |
| 48 |
} theme_cache; |
| 49 |
|
| 50 |
private: |
| 51 |
String title; |
| 52 |
|
| 53 |
HBoxContainer *titlebar_hbox = nullptr; |
| 54 |
Label *title_label = nullptr; |
| 55 |
|
| 56 |
bool autoshrink_enabled = true; |
| 57 |
int autoshrink_margin = 40; |
| 58 |
int drag_margin = 16; |
| 59 |
|
| 60 |
bool tint_color_enabled = false; |
| 61 |
Color tint_color = Color(0.3, 0.3, 0.3, 0.75); |
| 62 |
|
| 63 |
protected: |
| 64 |
virtual void gui_input(const Ref<InputEvent> &p_event) override; |
| 65 |
virtual CursorShape get_cursor_shape(const Point2 &p_pos = Point2i()) const override; |
| 66 |
|
| 67 |
void _notification(int p_what); |
| 68 |
static void _bind_methods(); |
| 69 |
|
| 70 |
void _validate_property(PropertyInfo &p_property) const; |
| 71 |
|
| 72 |
virtual void _resort() override; |
| 73 |
|
| 74 |
public: |
| 75 |
void set_title(const String &p_title); |
| 76 |
String get_title() const; |
| 77 |
|
| 78 |
void set_autoshrink_enabled(bool p_enable); |
| 79 |
bool is_autoshrink_enabled() const; |
| 80 |
|
| 81 |
void set_autoshrink_margin(const int &p_margin); |
| 82 |
int get_autoshrink_margin() const; |
| 83 |
|
| 84 |
HBoxContainer *get_titlebar_hbox(); |
| 85 |
Size2 get_titlebar_size() const; |
| 86 |
|
| 87 |
void set_drag_margin(int p_margin); |
| 88 |
int get_drag_margin() const; |
| 89 |
|
| 90 |
void set_tint_color_enabled(bool p_enable); |
| 91 |
bool is_tint_color_enabled() const; |
| 92 |
|
| 93 |
void set_tint_color(const Color &p_tint_color); |
| 94 |
Color get_tint_color() const; |
| 95 |
|
| 96 |
virtual bool has_point(const Point2 &p_point) const override; |
| 97 |
virtual Size2 get_minimum_size() const override; |
| 98 |
|
| 99 |
GraphFrame(); |
| 100 |
}; |