Esempio n. 1
0
static void
gtk_level_bar_draw_fill_continuous (GtkLevelBar *self,
                                    cairo_t     *cr)
{
  gboolean inverted;

  inverted = gtk_level_bar_get_real_inverted (self);

  /* render the empty (unfilled) part */
  gtk_css_gadget_draw (self->priv->block_gadget[inverted ? 0 : 1], cr);

  /* now render the filled part on top of it */
  gtk_css_gadget_draw (self->priv->block_gadget[inverted ? 1 : 0], cr);
}
Esempio n. 2
0
static gboolean
swatch_draw (GtkWidget *widget,
             cairo_t   *cr)
{
    gtk_css_gadget_draw (GTK_COLOR_SWATCH (widget)->priv->gadget, cr);

    return FALSE;
}
Esempio n. 3
0
static gboolean
gtk_level_bar_draw (GtkWidget *widget,
                    cairo_t   *cr)
{
  GtkLevelBar *self = GTK_LEVEL_BAR (widget);

  gtk_css_gadget_draw (self->priv->trough_gadget, cr);

  return FALSE;
}
Esempio n. 4
0
static void
gtk_level_bar_draw_fill_discrete (GtkLevelBar *self,
                                  cairo_t     *cr)
{
  gint num_blocks, i;

  num_blocks = gtk_level_bar_get_num_blocks (self);

  for (i = 0; i < num_blocks; i++)
    gtk_css_gadget_draw (self->priv->block_gadget[i], cr);
}
Esempio n. 5
0
static gboolean
gtk_color_swatch_render (GtkCssGadget *gadget,
                         cairo_t      *cr,
                         int           x,
                         int           y,
                         int           width,
                         int           height,
                         gpointer      data)
{
    GtkWidget *widget;
    GtkColorSwatch *swatch;
    GtkStyleContext *context;

    widget = gtk_css_gadget_get_owner (gadget);
    swatch = GTK_COLOR_SWATCH (widget);
    context = gtk_widget_get_style_context (widget);

    if (swatch->priv->has_color)
    {
        cairo_pattern_t *pattern;
        cairo_matrix_t matrix;

        gtk_render_content_path (context, cr, x, y, width, height);

        if (swatch->priv->use_alpha)
        {
            cairo_save (cr);

            cairo_clip_preserve (cr);

            cairo_set_source_rgb (cr, 0.33, 0.33, 0.33);
            cairo_fill_preserve (cr);

            pattern = _gtk_color_chooser_get_checkered_pattern ();
            cairo_matrix_init_scale (&matrix, 0.125, 0.125);
            cairo_pattern_set_matrix (pattern, &matrix);

            cairo_set_source_rgb (cr, 0.66, 0.66, 0.66);
            cairo_mask (cr, pattern);
            cairo_pattern_destroy (pattern);

            cairo_restore (cr);

            gdk_cairo_set_source_rgba (cr, &swatch->priv->color);
        }
        else
        {
            cairo_set_source_rgb (cr,
                                  swatch->priv->color.red,
                                  swatch->priv->color.green,
                                  swatch->priv->color.blue);
        }

        cairo_fill (cr);
    }

    gtk_render_frame (context, cr, x, y, width, height);

    gtk_css_gadget_draw (swatch->priv->overlay_gadget, cr);

    return gtk_widget_has_visible_focus (widget);
}