1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #ifndef NINE_PATCH_RECT_H
- #define NINE_PATCH_RECT_H
- #include "scene/gui/control.h"
- class NinePatchRect : public Control {
- GDCLASS(NinePatchRect, Control);
- public:
- enum AxisStretchMode {
- AXIS_STRETCH_MODE_STRETCH,
- AXIS_STRETCH_MODE_TILE,
- AXIS_STRETCH_MODE_TILE_FIT,
- };
- bool draw_center;
- int margin[4];
- Rect2 region_rect;
- Ref<Texture> texture;
- AxisStretchMode axis_h, axis_v;
- protected:
- void _notification(int p_what);
- virtual Size2 get_minimum_size() const;
- static void _bind_methods();
- public:
- void set_texture(const Ref<Texture> &p_tex);
- Ref<Texture> get_texture() const;
- void set_patch_margin(Margin p_margin, int p_size);
- int get_patch_margin(Margin p_margin) const;
- void set_region_rect(const Rect2 &p_region_rect);
- Rect2 get_region_rect() const;
- void set_draw_center(bool p_enabled);
- bool is_draw_center_enabled() const;
- void set_h_axis_stretch_mode(AxisStretchMode p_mode);
- AxisStretchMode get_h_axis_stretch_mode() const;
- void set_v_axis_stretch_mode(AxisStretchMode p_mode);
- AxisStretchMode get_v_axis_stretch_mode() const;
- NinePatchRect();
- ~NinePatchRect();
- };
- VARIANT_ENUM_CAST(NinePatchRect::AxisStretchMode)
- #endif
|