Re: Decorating scales



2009/1/6 Matthias Clasen <matthias clasen gmail com>:
> 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);
>

I wonder if the mark itself should not just be a child widget, this current api
doesnt allow for combination of simple separator like marks with text or icons.

Also it should be possible to create an icon mark without GIcon, from stock and
icon-name (will be better suited to make it buildable).

Cheers,
             -Tristan

PS:
rambling off on a semi-related topic, when I implemented a sound mixer UI -
I wrote my own slider widget because in this case particularly it was
a touchscreen
interface, and we needed to make sure that we wouldnt have bursts
(i.e. clicking
in the trough causes a deafening slider jump), bottom line is we
needed the slider
in some cases to jump directly to mouse position without any steps
(for navigating
alphabetical content), and in other cases we didnt want the slider to
move until
the mouse pointer entered the slider knob area, so you could "catch"
it with your
finger and change the volume without bursts.


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