Ejemplo n.º 1
0
static gboolean
draw_callback (GtkWidget *widget,
               cairo_t   *cr,
               gpointer   data)
{
  GdkRectangle rect;

  gtk_widget_get_allocation (widget, &rect);
  rect.x += SHADOW_OFFSET_X;
  rect.y += SHADOW_OFFSET_Y;
  rect.width -= SHADOW_OFFSET_X;
  rect.height -= SHADOW_OFFSET_Y;

  draw_shadow_box (cr,
		   rect, SHADOW_RADIUS, 0.4);
  
  return FALSE;
}
Ejemplo n.º 2
0
static gboolean
gd_notification_draw (GtkWidget *widget, cairo_t *cr)
{
  GdNotification *notification = GD_NOTIFICATION (widget);
  GdNotificationPrivate *priv = notification->priv;
  GtkStyleContext *context;
  GdkRectangle rect;
  int inner_radius;

  if (gtk_cairo_should_draw_window (cr, priv->bin_window))
    {
      gtk_widget_get_allocation (widget, &rect);

      context = gtk_widget_get_style_context(widget);

      inner_radius = 5;
      draw_shadow_box (cr, rect, SHADOW_OFFSET_X + inner_radius, SHADOW_OFFSET_X + inner_radius,
                       SHADOW_OFFSET_Y + inner_radius, 0.8);

      gtk_style_context_save (context);
      gtk_render_background (context,  cr,
                             SHADOW_OFFSET_X, 0,
                             gtk_widget_get_allocated_width (widget) - 2 *SHADOW_OFFSET_X,
                             gtk_widget_get_allocated_height (widget) - SHADOW_OFFSET_Y);
      gtk_render_frame (context,cr,
                        SHADOW_OFFSET_X, 0,
                        gtk_widget_get_allocated_width (widget) - 2 *SHADOW_OFFSET_X,
                        gtk_widget_get_allocated_height (widget) - SHADOW_OFFSET_Y);

      gtk_style_context_restore (context);

      if (GTK_WIDGET_CLASS (gd_notification_parent_class)->draw)
        GTK_WIDGET_CLASS (gd_notification_parent_class)->draw(widget, cr);
    }

  return FALSE;
}