Debian Codegraph @

scene/resources/style_box_flat.h

raw symbols SCIP
1 /**************************************************************************/
2 /* style_box_flat.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/resources/style_box.h"
34
35 class StyleBoxFlat : public StyleBox {
36 GDCLASS(StyleBoxFlat, StyleBox);
37
38 Color bg_color = Color(0.6, 0.6, 0.6);
39 Color shadow_color = Color(0, 0, 0, 0.6);
40 Color border_color = Color(0.8, 0.8, 0.8);
41
42 real_t border_width[4] = {};
43 real_t expand_margin[4] = {};
44 real_t corner_radius[4] = {};
45
46 bool draw_center = true;
47 bool blend_border = false;
48 Vector2 skew;
49 bool anti_aliased = true;
50
51 int corner_detail = 8;
52 int shadow_size = 0;
53 Point2 shadow_offset;
54 real_t aa_size = 1;
55
56 protected:
57 virtual float get_style_margin(Side p_side) const override;
58 static void _bind_methods();
59 void _validate_property(PropertyInfo &p_property) const;
60
61 public:
62 void set_bg_color(const Color &p_color);
63 Color get_bg_color() const;
64
65 void set_border_color(const Color &p_color);
66 Color get_border_color() const;
67
68 void set_border_width_all(int p_size);
69 int get_border_width_min() const;
70
71 void set_border_width(Side p_side, int p_width);
72 int get_border_width(Side p_side) const;
73
74 void set_border_blend(bool p_blend);
75 bool get_border_blend() const;
76
77 void set_corner_radius_all(int radius);
78 void set_corner_radius_individual(const int radius_top_left, const int radius_top_right, const int radius_bottom_right, const int radius_bottom_left);
79 void set_corner_radius(Corner p_corner, const int radius);
80 int get_corner_radius(Corner p_corner) const;
81
82 void set_corner_detail(const int &p_corner_detail);
83 int get_corner_detail() const;
84
85 void set_expand_margin(Side p_expand_side, float p_size);
86 void set_expand_margin_all(float p_expand_margin_size);
87 void set_expand_margin_individual(float p_left, float p_top, float p_right, float p_bottom);
88 float get_expand_margin(Side p_expand_side) const;
89
90 void set_draw_center(bool p_enabled);
91 bool is_draw_center_enabled() const;
92
93 void set_skew(Vector2 p_skew);
94 Vector2 get_skew() const;
95
96 void set_shadow_color(const Color &p_color);
97 Color get_shadow_color() const;
98
99 void set_shadow_size(const int &p_size);
100 int get_shadow_size() const;
101
102 void set_shadow_offset(const Point2 &p_offset);
103 Point2 get_shadow_offset() const;
104
105 void set_anti_aliased(const bool &p_anti_aliased);
106 bool is_anti_aliased() const;
107 void set_aa_size(const real_t p_aa_size);
108 real_t get_aa_size() const;
109
110 virtual Rect2 get_draw_rect(const Rect2 &p_rect) const override;
111 virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const override;
112 };