Re: Decorating scales



Matthias Clasen schrieb:
> 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 would like that a lot. One thing slightly related is that I wonder if the
GtkAdjustment* could be hinted to the theme engines. E.g. for a Panorma function
the adjustment would be -100 ... 100 or 1.0 ... 1.0. Right now most themes draw
a filled bar from the left and not from where zero is (the middle for panorama).

Stefan

> 
> 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);

do we need 3 functions for adding. why not just:
void              gtk_scale_add_mark           (GtkScale        *scale,
                                                gdouble          value,
                                                GtkPositionType  position,
                                                const gchar     *markup,
                                                GIcon           *icon);

and allow text, icon to be NULL. I know that this is not extensible, but right
now I can't think of what else to put there.

ALso some questions, is icon/text mutualy exclusive? WHat about the placement.
Is it always below for hscales and right for vscale (and vice versa for RTL
locales?)

Stefan

> 
> 
> Feedback appreciated,  Matthias
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list



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