wxRect DrawSimpleArrow(wxDC& dc, GtkWidget *widget, int button_state, wxRect const &in_rect, int orientation, GtkArrowType arrow_type) { int scroll_arrow_hlength, scroll_arrow_vlength; gtk_widget_style_get(widget, "scroll-arrow-hlength", &scroll_arrow_hlength, "scroll-arrow-vlength", &scroll_arrow_vlength, NULL); GtkStateType state; GtkShadowType shadow; ButtonStateAndShadow(button_state, state, shadow); wxRect out_rect; if (orientation == wxLEFT) out_rect.x = in_rect.x; else out_rect.x = in_rect.x + in_rect.width - scroll_arrow_hlength; out_rect.y = (in_rect.y + in_rect.height - 3 * gtk_widget_get_style(wxGTKPrivate::GetNotebookWidget())->ythickness - scroll_arrow_vlength) / 2; out_rect.width = scroll_arrow_hlength; out_rect.height = scroll_arrow_vlength; wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl(); GdkWindow* window = impldc->GetGDKWindow(); gtk_paint_arrow (gtk_widget_get_style(wxGTKPrivate::GetButtonWidget()), window, state, shadow, NULL, widget, "notebook", arrow_type, TRUE, out_rect.x, out_rect.y, out_rect.width, out_rect.height); return out_rect; }
static void run_functions (Test *test) { GtkStyle *style = styles[test->style]; if (test->function & FUNCTION_ARROW) gtk_paint_arrow (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, test->arrow_type, test->fill, 0, 0, 10, 10); if (test->function & FUNCTION_BOX) gtk_paint_box (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_SHADOW) gtk_paint_shadow (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_BOX_GAP) gtk_paint_box_gap (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10, test->gap_side, 0, 100); if (test->function & FUNCTION_SHADOW_GAP) gtk_paint_shadow_gap (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10, test->gap_side, 0, 100); if (test->function & FUNCTION_CHECK) gtk_paint_check (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_EXPANDER) gtk_paint_expander (style, window->window, test->state, NULL, widgets[test->widget], test->detail, 10, 10, test->expander_style); if (test->function & FUNCTION_EXTENSION) gtk_paint_extension (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10, test->gap_side); if (test->function & FUNCTION_FLAT_BOX) gtk_paint_flat_box (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_FOCUS) gtk_paint_focus (style, window->window, test->state, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_HANDLE) gtk_paint_handle (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10, test->orientation); if (test->function & FUNCTION_OPTION) gtk_paint_option (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_RESIZE_GRIP) gtk_paint_resize_grip (style, window->window, test->state, NULL, widgets[test->widget], test->detail, test->edge, 0, 0, 10, 10); if (test->function & FUNCTION_SLIDER) gtk_paint_slider (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10, test->orientation); if (test->function & FUNCTION_TAB) gtk_paint_tab (style, window->window, test->state, test->shadow, NULL, widgets[test->widget], test->detail, 0, 0, 10, 10); if (test->function & FUNCTION_HLINE) gtk_paint_hline (style, window->window, test->state, NULL, widgets[test->widget], test->detail, 1, 10, 4); if (test->function & FUNCTION_VLINE) gtk_paint_vline (style, window->window, test->state, NULL, widgets[test->widget], test->detail, 1, 10, 4); }
static VALUE style_paint_arrow(VALUE self, VALUE gdkwindow, VALUE state_type, VALUE shadow_type, VALUE area, VALUE widget, VALUE detail, VALUE arrow_type, VALUE fill, VALUE x, VALUE y, VALUE width, VALUE height) { gtk_paint_arrow(_SELF(self), GDK_WINDOW(RVAL2GOBJ(gdkwindow)), RVAL2STATE(state_type), RVAL2SHADOW(shadow_type), RVAL2REC(area), GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2CSTR(detail), RVAL2ARROW(arrow_type), RVAL2CBOOL(fill), NUM2INT(x), NUM2INT(y), NUM2INT(width), NUM2INT(height)); return self; }
static gboolean gimp_combo_tag_entry_expose (GtkWidget *widget, GdkEventExpose *event) { GimpComboTagEntry *entry = GIMP_COMBO_TAG_ENTRY (widget); if (! entry->arrow_pixbuf) { GtkStyle *style = gtk_widget_get_style (widget); GdkPixmap *pixmap; cairo_t *cr; pixmap = gdk_pixmap_new (gtk_widget_get_window (widget), 8, 8, -1); cr = gdk_cairo_create (pixmap); gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]); cairo_paint (cr); cairo_destroy (cr); gtk_paint_arrow (style, pixmap, GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, widget, NULL, GTK_ARROW_DOWN, TRUE, 0, 0, 8, 8); entry->arrow_pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, NULL, 0, 0, 0, 0, 8, 8); g_object_unref (pixmap); gtk_entry_set_icon_from_pixbuf (GTK_ENTRY (entry), GTK_ENTRY_ICON_SECONDARY, entry->arrow_pixbuf); } return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); }
static gboolean gimp_tag_popup_border_expose (GtkWidget *widget, GdkEventExpose *event, GimpTagPopup *popup) { GdkWindow *window = gtk_widget_get_window (widget); GtkStyle *style = gtk_widget_get_style (widget); GdkRectangle border; GdkRectangle upper; GdkRectangle lower; gint arrow_space; gint arrow_size; if (event->window != gtk_widget_get_window (widget)) return FALSE; get_arrows_visible_area (popup, &border, &upper, &lower, &arrow_space); arrow_size = 0.7 * arrow_space; gtk_paint_box (style, window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, &event->area, widget, "menu", 0, 0, -1, -1); if (popup->arrows_visible) { /* upper arrow */ gtk_paint_box (style, window, popup->upper_arrow_state, GTK_SHADOW_OUT, &event->area, widget, "menu", upper.x, upper.y, upper.width, upper.height); gtk_paint_arrow (style, window, popup->upper_arrow_state, GTK_SHADOW_OUT, &event->area, widget, "menu_scroll_arrow_up", GTK_ARROW_UP, TRUE, upper.x + (upper.width - arrow_size) / 2, upper.y + style->ythickness + (arrow_space - arrow_size) / 2, arrow_size, arrow_size); /* lower arrow */ gtk_paint_box (style, window, popup->lower_arrow_state, GTK_SHADOW_OUT, &event->area, widget, "menu", lower.x, lower.y, lower.width, lower.height); gtk_paint_arrow (style, window, popup->lower_arrow_state, GTK_SHADOW_OUT, &event->area, widget, "menu_scroll_arrow_down", GTK_ARROW_DOWN, TRUE, lower.x + (lower.width - arrow_size) / 2, lower.y + style->ythickness + (arrow_space - arrow_size) / 2, arrow_size, arrow_size); } return FALSE; }
void WidgetRenderingContext::gtkPaintArrow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, int arrowDirection, const gchar* detail) { GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; gtk_paint_arrow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, detail, static_cast<GtkArrowType>(arrowDirection), TRUE, paintRect.x, paintRect.y, paintRect.width, paintRect.height); }
static gint moz_gtk_scrollbar_button_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, GtkScrollbarButtonFlags flags, GtkTextDirection direction) { GtkStateType state_type = ConvertGtkState(state); GtkShadowType shadow_type = (state->active) ? GTK_SHADOW_IN : GTK_SHADOW_OUT; GdkRectangle arrow_rect; GtkStyle* style; GtkWidget *scrollbar; GtkAllocation allocation; GtkArrowType arrow_type; gint arrow_displacement_x, arrow_displacement_y; const char* detail = (flags & MOZ_GTK_STEPPER_VERTICAL) ? "vscrollbar" : "hscrollbar"; ensure_scrollbar_widget(); if (flags & MOZ_GTK_STEPPER_VERTICAL) scrollbar = gParts->vertScrollbarWidget; else scrollbar = gParts->horizScrollbarWidget; gtk_widget_set_direction(scrollbar, direction); /* Some theme engines (i.e., ClearLooks) check the scrollbar's allocation to determine where it should paint rounded corners on the buttons. We need to trick them into drawing the buttons the way we want them. */ gtk_widget_get_allocation(scrollbar, &allocation); allocation.x = rect->x; allocation.y = rect->y; allocation.width = rect->width; allocation.height = rect->height; if (flags & MOZ_GTK_STEPPER_VERTICAL) { allocation.height *= 5; if (flags & MOZ_GTK_STEPPER_DOWN) { arrow_type = GTK_ARROW_DOWN; if (flags & MOZ_GTK_STEPPER_BOTTOM) allocation.y -= 4 * rect->height; else allocation.y -= rect->height; } else { arrow_type = GTK_ARROW_UP; if (flags & MOZ_GTK_STEPPER_BOTTOM) allocation.y -= 3 * rect->height; } } else { allocation.width *= 5; if (flags & MOZ_GTK_STEPPER_DOWN) { arrow_type = GTK_ARROW_RIGHT; if (flags & MOZ_GTK_STEPPER_BOTTOM) allocation.x -= 4 * rect->width; else allocation.x -= rect->width; } else { arrow_type = GTK_ARROW_LEFT; if (flags & MOZ_GTK_STEPPER_BOTTOM) allocation.x -= 3 * rect->width; } } gtk_widget_set_allocation(scrollbar, &allocation); style = gtk_widget_get_style(scrollbar); TSOffsetStyleGCs(style, rect->x, rect->y); gtk_paint_box(style, drawable, state_type, shadow_type, cliprect, scrollbar, detail, rect->x, rect->y, rect->width, rect->height); arrow_rect.width = rect->width / 2; arrow_rect.height = rect->height / 2; arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2; arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2; if (state_type == GTK_STATE_ACTIVE) { gtk_widget_style_get(scrollbar, "arrow-displacement-x", &arrow_displacement_x, "arrow-displacement-y", &arrow_displacement_y, NULL); arrow_rect.x += arrow_displacement_x; arrow_rect.y += arrow_displacement_y; } gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, scrollbar, detail, arrow_type, TRUE, arrow_rect.x, arrow_rect.y, arrow_rect.width, arrow_rect.height); return MOZ_GTK_SUCCESS; }
static gint moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state, gboolean ishtml, GtkTextDirection direction) { GdkRectangle arrow_rect, real_arrow_rect; gint /* arrow_size, */ separator_width; gboolean wide_separators; GtkStateType state_type = ConvertGtkState(state); GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT; GtkStyle* style; GtkRequisition arrow_req; ensure_combo_box_widgets(); /* Also sets the direction on gParts->comboBoxButtonWidget, which is then * inherited by the separator and arrow */ moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL, gParts->comboBoxButtonWidget, direction); calculate_button_inner_rect(gParts->comboBoxButtonWidget, rect, &arrow_rect, direction, ishtml); /* Now arrow_rect contains the inner rect ; we want to correct the width * to what the arrow needs (see gtk_combo_box_size_allocate) */ gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req); if (direction == GTK_TEXT_DIR_LTR) arrow_rect.x += arrow_rect.width - arrow_req.width; arrow_rect.width = arrow_req.width; calculate_arrow_rect(gParts->comboBoxArrowWidget, &arrow_rect, &real_arrow_rect, direction); style = gtk_widget_get_style(gParts->comboBoxArrowWidget); TSOffsetStyleGCs(style, rect->x, rect->y); gtk_widget_size_allocate(gParts->comboBoxWidget, rect); gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, gParts->comboBoxArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, real_arrow_rect.x, real_arrow_rect.y, real_arrow_rect.width, real_arrow_rect.height); /* If there is no separator in the theme, there's nothing left to do. */ if (!gParts->comboBoxSeparatorWidget) return MOZ_GTK_SUCCESS; style = gtk_widget_get_style(gParts->comboBoxSeparatorWidget); TSOffsetStyleGCs(style, rect->x, rect->y); gtk_widget_style_get(gParts->comboBoxSeparatorWidget, "wide-separators", &wide_separators, "separator-width", &separator_width, NULL); if (wide_separators) { if (direction == GTK_TEXT_DIR_LTR) arrow_rect.x -= separator_width; else arrow_rect.x += arrow_rect.width; gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, cliprect, gParts->comboBoxSeparatorWidget, "vseparator", arrow_rect.x, arrow_rect.y, separator_width, arrow_rect.height); } else { if (direction == GTK_TEXT_DIR_LTR) arrow_rect.x -= XTHICKNESS(style); else arrow_rect.x += arrow_rect.width; gtk_paint_vline(style, drawable, GTK_STATE_NORMAL, cliprect, gParts->comboBoxSeparatorWidget, "vseparator", arrow_rect.y, arrow_rect.y + arrow_rect.height, arrow_rect.x); } return MOZ_GTK_SUCCESS; }
static void gtk_tearoff_menu_item_paint (GtkWidget *widget, GdkRectangle *area) { GtkMenuItem *menu_item; GtkShadowType shadow_type; gint width, height; gint x, y; gint right_max; GtkArrowType arrow_type; GtkTextDirection direction; if (GTK_WIDGET_DRAWABLE (widget)) { menu_item = GTK_MENU_ITEM (widget); direction = gtk_widget_get_direction (widget); x = widget->allocation.x + GTK_CONTAINER (menu_item)->border_width; y = widget->allocation.y + GTK_CONTAINER (menu_item)->border_width; width = widget->allocation.width - GTK_CONTAINER (menu_item)->border_width * 2; height = widget->allocation.height - GTK_CONTAINER (menu_item)->border_width * 2; right_max = x + width; if (widget->state == GTK_STATE_PRELIGHT) { gint selected_shadow_type; gtk_widget_style_get (widget, "selected-shadow-type", &selected_shadow_type, NULL); gtk_paint_box (widget->style, widget->window, GTK_STATE_PRELIGHT, selected_shadow_type, area, widget, "menuitem", x, y, width, height); } else gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height); if (GTK_IS_MENU (widget->parent) && GTK_MENU (widget->parent)->torn_off) { gint arrow_x; if (widget->state == GTK_STATE_PRELIGHT) shadow_type = GTK_SHADOW_IN; else shadow_type = GTK_SHADOW_OUT; if (menu_item->toggle_size > ARROW_SIZE) { if (direction == GTK_TEXT_DIR_LTR) { arrow_x = x + (menu_item->toggle_size - ARROW_SIZE)/2; arrow_type = GTK_ARROW_LEFT; } else { arrow_x = x + width - menu_item->toggle_size + (menu_item->toggle_size - ARROW_SIZE)/2; arrow_type = GTK_ARROW_RIGHT; } x += menu_item->toggle_size + BORDER_SPACING; } else { if (direction == GTK_TEXT_DIR_LTR) { arrow_x = ARROW_SIZE / 2; arrow_type = GTK_ARROW_LEFT; } else { arrow_x = x + width - 2 * ARROW_SIZE + ARROW_SIZE / 2; arrow_type = GTK_ARROW_RIGHT; } x += 2 * ARROW_SIZE; } gtk_paint_arrow (widget->style, widget->window, widget->state, shadow_type, NULL, widget, "tearoffmenuitem", arrow_type, FALSE, arrow_x, y + height / 2 - 5, ARROW_SIZE, ARROW_SIZE); } while (x < right_max) { gint x1, x2; if (direction == GTK_TEXT_DIR_LTR) { x1 = x; x2 = MIN (x + TEAR_LENGTH, right_max); } else { x1 = right_max - x; x2 = MAX (right_max - x - TEAR_LENGTH, 0); } gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL, NULL, widget, "tearoffmenuitem", x1, x2, y + (height - widget->style->ythickness) / 2); x += 2 * TEAR_LENGTH; } } }
gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) { /* g_message("Exposed!!! %s", GTK_WIDGET_HAS_FOCUS(widget) ? "XXX" : "---" ); */ gint insetX = 0; gint insetY = 0; (void)event; /* gint lower = widget->allocation.width; lower = (widget->allocation.height < lower) ? widget->allocation.height : lower; if ( lower > 16 ) { insetX++; if ( lower > 18 ) { insetX++; if ( lower > 22 ) { insetX++; if ( lower > 24 ) { insetX++; if ( lower > 32 ) { insetX++; } } } } insetY = insetX; } */ if ( GTK_WIDGET_DRAWABLE( widget ) ) { GtkStyle* style = gtk_widget_get_style( widget ); if ( insetX > 0 || insetY > 0 ) { gtk_paint_flat_box( style, widget->window, (GtkStateType)GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE, NULL, widget, NULL, 0, 0, widget->allocation.width, widget->allocation.height); } GdkGC *gc = gdk_gc_new( widget->window ); EekPreview* preview = EEK_PREVIEW(widget); GdkColor fg = {0, preview->_r, preview->_g, preview->_b}; gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE ); gdk_gc_set_foreground( gc, &fg ); gdk_draw_rectangle( widget->window, gc, TRUE, insetX, insetY, widget->allocation.width - (insetX * 2), widget->allocation.height - (insetY * 2) ); if ( preview->_linked ) { /* Draw arrow */ GdkRectangle possible = {insetX, insetY, (widget->allocation.width - (insetX * 2)), (widget->allocation.height - (insetY * 2)) }; GdkRectangle area = {possible.x, possible.y, possible.width / 2, possible.height / 2 }; /* Make it square */ if ( area.width > area.height ) area.width = area.height; if ( area.height > area.width ) area.height = area.width; /* Center it horizontally */ if ( area.width < possible.width ) { int diff = (possible.width - area.width) / 2; area.x += diff; } if ( preview->_linked & PREVIEW_LINK_IN ) { gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_IN, NULL, /* clip area. &area, */ widget, /* may be NULL */ NULL, /* detail */ GTK_ARROW_DOWN, FALSE, area.x, area.y, area.width, area.height ); } if ( preview->_linked & PREVIEW_LINK_OUT ) { GdkRectangle otherArea = {area.x, area.y, area.width, area.height}; if ( otherArea.height < possible.height ) { otherArea.y = possible.y + (possible.height - otherArea.height); } gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_OUT, NULL, /* clip area. &area, */ widget, /* may be NULL */ NULL, /* detail */ GTK_ARROW_UP, FALSE, otherArea.x, otherArea.y, otherArea.width, otherArea.height ); } if ( preview->_linked & PREVIEW_LINK_OTHER ) { GdkRectangle otherArea = {insetX, area.y, area.width, area.height}; if ( otherArea.height < possible.height ) { otherArea.y = possible.y + (possible.height - otherArea.height) / 2; } gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_OUT, NULL, /* clip area. &area, */ widget, /* may be NULL */ NULL, /* detail */ GTK_ARROW_LEFT, FALSE, otherArea.x, otherArea.y, otherArea.width, otherArea.height ); } } if ( GTK_WIDGET_HAS_FOCUS(widget) ) { gtk_paint_focus( style, widget->window, GTK_STATE_NORMAL, NULL, /* GdkRectangle *area, */ widget, NULL, 0 + 1, 0 + 1, widget->allocation.width - 2, widget->allocation.height - 2 ); } } return FALSE; }
gboolean eek_preview_expose_event( GtkWidget* widget, GdkEventExpose* event ) { /* g_message("Exposed!!! %s", GTK_WIDGET_HAS_FOCUS(widget) ? "XXX" : "---" ); */ gint insetX = 0; gint insetY = 0; (void)event; /* gint lower = widget->allocation.width; lower = (widget->allocation.height < lower) ? widget->allocation.height : lower; if ( lower > 16 ) { insetX++; if ( lower > 18 ) { insetX++; if ( lower > 22 ) { insetX++; if ( lower > 24 ) { insetX++; if ( lower > 32 ) { insetX++; } } } } insetY = insetX; } */ if ( GTK_WIDGET_DRAWABLE( widget ) ) { GtkStyle* style = gtk_widget_get_style( widget ); if ( insetX > 0 || insetY > 0 ) { gtk_paint_flat_box( style, widget->window, (GtkStateType)GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE, NULL, widget, NULL, 0, 0, widget->allocation.width, widget->allocation.height); } GdkGC *gc = gdk_gc_new( widget->window ); EekPreview* preview = EEK_PREVIEW(widget); GdkColor fg = {0, static_cast<guint16>(preview->_r), static_cast<guint16>(preview->_g), static_cast<guint16>(preview->_b)}; gdk_colormap_alloc_color( gdk_colormap_get_system(), &fg, FALSE, TRUE ); gdk_gc_set_foreground( gc, &fg ); gdk_draw_rectangle( widget->window, gc, TRUE, insetX, insetY, widget->allocation.width - (insetX * 2), widget->allocation.height - (insetY * 2) ); if ( preview->_previewPixbuf ) { GtkDrawingArea* da = &(preview->drawing); GdkDrawable* drawable = (GdkDrawable*) (((GtkWidget*)da)->window); gint w = 0; gint h = 0; gdk_drawable_get_size(drawable, &w, &h); if ((w != preview->_scaledW) || (h != preview->_scaledH)) { if (preview->_scaled) { g_object_unref(preview->_scaled); } preview->_scaled = gdk_pixbuf_scale_simple(preview->_previewPixbuf, w, h, GDK_INTERP_BILINEAR); preview->_scaledW = w; preview->_scaledH = h; } GdkPixbuf* pix = (preview->_scaled) ? preview->_scaled : preview->_previewPixbuf; gdk_draw_pixbuf( drawable, 0, pix, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0 ); } if ( preview->_linked ) { /* Draw arrow */ GdkRectangle possible = {insetX, insetY, (widget->allocation.width - (insetX * 2)), (widget->allocation.height - (insetY * 2)) }; GdkRectangle area = {possible.x, possible.y, possible.width / 2, possible.height / 2 }; /* Make it square */ if ( area.width > area.height ) area.width = area.height; if ( area.height > area.width ) area.height = area.width; /* Center it horizontally */ if ( area.width < possible.width ) { int diff = (possible.width - area.width) / 2; area.x += diff; } if ( preview->_linked & PREVIEW_LINK_IN ) { gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_IN, NULL, /* clip area. &area, */ widget, /* may be NULL */ NULL, /* detail */ GTK_ARROW_DOWN, FALSE, area.x, area.y, area.width, area.height ); } if ( preview->_linked & PREVIEW_LINK_OUT ) { GdkRectangle otherArea = {area.x, area.y, area.width, area.height}; if ( otherArea.height < possible.height ) { otherArea.y = possible.y + (possible.height - otherArea.height); } gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_OUT, NULL, /* clip area. &area, */ widget, /* may be NULL */ NULL, /* detail */ GTK_ARROW_DOWN, FALSE, otherArea.x, otherArea.y, otherArea.width, otherArea.height ); } if ( preview->_linked & PREVIEW_LINK_OTHER ) { GdkRectangle otherArea = {insetX, area.y, area.width, area.height}; if ( otherArea.height < possible.height ) { otherArea.y = possible.y + (possible.height - otherArea.height) / 2; } gtk_paint_arrow( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_OUT, NULL, /* clip area. &area, */ widget, /* may be NULL */ NULL, /* detail */ GTK_ARROW_LEFT, FALSE, otherArea.x, otherArea.y, otherArea.width, otherArea.height ); } if ( preview->_linked & PREVIEW_FILL ) { GdkRectangle otherArea = {possible.x + ((possible.width / 4) - (area.width / 2)), area.y, area.width, area.height}; if ( otherArea.height < possible.height ) { otherArea.y = possible.y + (possible.height - otherArea.height) / 2; } gtk_paint_check( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_OUT, NULL, widget, NULL, otherArea.x, otherArea.y, otherArea.width, otherArea.height ); } if ( preview->_linked & PREVIEW_STROKE ) { GdkRectangle otherArea = {possible.x + (((possible.width * 3) / 4) - (area.width / 2)), area.y, area.width, area.height}; if ( otherArea.height < possible.height ) { otherArea.y = possible.y + (possible.height - otherArea.height) / 2; } gtk_paint_diamond( style, widget->window, (GtkStateType)widget->state, GTK_SHADOW_ETCHED_OUT, NULL, widget, NULL, otherArea.x, otherArea.y, otherArea.width, otherArea.height ); } } if ( GTK_WIDGET_HAS_FOCUS(widget) ) { gtk_paint_focus( style, widget->window, GTK_STATE_NORMAL, NULL, /* GdkRectangle *area, */ widget, NULL, 0 + 1, 0 + 1, widget->allocation.width - 2, widget->allocation.height - 2 ); } } return FALSE; }