コード例 #1
0
ファイル: gtkrender.c プロジェクト: Vort/gtk
static void
gtk_do_render_slider (GtkStyleContext *context,
                      cairo_t         *cr,
                      gdouble          x,
                      gdouble          y,
                      gdouble          width,
                      gdouble          height,
                      GtkOrientation   orientation)
{
  GtkCssStyle *style;
  GtkJunctionSides junction;

  style = gtk_style_context_lookup_style (context);
  junction = gtk_style_context_get_junction_sides (context);

  gtk_css_style_render_background (style,
                                   cr,
                                   x, y, width, height,
                                   junction);
  gtk_css_style_render_border (style,
                               cr,
                               x, y, width, height,
                               0,
                               junction);
}
コード例 #2
0
/**
 * gtk_render_background:
 * @context: a #GtkStyleContext
 * @cr: a #cairo_t
 * @x: X origin of the rectangle
 * @y: Y origin of the rectangle
 * @width: rectangle width
 * @height: rectangle height
 *
 * Renders the background of an element.
 *
 * Typical background rendering, showing the effect of
 * `background-image`, `border-width` and `border-radius`:
 *
 * ![](background.png)
 *
 * Since: 3.0.
 **/
void
gtk_render_background (GtkStyleContext *context,
                       cairo_t         *cr,
                       gdouble          x,
                       gdouble          y,
                       gdouble          width,
                       gdouble          height)
{
  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
  g_return_if_fail (cr != NULL);

  if (width <= 0 || height <= 0)
    return;

  gtk_css_style_render_background (gtk_style_context_lookup_style (context),
                                   cr, x, y, width, height);
}
コード例 #3
0
ファイル: gtkrender.c プロジェクト: Vort/gtk
static void
gtk_css_style_render_extension (GtkCssStyle     *style,
                                cairo_t         *cr,
                                gdouble          x,
                                gdouble          y,
                                gdouble          width,
                                gdouble          height,
                                GtkPositionType  gap_side)
{
  GtkJunctionSides junction = 0;
  guint hidden_side = 0;

  switch (gap_side)
    {
    case GTK_POS_LEFT:
      junction = GTK_JUNCTION_LEFT;
      hidden_side = (1 << GTK_CSS_LEFT);
      break;
    case GTK_POS_RIGHT:
      junction = GTK_JUNCTION_RIGHT;
      hidden_side = (1 << GTK_CSS_RIGHT);
      break;
    case GTK_POS_TOP:
      junction = GTK_JUNCTION_TOP;
      hidden_side = (1 << GTK_CSS_TOP);
      break;
    case GTK_POS_BOTTOM:
      junction = GTK_JUNCTION_BOTTOM;
      hidden_side = (1 << GTK_CSS_BOTTOM);
      break;
    }

  gtk_css_style_render_background (style,
                                   cr,
                                   x, y,
                                   width, height,
                                   junction);

  gtk_css_style_render_border (style, cr,
                               x, y, width, height,
                               hidden_side, junction);
}
コード例 #4
0
ファイル: gtkrender.c プロジェクト: Vort/gtk
/**
 * gtk_render_background:
 * @context: a #GtkStyleContext
 * @cr: a #cairo_t
 * @x: X origin of the rectangle
 * @y: Y origin of the rectangle
 * @width: rectangle width
 * @height: rectangle height
 *
 * Renders the background of an element.
 *
 * Typical background rendering, showing the effect of
 * `background-image`, `border-width` and `border-radius`:
 *
 * ![](background.png)
 *
 * Since: 3.0.
 **/
void
gtk_render_background (GtkStyleContext *context,
                       cairo_t         *cr,
                       gdouble          x,
                       gdouble          y,
                       gdouble          width,
                       gdouble          height)
{
  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
  g_return_if_fail (cr != NULL);

  if (width <= 0 || height <= 0)
    return;

  cairo_save (cr);
  cairo_new_path (cr);

  gtk_css_style_render_background (gtk_style_context_lookup_style (context),
                                   cr, x, y, width, height,
                                   gtk_style_context_get_junction_sides (context));

  cairo_restore (cr);
}