Re: #50200: patch



On Fri, 5 Oct 2001, Kristian Rietveld wrote:

> @@ -431,6 +435,15 @@
>    spin_button->snap_to_ticks = FALSE;
>    gtk_spin_button_set_adjustment (spin_button,
>  	  (GtkAdjustment*) gtk_adjustment_new (0, 0, 0, 0, 0, 0));
> +
> +  mask = pango_font_description_get_set_fields (GTK_WIDGET (spin_button)->style->font_desc);
> +  if (mask & PANGO_FONT_MASK_SIZE)
> +    spin_button->arrow_size = PANGO_PIXELS (pango_font_description_get_size (GTK_WIDGET (spin_button)->style->font_desc));
> +  else
> +    /* old default value */
> +    spin_button->arrow_size = 11;
> +
> +
>  }

can you get rid of the two extraneous newlines at the end? ;)

>  static void
> @@ -481,7 +494,8 @@
>    spin_button = GTK_SPIN_BUTTON (widget);
> 
>    real_width = widget->allocation.width;
> -  widget->allocation.width -= ARROW_SIZE + 2 * widget->style->xthickness;
> +  widget->allocation.width -= spin_button->arrow_size +
> +    2 * widget->style->xthickness;

small formatting, write this as:
  widget->allocation.width -= (spin_button->arrow_size +
                               2 * widget->style->xthickness);
so indentation is preserved automatically.

> @@ -608,27 +623,32 @@
>        w = MIN (string_len, 10) * digit_width;
>        width = MAX (width, w);
> 
> -      requisition->width = width + ARROW_SIZE + 2 * widget->style->xthickness;
> +      requisition->width = width + spin_button->arrow_size +
> +	2 * widget->style->xthickness;

formatting, see above.


>      }
>    else
> -    requisition->width += ARROW_SIZE + 2 * widget->style->xthickness;
> +    requisition->width += spin_button->arrow_size
> +      + 2 * widget->style->xthickness;

dito.

>  }

> +static void
> +gtk_spin_button_style_set (GtkWidget *widget,
> +			   GtkStyle *previous_style)
> +{
> +  PangoFontMask mask;
> +  GtkSpinButton *spin;
> +
> +  g_return_if_fail (GTK_IS_SPIN_BUTTON (widget));
> +
> +  spin = GTK_SPIN_BUTTON (widget);
> +
> +  /* font may have changed: update arrow size */
> +  mask = pango_font_description_get_set_fields (widget->style->font_desc);
> +  if (mask & PANGO_FONT_MASK_SIZE)
> +    spin->arrow_size = PANGO_PIXELS (pango_font_description_get_size (widget->style->font_desc));
> +  else
> +    /* old default value */
> +    spin->arrow_size = 11;
> +
> +  gtk_widget_queue_draw (widget);
> +  gtk_widget_queue_resize (widget);

::style_set will automatically resize (and therefore redraw) the widget.

> +}

---
ciaoTJ





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