aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUIScrollbar.cpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-08-30 23:30:12 +0200
committer GitHub <noreply@github.com>2024-08-30 23:30:12 +0200
commit2e0bc5b556b9c6df46a8cdd48d3f109e0ac76b63 (patch)
tree2c521b99fe6cd0a7fd5d6a29e55645b3415792b3 /extension/src/openvic-extension/classes/GUIScrollbar.cpp
parentf54e454afb90f8868e7c62529e2a388fdaadf20b (diff)
parentbdc2ba527bc02e7cdf977f6040f2ca85aa4f9a94 (diff)
Merge pull request #253 from OpenVicProject/tooltip
Tooltips
Diffstat (limited to 'extension/src/openvic-extension/classes/GUIScrollbar.cpp')
-rw-r--r--extension/src/openvic-extension/classes/GUIScrollbar.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/extension/src/openvic-extension/classes/GUIScrollbar.cpp b/extension/src/openvic-extension/classes/GUIScrollbar.cpp
index ddcba7c..6e310d7 100644
--- a/extension/src/openvic-extension/classes/GUIScrollbar.cpp
+++ b/extension/src/openvic-extension/classes/GUIScrollbar.cpp
@@ -18,7 +18,11 @@ StringName const& GUIScrollbar::signal_value_changed() {
return signal_value_changed;
}
+GUI_TOOLTIP_IMPLEMENTATIONS(GUIScrollbar)
+
void GUIScrollbar::_bind_methods() {
+ GUI_TOOLTIP_BIND_METHODS(GUIScrollbar)
+
OV_BIND_METHOD(GUIScrollbar::emit_value_changed);
OV_BIND_METHOD(GUIScrollbar::reset);
OV_BIND_METHOD(GUIScrollbar::clear);
@@ -49,7 +53,7 @@ void GUIScrollbar::_bind_methods() {
ADD_SIGNAL(MethodInfo(signal_value_changed(), PropertyInfo(Variant::INT, "value")));
}
-GUIScrollbar::GUIScrollbar() {
+GUIScrollbar::GUIScrollbar() : tooltip_active { false } {
/* Anything which the constructor might not have default initialised will be set by clear(). */
clear();
}
@@ -587,11 +591,16 @@ void GUIScrollbar::_gui_input(Ref<InputEvent> const& event) {
hover_more = !hover_more;
queue_redraw();
}
+
+ _set_tooltip_active(hover_slider || hover_track || hover_less || hover_more);
+
return;
}
}
void GUIScrollbar::_notification(int what) {
+ // GUIScrollbar doesn't use _tooltip_notification, as we don't want to show tooltips when hovering over transparent parts.
+
switch (what) {
case NOTIFICATION_VISIBILITY_CHANGED:
case NOTIFICATION_MOUSE_EXIT: {
@@ -602,6 +611,10 @@ void GUIScrollbar::_notification(int what) {
queue_redraw();
} break;
+ case NOTIFICATION_MOUSE_EXIT_SELF: {
+ _set_tooltip_active(false);
+ } break;
+
/* Pressing (and holding) less and more buttons. */
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {
const double delta = get_physics_process_delta_time();