[ghex] CSS: have scrollbar fade in and out.



commit 1cf6313a4d494a51e79cdd8aa61897b6d2a52cdb
Author: Logan Rathbone <poprocks gmail com>
Date:   Fri Dec 10 13:18:17 2021 -0500

    CSS: have scrollbar fade in and out.
    
    (CSS whizzes welcome to tweak this).
    /label ~"4. Newcomers"

 src/ghex.css | 10 ++++++++++
 src/gtkhex.c |  7 +++++++
 2 files changed, 17 insertions(+)
---
diff --git a/src/ghex.css b/src/ghex.css
index 997dc0f..1b6c530 100644
--- a/src/ghex.css
+++ b/src/ghex.css
@@ -47,3 +47,13 @@
        padding-top: 6px;
         padding-left: 12px;
 }
+
+.hex scrollbar {
+  opacity: 0.25;
+  transition: opacity 300ms ease;
+
+}
+
+.hex scrollbar:hover {
+  opacity: 1.0;
+}
diff --git a/src/gtkhex.c b/src/gtkhex.c
index 4fa7b11..591c7ad 100644
--- a/src/gtkhex.c
+++ b/src/gtkhex.c
@@ -2616,9 +2616,16 @@ gtk_hex_init (GtkHex *gh)
        gh->adj = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
 
        /* Setup scrollbar. */
+
        gh->scrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL,
                        gh->adj);
 
+       context = gtk_widget_get_style_context (GTK_WIDGET (gh->scrollbar));
+       gtk_style_context_add_class (context, "hex");
+       gtk_style_context_add_provider (context,
+                                       GTK_STYLE_PROVIDER (gh->provider),
+                                       GTK_STYLE_PROVIDER_PRIORITY_THEME);
+
        gtk_widget_set_parent (gh->scrollbar, widget);
        child_info = GTK_HEX_LAYOUT_CHILD (gtk_layout_manager_get_layout_child
                        (gh->layout_manager, gh->scrollbar));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]