| 
									
										
										
										
											2023-01-05 13:25:55 +01:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  slider.cpp                                                            */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         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
										 |  |  | #include "slider.h"
 | 
					
						
							| 
									
										
										
										
											2022-02-15 18:06:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-08 21:00:10 +02:00
										 |  |  | #include "scene/theme/theme_db.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Size2 Slider::get_minimum_size() const { | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 	Size2i ss = theme_cache.slider_style->get_minimum_size(); | 
					
						
							| 
									
										
										
										
											2022-08-31 15:02:40 +03:00
										 |  |  | 	Size2i rs = theme_cache.grabber_icon->get_size(); | 
					
						
							| 
									
										
										
										
											2019-04-09 21:58:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 	if (orientation == HORIZONTAL) { | 
					
						
							| 
									
										
										
										
											2019-04-09 21:58:19 +02:00
										 |  |  | 		return Size2i(ss.width, MAX(ss.height, rs.height)); | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 	} else { | 
					
						
							| 
									
										
										
										
											2019-04-09 21:58:19 +02:00
										 |  |  | 		return Size2i(MAX(ss.width, rs.width), ss.height); | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-22 12:37:22 -03:00
										 |  |  | void Slider::gui_input(const Ref<InputEvent> &p_event) { | 
					
						
							| 
									
										
										
										
											2021-04-05 08:52:21 +02:00
										 |  |  | 	ERR_FAIL_COND(p_event.is_null()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | 	if (!editable) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 	Ref<InputEventMouseButton> mb = p_event; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 	if (mb.is_valid()) { | 
					
						
							| 
									
										
										
										
											2021-08-13 16:31:57 -05:00
										 |  |  | 		if (mb->get_button_index() == MouseButton::LEFT) { | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 			if (mb->is_pressed()) { | 
					
						
							| 
									
										
										
										
											2022-08-31 15:02:40 +03:00
										 |  |  | 				Ref<Texture2D> grabber; | 
					
						
							|  |  |  | 				if (mouse_inside || has_focus()) { | 
					
						
							|  |  |  | 					grabber = theme_cache.grabber_hl_icon; | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					grabber = theme_cache.grabber_icon; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-03 10:54:24 +02:00
										 |  |  | 				grab.pos = orientation == VERTICAL ? mb->get_position().y : mb->get_position().x; | 
					
						
							| 
									
										
										
										
											2023-12-21 11:23:35 +08:00
										 |  |  | 				grab.value_before_dragging = get_as_ratio(); | 
					
						
							|  |  |  | 				emit_signal(SNAME("drag_started")); | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-07 17:19:13 +00:00
										 |  |  | 				double grab_width = theme_cache.center_grabber ? 0.0 : (double)grabber->get_width(); | 
					
						
							|  |  |  | 				double grab_height = theme_cache.center_grabber ? 0.0 : (double)grabber->get_height(); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				double max = orientation == VERTICAL ? get_size().height - grab_height : get_size().width - grab_width; | 
					
						
							| 
									
										
										
										
											2023-09-19 10:47:46 +02:00
										 |  |  | 				set_block_signals(true); | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 				if (orientation == VERTICAL) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					set_as_ratio(1 - (((double)grab.pos - (grab_height / 2.0)) / max)); | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 				} else { | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 					double v = ((double)grab.pos - (grab_width / 2.0)) / max; | 
					
						
							|  |  |  | 					set_as_ratio(is_layout_rtl() ? 1 - v : v); | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2023-09-19 10:47:46 +02:00
										 |  |  | 				set_block_signals(false); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				grab.active = true; | 
					
						
							|  |  |  | 				grab.uvalue = get_as_ratio(); | 
					
						
							| 
									
										
										
										
											2021-12-10 11:19:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-19 10:47:46 +02:00
										 |  |  | 				_notify_shared_value_changed(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				grab.active = false; | 
					
						
							| 
									
										
										
										
											2021-12-10 11:19:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-21 11:23:35 +08:00
										 |  |  | 				const bool value_changed = !Math::is_equal_approx((double)grab.value_before_dragging, get_as_ratio()); | 
					
						
							| 
									
										
										
										
											2021-12-10 11:19:10 +08:00
										 |  |  | 				emit_signal(SNAME("drag_ended"), value_changed); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-07-07 12:35:59 +03:00
										 |  |  | 		} else if (scrollable) { | 
					
						
							| 
									
										
										
										
											2021-08-13 16:31:57 -05:00
										 |  |  | 			if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_UP) { | 
					
						
							| 
									
										
										
										
											2024-12-22 05:24:24 +08:00
										 |  |  | 				if (get_focus_mode_with_recursive() != FOCUS_NONE) { | 
					
						
							| 
									
										
										
										
											2023-12-02 11:06:06 +00:00
										 |  |  | 					grab_focus(); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-07 12:35:59 +03:00
										 |  |  | 				set_value(get_value() + get_step()); | 
					
						
							| 
									
										
										
										
											2021-08-13 16:31:57 -05:00
										 |  |  | 			} else if (mb->is_pressed() && mb->get_button_index() == MouseButton::WHEEL_DOWN) { | 
					
						
							| 
									
										
										
										
											2024-12-22 05:24:24 +08:00
										 |  |  | 				if (get_focus_mode_with_recursive() != FOCUS_NONE) { | 
					
						
							| 
									
										
										
										
											2023-12-02 11:06:06 +00:00
										 |  |  | 					grab_focus(); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2018-07-07 12:35:59 +03:00
										 |  |  | 				set_value(get_value() - get_step()); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 	Ref<InputEventMouseMotion> mm = p_event; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 	if (mm.is_valid()) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		if (grab.active) { | 
					
						
							|  |  |  | 			Size2i size = get_size(); | 
					
						
							| 
									
										
										
										
											2024-02-07 17:19:13 +00:00
										 |  |  | 			Ref<Texture2D> grabber = theme_cache.grabber_hl_icon; | 
					
						
							|  |  |  | 			double grab_width = theme_cache.center_grabber ? 0.0 : (double)grabber->get_width(); | 
					
						
							|  |  |  | 			double grab_height = theme_cache.center_grabber ? 0.0 : (double)grabber->get_height(); | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:00 -05:00
										 |  |  | 			double motion = (orientation == VERTICAL ? mm->get_position().y : mm->get_position().x) - grab.pos; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (orientation == VERTICAL) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				motion = -motion; | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 			} else if (is_layout_rtl()) { | 
					
						
							|  |  |  | 				motion = -motion; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-02-07 17:19:13 +00:00
										 |  |  | 			double areasize = orientation == VERTICAL ? size.height - grab_height : size.width - grab_width; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (areasize <= 0) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				return; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:00 -05:00
										 |  |  | 			double umotion = motion / double(areasize); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			set_as_ratio(grab.uvalue + umotion); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2017-05-20 12:38:03 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 	Input *input = Input::get_singleton(); | 
					
						
							|  |  |  | 	Ref<InputEventJoypadMotion> joypadmotion_event = p_event; | 
					
						
							|  |  |  | 	Ref<InputEventJoypadButton> joypadbutton_event = p_event; | 
					
						
							|  |  |  | 	bool is_joypad_event = (joypadmotion_event.is_valid() || joypadbutton_event.is_valid()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-25 14:15:10 +02:00
										 |  |  | 	if (mm.is_null() && mb.is_null()) { | 
					
						
							| 
									
										
										
										
											2019-10-24 23:51:33 +02:00
										 |  |  | 		if (p_event->is_action_pressed("ui_left", true)) { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (orientation != HORIZONTAL) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				return; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 			if (is_joypad_event) { | 
					
						
							|  |  |  | 				if (!input->is_action_just_pressed("ui_left", true)) { | 
					
						
							|  |  |  | 					return; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				set_process_internal(true); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 			if (is_layout_rtl()) { | 
					
						
							|  |  |  | 				set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			accept_event(); | 
					
						
							| 
									
										
										
										
											2019-10-24 23:51:33 +02:00
										 |  |  | 		} else if (p_event->is_action_pressed("ui_right", true)) { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (orientation != HORIZONTAL) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				return; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 			if (is_joypad_event) { | 
					
						
							|  |  |  | 				if (!input->is_action_just_pressed("ui_right", true)) { | 
					
						
							|  |  |  | 					return; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				set_process_internal(true); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 			if (is_layout_rtl()) { | 
					
						
							|  |  |  | 				set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			accept_event(); | 
					
						
							| 
									
										
										
										
											2019-10-24 23:51:33 +02:00
										 |  |  | 		} else if (p_event->is_action_pressed("ui_up", true)) { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (orientation != VERTICAL) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				return; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 			if (is_joypad_event) { | 
					
						
							|  |  |  | 				if (!input->is_action_just_pressed("ui_up", true)) { | 
					
						
							|  |  |  | 					return; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				set_process_internal(true); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			accept_event(); | 
					
						
							| 
									
										
										
										
											2019-10-24 23:51:33 +02:00
										 |  |  | 		} else if (p_event->is_action_pressed("ui_down", true)) { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			if (orientation != VERTICAL) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				return; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 			if (is_joypad_event) { | 
					
						
							|  |  |  | 				if (!input->is_action_just_pressed("ui_down", true)) { | 
					
						
							|  |  |  | 					return; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				set_process_internal(true); | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			accept_event(); | 
					
						
							| 
									
										
										
										
											2022-09-24 18:01:02 +10:00
										 |  |  | 		} else if (p_event->is_action("ui_home", true) && p_event->is_pressed()) { | 
					
						
							| 
									
										
										
										
											2018-02-23 12:17:15 +01:00
										 |  |  | 			set_value(get_min()); | 
					
						
							|  |  |  | 			accept_event(); | 
					
						
							| 
									
										
										
										
											2022-09-24 18:01:02 +10:00
										 |  |  | 		} else if (p_event->is_action("ui_end", true) && p_event->is_pressed()) { | 
					
						
							| 
									
										
										
										
											2018-02-23 12:17:15 +01:00
										 |  |  | 			set_value(get_max()); | 
					
						
							|  |  |  | 			accept_event(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Slider::_notification(int p_what) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	switch (p_what) { | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 		case NOTIFICATION_INTERNAL_PROCESS: { | 
					
						
							|  |  |  | 			Input *input = Input::get_singleton(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if (input->is_action_just_released("ui_left") || input->is_action_just_released("ui_right") || input->is_action_just_released("ui_up") || input->is_action_just_released("ui_down")) { | 
					
						
							|  |  |  | 				gamepad_event_delay_ms = DEFAULT_GAMEPAD_EVENT_DELAY_MS; | 
					
						
							|  |  |  | 				set_process_internal(false); | 
					
						
							|  |  |  | 				return; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			gamepad_event_delay_ms -= get_process_delta_time(); | 
					
						
							|  |  |  | 			if (gamepad_event_delay_ms <= 0) { | 
					
						
							|  |  |  | 				gamepad_event_delay_ms = GAMEPAD_EVENT_REPEAT_RATE_MS + gamepad_event_delay_ms; | 
					
						
							|  |  |  | 				if (orientation == HORIZONTAL) { | 
					
						
							|  |  |  | 					if (input->is_action_pressed("ui_left")) { | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 						if (is_layout_rtl()) { | 
					
						
							|  |  |  | 							set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 						} else { | 
					
						
							|  |  |  | 							set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					if (input->is_action_pressed("ui_right")) { | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 						if (is_layout_rtl()) { | 
					
						
							|  |  |  | 							set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 						} else { | 
					
						
							|  |  |  | 							set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} else if (orientation == VERTICAL) { | 
					
						
							|  |  |  | 					if (input->is_action_pressed("ui_down")) { | 
					
						
							|  |  |  | 						set_value(get_value() - (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					if (input->is_action_pressed("ui_up")) { | 
					
						
							|  |  |  | 						set_value(get_value() + (custom_step >= 0 ? custom_step : get_step())); | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2025-03-21 16:42:23 +02:00
										 |  |  | 		} break; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		case NOTIFICATION_ACCESSIBILITY_UPDATE: { | 
					
						
							|  |  |  | 			RID ae = get_accessibility_element(); | 
					
						
							|  |  |  | 			ERR_FAIL_COND(ae.is_null()); | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-21 16:42:23 +02:00
										 |  |  | 			DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_SLIDER); | 
					
						
							| 
									
										
										
										
											2023-02-09 11:25:56 -05:00
										 |  |  | 		} break; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-09 21:58:19 +02:00
										 |  |  | 		case NOTIFICATION_THEME_CHANGED: { | 
					
						
							| 
									
										
										
										
											2021-12-06 14:02:34 +01:00
										 |  |  | 			update_minimum_size(); | 
					
						
							| 
									
										
										
										
											2022-08-13 23:21:24 +02:00
										 |  |  | 			queue_redraw(); | 
					
						
							| 
									
										
										
										
											2019-04-09 21:58:19 +02:00
										 |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2022-02-15 18:06:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		case NOTIFICATION_MOUSE_ENTER: { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			mouse_inside = true; | 
					
						
							| 
									
										
										
										
											2022-08-13 23:21:24 +02:00
										 |  |  | 			queue_redraw(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2022-02-15 18:06:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		case NOTIFICATION_MOUSE_EXIT: { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			mouse_inside = false; | 
					
						
							| 
									
										
										
										
											2022-08-13 23:21:24 +02:00
										 |  |  | 			queue_redraw(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2022-02-15 18:06:48 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		case NOTIFICATION_VISIBILITY_CHANGED: | 
					
						
							| 
									
										
										
										
											2017-10-16 20:53:02 +02:00
										 |  |  | 		case NOTIFICATION_EXIT_TREE: { | 
					
						
							|  |  |  | 			mouse_inside = false; | 
					
						
							|  |  |  | 			grab.active = false; | 
					
						
							|  |  |  | 		} break; | 
					
						
							| 
									
										
										
										
											2022-02-15 18:06:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		case NOTIFICATION_DRAW: { | 
					
						
							|  |  |  | 			RID ci = get_canvas_item(); | 
					
						
							|  |  |  | 			Size2i size = get_size(); | 
					
						
							| 
									
										
										
										
											2017-12-09 22:03:57 +01:00
										 |  |  | 			double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-31 15:02:40 +03:00
										 |  |  | 			Ref<StyleBox> style = theme_cache.slider_style; | 
					
						
							|  |  |  | 			Ref<Texture2D> tick = theme_cache.tick_icon; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-28 02:32:27 +03:00
										 |  |  | 			bool highlighted = editable && (mouse_inside || has_focus()); | 
					
						
							| 
									
										
										
										
											2022-08-31 15:02:40 +03:00
										 |  |  | 			Ref<Texture2D> grabber; | 
					
						
							|  |  |  | 			if (editable) { | 
					
						
							|  |  |  | 				if (highlighted) { | 
					
						
							|  |  |  | 					grabber = theme_cache.grabber_hl_icon; | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					grabber = theme_cache.grabber_icon; | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				grabber = theme_cache.grabber_disabled_icon; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			Ref<StyleBox> grabber_area; | 
					
						
							|  |  |  | 			if (highlighted) { | 
					
						
							|  |  |  | 				grabber_area = theme_cache.grabber_area_hl_style; | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				grabber_area = theme_cache.grabber_area_style; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			if (orientation == VERTICAL) { | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 				int widget_width = style->get_minimum_size().width; | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 				double areasize = size.height - (theme_cache.center_grabber ? 0 : grabber->get_height()); | 
					
						
							|  |  |  | 				int grabber_shift = theme_cache.center_grabber ? grabber->get_height() / 2 : 0; | 
					
						
							| 
									
										
										
										
											2017-07-18 01:32:25 -05:00
										 |  |  | 				style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height))); | 
					
						
							| 
									
										
										
										
											2024-09-14 12:40:41 +00:00
										 |  |  | 				grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, Math::round(size.height - areasize * ratio - grabber->get_height() / 2 + grabber_shift)), Size2i(widget_width, Math::round(areasize * ratio + grabber->get_height() / 2 - grabber_shift)))); | 
					
						
							| 
									
										
										
										
											2019-12-13 21:17:51 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				if (ticks > 1) { | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 					int grabber_offset = (grabber->get_height() / 2 - tick->get_height() / 2); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					for (int i = 0; i < ticks; i++) { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 						if (!ticks_on_borders && (i == 0 || i + 1 == ticks)) { | 
					
						
							| 
									
										
										
										
											2020-05-10 12:56:01 +02:00
										 |  |  | 							continue; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 						int ofs = (i * areasize / (ticks - 1)) + grabber_offset - grabber_shift; | 
					
						
							| 
									
										
										
										
											2017-09-27 14:44:48 -05:00
										 |  |  | 						tick->draw(ci, Point2i((size.width - widget_width) / 2, ofs)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 				grabber->draw(ci, Point2i(size.width / 2 - grabber->get_width() / 2 + theme_cache.grabber_offset, size.height - ratio * areasize - grabber->get_height() + grabber_shift)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2023-01-19 19:14:09 +03:00
										 |  |  | 				int widget_height = style->get_minimum_size().height; | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 				double areasize = size.width - (theme_cache.center_grabber ? 0 : grabber->get_size().width); | 
					
						
							|  |  |  | 				int grabber_shift = theme_cache.center_grabber ? -grabber->get_width() / 2 : 0; | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 				bool rtl = is_layout_rtl(); | 
					
						
							| 
									
										
										
										
											2017-09-12 17:12:47 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				style->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(size.width, widget_height))); | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 				int p = areasize * (rtl ? 1 - ratio : ratio) + grabber->get_width() / 2 + grabber_shift; | 
					
						
							|  |  |  | 				if (rtl) { | 
					
						
							|  |  |  | 					grabber_area->draw(ci, Rect2i(Point2i(p, (size.height - widget_height) / 2), Size2i(size.width - p, widget_height))); | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					grabber_area->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(p, widget_height))); | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				if (ticks > 1) { | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 					int grabber_offset = (grabber->get_width() / 2 - tick->get_width() / 2); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					for (int i = 0; i < ticks; i++) { | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 						if ((!ticks_on_borders) && ((i == 0) || ((i + 1) == ticks))) { | 
					
						
							| 
									
										
										
										
											2020-05-10 12:56:01 +02:00
										 |  |  | 							continue; | 
					
						
							| 
									
										
										
										
											2020-05-14 16:41:43 +02:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2022-11-23 14:56:10 +01:00
										 |  |  | 						int ofs = (i * areasize / (ticks - 1)) + grabber_offset + grabber_shift; | 
					
						
							| 
									
										
										
										
											2017-09-27 14:44:48 -05:00
										 |  |  | 						tick->draw(ci, Point2i(ofs, (size.height - widget_height) / 2)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2024-11-26 00:19:55 +01:00
										 |  |  | 				grabber->draw(ci, Point2i((rtl ? 1 - ratio : ratio) * areasize + grabber_shift, size.height / 2 - grabber->get_height() / 2 + theme_cache.grabber_offset)); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:00 -05:00
										 |  |  | void Slider::set_custom_step(double p_custom_step) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	custom_step = p_custom_step; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-14 18:33:00 -05:00
										 |  |  | double Slider::get_custom_step() const { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	return custom_step; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void Slider::set_ticks(int p_count) { | 
					
						
							| 
									
										
										
										
											2022-03-16 15:50:48 +08:00
										 |  |  | 	if (ticks == p_count) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	ticks = p_count; | 
					
						
							| 
									
										
										
										
											2022-08-13 23:21:24 +02:00
										 |  |  | 	queue_redraw(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int Slider::get_ticks() const { | 
					
						
							|  |  |  | 	return ticks; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | bool Slider::get_ticks_on_borders() const { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	return ticks_on_borders; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | void Slider::set_ticks_on_borders(bool _tob) { | 
					
						
							| 
									
										
										
										
											2022-03-16 15:50:48 +08:00
										 |  |  | 	if (ticks_on_borders == _tob) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	ticks_on_borders = _tob; | 
					
						
							| 
									
										
										
										
											2022-08-13 23:21:24 +02:00
										 |  |  | 	queue_redraw(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | void Slider::set_editable(bool p_editable) { | 
					
						
							| 
									
										
										
										
											2022-03-16 15:50:48 +08:00
										 |  |  | 	if (editable == p_editable) { | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2023-05-19 10:20:42 -04:00
										 |  |  | 	grab.active = false; | 
					
						
							| 
									
										
										
										
											2022-03-16 15:50:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | 	editable = p_editable; | 
					
						
							| 
									
										
										
										
											2022-08-13 23:21:24 +02:00
										 |  |  | 	queue_redraw(); | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool Slider::is_editable() const { | 
					
						
							|  |  |  | 	return editable; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-07 12:35:59 +03:00
										 |  |  | void Slider::set_scrollable(bool p_scrollable) { | 
					
						
							|  |  |  | 	scrollable = p_scrollable; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool Slider::is_scrollable() const { | 
					
						
							|  |  |  | 	return scrollable; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | void Slider::_bind_methods() { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	ClassDB::bind_method(D_METHOD("set_ticks", "count"), &Slider::set_ticks); | 
					
						
							|  |  |  | 	ClassDB::bind_method(D_METHOD("get_ticks"), &Slider::get_ticks); | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	ClassDB::bind_method(D_METHOD("get_ticks_on_borders"), &Slider::get_ticks_on_borders); | 
					
						
							|  |  |  | 	ClassDB::bind_method(D_METHOD("set_ticks_on_borders", "ticks_on_border"), &Slider::set_ticks_on_borders); | 
					
						
							| 
									
										
										
										
											2016-03-09 00:00:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | 	ClassDB::bind_method(D_METHOD("set_editable", "editable"), &Slider::set_editable); | 
					
						
							|  |  |  | 	ClassDB::bind_method(D_METHOD("is_editable"), &Slider::is_editable); | 
					
						
							| 
									
										
										
										
											2018-07-07 12:35:59 +03:00
										 |  |  | 	ClassDB::bind_method(D_METHOD("set_scrollable", "scrollable"), &Slider::set_scrollable); | 
					
						
							|  |  |  | 	ClassDB::bind_method(D_METHOD("is_scrollable"), &Slider::is_scrollable); | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-10 11:19:10 +08:00
										 |  |  | 	ADD_SIGNAL(MethodInfo("drag_started")); | 
					
						
							|  |  |  | 	ADD_SIGNAL(MethodInfo("drag_ended", PropertyInfo(Variant::BOOL, "value_changed"))); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-10 17:58:53 +07:00
										 |  |  | 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editable"), "set_editable", "is_editable"); | 
					
						
							| 
									
										
										
										
											2018-07-07 12:35:59 +03:00
										 |  |  | 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "scrollable"), "set_scrollable", "is_scrollable"); | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	ADD_PROPERTY(PropertyInfo(Variant::INT, "tick_count", PROPERTY_HINT_RANGE, "0,4096,1"), "set_ticks", "get_ticks"); | 
					
						
							|  |  |  | 	ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ticks_on_borders"), "set_ticks_on_borders", "get_ticks_on_borders"); | 
					
						
							| 
									
										
										
										
											2023-09-08 21:00:10 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, Slider, slider_style, "slider"); | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, Slider, grabber_area_style, "grabber_area"); | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, Slider, grabber_area_hl_style, "grabber_area_highlight"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, Slider, grabber_icon, "grabber"); | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, Slider, grabber_hl_icon, "grabber_highlight"); | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, Slider, grabber_disabled_icon, "grabber_disabled"); | 
					
						
							|  |  |  | 	BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_ICON, Slider, tick_icon, "tick"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Slider, center_grabber); | 
					
						
							|  |  |  | 	BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, Slider, grabber_offset); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Slider::Slider(Orientation p_orientation) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	orientation = p_orientation; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	set_focus_mode(FOCUS_ALL); | 
					
						
							|  |  |  | } |