static void sp_color_preview_paint (SPColorPreview *cp, GdkRectangle *area) { GtkWidget *widget; GdkRectangle warea, carea; GdkRectangle wpaint, cpaint; gint bx, by, w2; widget = GTK_WIDGET (cp); warea.x = widget->allocation.x; warea.y = widget->allocation.y; warea.width = widget->allocation.width; warea.height = widget->allocation.height; if (!gdk_rectangle_intersect (area, &warea, &wpaint)) return; /* Draw shadow */ gtk_draw_shadow (widget->style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_IN, warea.x, warea.y, warea.width, warea.height); /* Transparent area */ bx = widget->style->xthickness; by = widget->style->ythickness; w2 = warea.width / 2; carea.x = warea.x + bx; carea.y = warea.y + by; carea.width = w2 - bx; carea.height = warea.height - 2 * by; if (gdk_rectangle_intersect (area, &carea, &cpaint)) { nr_gdk_draw_rgba32_solid (widget->window, widget->style->black_gc, cpaint.x, cpaint.y, cpaint.width, cpaint.height, cp->rgba); } /* Solid area */ carea.x = warea.x + w2; carea.y = warea.y + by; carea.width = warea.width - bx - w2; carea.height = warea.height - 2 * by; if (gdk_rectangle_intersect (area, &carea, &cpaint)) { nr_gdk_draw_rgba32_solid (widget->window, widget->style->black_gc, cpaint.x, cpaint.y, cpaint.width, cpaint.height, cp->rgba | 0xff); } }
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); if (!win->m_hasVMT) return; if (gdk_event->count > 0) return; GtkPizza *pizza = GTK_PIZZA(widget); gtk_draw_shadow( widget->style, pizza->bin_window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, 0, 0, win->m_width, win->m_height ); if (!win->GetTitle().empty() && ((win->GetWindowStyle() & wxCAPTION) || (win->GetWindowStyle() & wxTINY_CAPTION_HORIZ) || (win->GetWindowStyle() & wxTINY_CAPTION_VERT))) { wxClientDC dc(win); dc.SetFont( *wxSMALL_FONT ); int height = dc.GetCharHeight(); GdkGC *gc = gdk_gc_new( pizza->bin_window ); gdk_gc_set_foreground( gc, &widget->style->bg[GTK_STATE_SELECTED] ); gdk_draw_rectangle( pizza->bin_window, gc, TRUE, 3, 3, win->m_width - 7, height+1 ); gdk_gc_unref( gc ); // Hack alert static_cast<wxClientDCImpl *>(dc.GetImpl())->m_window = pizza->bin_window; dc.SetTextForeground( *wxWHITE ); dc.DrawText( win->GetTitle(), 6, 3 ); } }
static void gtk_real_check_item_draw_indicator (GtkCheckItem *check_item, GdkRectangle *area) { GtkWidget *widget; GtkToggleButton *toggle_button; GtkStateType state_type; GdkRectangle restrict_area; GdkRectangle new_area; GdkGC *fg_gc = NULL; gint width, height; gint x, y; gint border; GdkWindow *window; g_return_if_fail (check_item != NULL); g_return_if_fail (GTK_IS_CHECK_ITEM (check_item)); widget = GTK_WIDGET (check_item); toggle_button = GTK_TOGGLE_BUTTON (check_item); if (GTK_WIDGET_DRAWABLE (check_item)) { window = widget->window; state_type = GTK_WIDGET_STATE (widget); if (state_type != GTK_STATE_NORMAL && state_type != GTK_STATE_PRELIGHT) state_type = GTK_STATE_NORMAL; restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width; restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width; restrict_area.width = widget->allocation.width - ( 2 * GTK_CONTAINER (widget)->border_width); restrict_area.height = widget->allocation.height - ( 2 * GTK_CONTAINER (widget)->border_width); if (gdk_rectangle_intersect (area, &restrict_area, &new_area)) { if (state_type != GTK_STATE_NORMAL) gtk_paint_flat_box (widget->style, window, state_type, GTK_SHADOW_ETCHED_OUT, area, widget, "checkitem", new_area.x, new_area.y, new_area.width, new_area.height); } x = widget->allocation.x + CHECK_ITEM_CLASS (widget)->indicator_spacing + GTK_CONTAINER (widget)->border_width; y = widget->allocation.y + (widget->allocation.height - CHECK_ITEM_CLASS (widget)->indicator_size) / 2; width = CHECK_ITEM_CLASS (widget)->indicator_size; height = CHECK_ITEM_CLASS (widget)->indicator_size; if(!GTK_BIN(widget)->child){ x = widget->allocation.x + widget->allocation.width/2 - width/2; y = widget->allocation.y + widget->allocation.height/2 - height/2; } if (GTK_TOGGLE_BUTTON (widget)->active) { state_type = GTK_STATE_ACTIVE; } else { state_type = GTK_STATE_NORMAL; } fg_gc = gdk_gc_new(window); gdk_gc_set_foreground(fg_gc, &widget->style->white); gdk_draw_rectangle(window, fg_gc, TRUE, x, y, width, height); gtk_draw_shadow (widget->style, window, GTK_STATE_NORMAL, GTK_SHADOW_IN, x, y, width, height); if(state_type == GTK_STATE_ACTIVE){ GdkPoint points[3]; border = widget->style->klass->xthickness; gdk_gc_set_foreground(fg_gc, &widget->style->black); x += border; y += border; points[0].x = x+1; points[0].y = y+6; points[1].x = x+3; points[1].y = y+height-2*border-2; points[2].x = x+width-2*border-2; points[2].y = y+3; gdk_draw_lines(window, fg_gc, points, 3); points[0].x = x+1; points[0].y = y+5; points[1].x = x+3; points[1].y = y+height-2*border-3; points[2].x = x+width-2*border-2; points[2].y = y+2; gdk_draw_lines(window, fg_gc, points, 3); points[0].x = x+1; points[0].y = y+4; points[1].x = x+3; points[1].y = y+height-2*border-4; points[2].x = x+width-2*border-2; points[2].y = y+1; gdk_draw_lines(window, fg_gc, points, 3); } } gdk_gc_unref(fg_gc); }