| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  style_box.h                                                           */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         This file is part of:                          */ | 
					
						
							|  |  |  | /*                             GODOT ENGINE                               */ | 
					
						
							|  |  |  | /*                        https://godotengine.org                         */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | 
					
						
							|  |  |  | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining  */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the        */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including    */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,    */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to     */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to  */ | 
					
						
							|  |  |  | /* the following conditions:                                              */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be         */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.        */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							| 
									
										
										
										
											2018-01-05 00:50:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | #ifndef STYLE_BOX_H
 | 
					
						
							|  |  |  | #define STYLE_BOX_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-07 19:33:38 -03:00
										 |  |  | #include "core/io/resource.h"
 | 
					
						
							| 
									
										
										
										
											2023-07-14 22:35:39 +02:00
										 |  |  | #include "core/object/gdvirtual.gen.inc"
 | 
					
						
							| 
									
										
										
										
											2019-08-10 07:28:17 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-24 10:21:56 -03:00
										 |  |  | class CanvasItem; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | class StyleBox : public Resource { | 
					
						
							| 
									
										
										
										
											2017-01-02 23:03:46 -03:00
										 |  |  | 	GDCLASS(StyleBox, Resource); | 
					
						
							| 
									
										
										
										
											2017-06-15 19:44:11 -03:00
										 |  |  | 	RES_BASE_EXTENSION("stylebox"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	OBJ_SAVE_TYPE(StyleBox); | 
					
						
							| 
									
										
										
										
											2023-07-14 22:35:39 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	float content_margin[4]; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	static void _bind_methods(); | 
					
						
							| 
									
										
										
										
											2023-07-14 22:35:39 +02:00
										 |  |  | 	virtual float get_style_margin(Side p_side) const { return 0; } | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-18 10:07:35 -05:00
										 |  |  | 	GDVIRTUAL2C_REQUIRED(_draw, RID, Rect2) | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	GDVIRTUAL1RC(Rect2, _get_draw_rect, Rect2) | 
					
						
							|  |  |  | 	GDVIRTUAL0RC(Size2, _get_minimum_size) | 
					
						
							|  |  |  | 	GDVIRTUAL2RC(bool, _test_mask, Point2, Rect2) | 
					
						
							| 
									
										
										
										
											2022-03-10 08:17:38 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	virtual Size2 get_minimum_size() const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	void set_content_margin(Side p_side, float p_value); | 
					
						
							|  |  |  | 	void set_content_margin_all(float p_value); | 
					
						
							|  |  |  | 	void set_content_margin_individual(float p_left, float p_top, float p_right, float p_bottom); | 
					
						
							|  |  |  | 	float get_content_margin(Side p_side) const; | 
					
						
							| 
									
										
										
										
											2022-03-11 22:38:44 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-22 16:24:29 +00:00
										 |  |  | 	float get_margin(Side p_side) const; | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	Point2 get_offset() const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-10 08:17:38 +01:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const; | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	virtual Rect2 get_draw_rect(const Rect2 &p_rect) const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-24 10:21:56 -03:00
										 |  |  | 	CanvasItem *get_current_item_drawn() const; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	virtual bool test_mask(const Point2 &p_point, const Rect2 &p_rect) const; | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	StyleBox(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class StyleBoxEmpty : public StyleBox { | 
					
						
							| 
									
										
										
										
											2017-01-02 23:03:46 -03:00
										 |  |  | 	GDCLASS(StyleBoxEmpty, StyleBox); | 
					
						
							| 
									
										
										
										
											2020-12-22 16:24:29 +00:00
										 |  |  | 	virtual float get_style_margin(Side p_side) const override { return 0; } | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-07-10 11:34:39 +01:00
										 |  |  | 	virtual void draw(RID p_canvas_item, const Rect2 &p_rect) const override {} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	StyleBoxEmpty() {} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-23 23:41:51 +02:00
										 |  |  | #endif // STYLE_BOX_H
 |