Decorating scales



Over the Christmas vacation, I spent a day adding marks to scales. The
motivation for this came from the new sound preferences capplet, which
uses a GtkHScale for balance control. Jon did a nice job of adding
Left/Right labels (see the screenshot), but what is really missing
here is an easy to hit midpoint.

So I wrote a patch for GtkRange and GtkScale that allows to add
'marks' to certain values. When dragging the scale over one of these
marked values, there is a little resistance that makes it easy to
select the exact value. The api also allows to
show a label or icon next to the mark.
http://bugzilla.gnome.org/attachment.cgi?id=125318&action=view shows
the
various possibilities.

I'd like to get this functionality into 2.16, if nobody objects, but
I'm not entirely sure that I have managed to come up with the best
possible api for this yet:


+void              gtk_scale_add_mark           (GtkScale        *scale,
+                                                gdouble          value,
+                                                GtkPositionType  position);
+void              gtk_scale_add_mark_text      (GtkScale        *scale,
+                                                gdouble          value,
+                                                GtkPositionType  position,
+                                                const gchar     *markup);
+void              gtk_scale_add_mark_icon      (GtkScale        *scale,
+                                                gdouble          value,
+                                                GtkPositionType  position,
+                                                GIcon           *icon);
+void              gtk_scale_clear_marks        (GtkScale *scale);


Feedback appreciated,  Matthias

Attachment: balance-slider.png
Description: PNG image



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