Debian Codegraph @

scene/gui/graph_frame.h

raw symbols SCIP
1 /**************************************************************************/
2 /* graph_frame.h */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
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 };