| 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/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 |
}; |