static void gimp_histogram_editor_frozen_update (GimpHistogramEditor *editor, const GParamSpec *pspec) { GimpHistogramView *view = GIMP_HISTOGRAM_BOX (editor->box)->view; if (gimp_viewable_preview_is_frozen (GIMP_VIEWABLE (editor->drawable))) { /* Only do the background histogram if the histogram is visible. * This is a workaround for the fact that recalculating the * histogram is expensive and that it is only validated when it * is shown. So don't slow down painting by doing something that * is not even seen by the user. */ if (! editor->bg_histogram && gtk_widget_is_drawable (GTK_WIDGET (editor))) { if (gimp_histogram_editor_validate (editor)) editor->bg_histogram = gimp_histogram_duplicate (editor->histogram); gimp_histogram_view_set_background (view, editor->bg_histogram); } } else if (editor->bg_histogram) { g_object_unref (editor->bg_histogram); editor->bg_histogram = NULL; gimp_histogram_view_set_background (view, NULL); } }
/** * ppg_ruler_size_allocate: * @ruler: (in): A #PpgRuler. * * Handle the "size-allocate" for the #GtkWidget. The pixmap for the * background is created and drawn if necessary. * * Returns: None. * Side effects: None. */ static void ppg_ruler_size_allocate (GtkWidget *widget, GtkAllocation *alloc) { PpgRuler *ruler = (PpgRuler *)widget; PpgRulerPrivate *priv; GdkWindow *window; g_return_if_fail(PPG_IS_RULER(ruler)); priv = ruler->priv; GTK_WIDGET_CLASS(ppg_ruler_parent_class)->size_allocate(widget, alloc); if (priv->ruler) { cairo_surface_destroy(priv->ruler); } if (gtk_widget_is_drawable(widget)) { window = gtk_widget_get_window(widget); priv->ruler = gdk_window_create_similar_surface(window, CAIRO_CONTENT_COLOR_ALPHA, alloc->width, alloc->height); ppg_ruler_draw_ruler(ruler); } }
static void sp_gradient_image_update (SPGradientImage *image) { if (gtk_widget_is_drawable (GTK_WIDGET(image))) { gtk_widget_queue_draw (GTK_WIDGET (image)); } }
static gboolean gimp_ruler_expose (GtkWidget *widget, GdkEventExpose *event) { if (gtk_widget_is_drawable (widget)) { GimpRuler *ruler = GIMP_RULER (widget); GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler); GtkAllocation allocation; cairo_t *cr; gimp_ruler_draw_ticks (ruler); cr = gdk_cairo_create (gtk_widget_get_window (widget)); gdk_cairo_region (cr, event->region); cairo_clip (cr); gtk_widget_get_allocation (widget, &allocation); cairo_translate (cr, allocation.x, allocation.y); cairo_set_source_surface (cr, priv->backing_store, 0, 0); cairo_paint (cr); gimp_ruler_draw_pos (ruler); cairo_destroy (cr); } return FALSE; }
static GdkScreen * cdisplay_lcms_get_screen (CdisplayLcms *lcms, gint *monitor) { GimpColorManaged *managed; GdkScreen *screen; managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms)); if (GTK_IS_WIDGET (managed)) screen = gtk_widget_get_screen (GTK_WIDGET (managed)); else screen = gdk_screen_get_default (); g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); if (GTK_IS_WIDGET (managed) && gtk_widget_is_drawable (GTK_WIDGET (managed))) { GtkWidget *widget = GTK_WIDGET (managed); *monitor = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget)); } else { *monitor = 0; } return screen; }
static void check_buttonbox_child_position (GtkWidget *child, ThemeMatchData *match_data) { GList *children = NULL; GList *l; GtkWidget *bbox; gboolean secondary; g_assert (GTK_IS_BUTTON_BOX (child->parent)); bbox = child->parent; secondary = gtk_button_box_get_child_secondary (GTK_BUTTON_BOX (bbox), child); for (l = GTK_BOX (bbox)->children; l != NULL; l = l->next) { GtkBoxChild *child_info = l->data; GtkWidget *widget = child_info->widget; if (child_info->is_secondary == secondary && gtk_widget_is_drawable (widget)) children = g_list_prepend (children, widget); } check_child_position (child, children, match_data); g_list_free (children); }
static gboolean gimp_view_expose_event (GtkWidget *widget, GdkEventExpose *event) { if (gtk_widget_is_drawable (widget)) { GtkAllocation allocation; cairo_t *cr; gtk_widget_get_allocation (widget, &allocation); cr = gdk_cairo_create (event->window); gdk_cairo_region (cr, event->region); cairo_clip (cr); cairo_translate (cr, allocation.x, allocation.y); gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer, widget, cr, allocation.width, allocation.height); cairo_destroy (cr); } return FALSE; }
static gboolean panel_frame_expose(GtkWidget* widget, GdkEventExpose* event) #endif { PanelFrame *frame = (PanelFrame *) widget; gboolean retval = FALSE; if (!gtk_widget_is_drawable (widget)) return retval; #if GTK_CHECK_VERSION (3, 0, 0) if (GTK_WIDGET_CLASS (panel_frame_parent_class)->draw) retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->draw (widget, cr); #else if (GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event) retval = GTK_WIDGET_CLASS (panel_frame_parent_class)->expose_event (widget, event); #endif #if GTK_CHECK_VERSION (3, 0, 0) panel_frame_draw (widget, cr, frame->edges); #else panel_frame_draw (widget, frame->edges); #endif return retval; }
static gboolean panel_icon_grid_expose(GtkWidget *widget, GdkEventExpose *event) #endif { if (gtk_widget_is_drawable(widget)) { if (gtk_widget_get_has_window(widget) && !gtk_widget_get_app_paintable(widget)) #if GTK_CHECK_VERSION(3, 0, 0) gtk_render_background(gtk_widget_get_style_context(widget), cr, 0, 0, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget)); #else gtk_paint_flat_box(gtk_widget_get_style(widget), gtk_widget_get_window(widget), gtk_widget_get_state(widget), GTK_SHADOW_NONE, &event->area, widget, "panelicongrid", 0, 0, -1, -1); #endif #if GTK_CHECK_VERSION(3, 0, 0) GTK_WIDGET_CLASS(panel_icon_grid_parent_class)->draw(widget, cr); #else GTK_WIDGET_CLASS(panel_icon_grid_parent_class)->expose_event(widget, event); #endif } return FALSE; }
/* update the animation information for each widget. This will also queue a redraw * and stop the animation if it is done. */ static gboolean update_animation_info (gpointer key, gpointer value, gpointer user_data) { AnimationInfo *animation_info = value; GtkWidget *widget = key; g_assert ((widget != NULL) && (animation_info != NULL)); /* remove the widget from the hash table if it is not drawable */ if (!gtk_widget_is_drawable (widget)) { return TRUE; } if (GE_IS_PROGRESS_BAR (widget)) { gfloat fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)); /* stop animation for filled/not filled progress bars */ if (fraction <= 0.0 || fraction >= 1.0) return TRUE; } force_widget_redraw (widget); /* stop at stop_time */ if (animation_info->stop_time != 0 && g_timer_elapsed (animation_info->timer, NULL) > animation_info->stop_time) return TRUE; return FALSE; }
static gboolean gb_progress_bar_draw (GtkWidget *widget, cairo_t *cr) { GbProgressBarPrivate *priv; GtkStyleContext *context; GbProgressBar *bar = (GbProgressBar *)widget; GtkAllocation allocation; GtkStateType state; GdkRGBA color = { 0 }; g_return_val_if_fail(GB_IS_PROGRESS_BAR(bar), FALSE); priv = bar->priv; if (gtk_widget_is_drawable(widget)) { gtk_widget_get_allocation(widget, &allocation); state = gtk_widget_get_state(widget); context = gtk_widget_get_style_context(widget); gtk_style_context_get_color(context, state, &color); cairo_save(cr); cairo_rectangle(cr, 0, 0, priv->fraction * allocation.width, allocation.height); gdk_cairo_set_source_rgba(cr, &color); cairo_fill(cr); cairo_restore(cr); } return FALSE; }
static gboolean xfce_arrow_button_draw (GtkWidget *widget, cairo_t *cr) { gint x, y, w; GtkStyleContext *context; xfce_arrow_button_thickness thickness; GtkAllocation allocation; if (G_LIKELY (gtk_widget_is_drawable (widget))) { context = gtk_widget_get_style_context (widget); xfce_arrow_button_get_thickness (context, &thickness); gtk_widget_get_allocation (widget, &allocation); w = MIN (allocation.height - 2 * thickness.y, allocation.width - 2 * thickness.x); w = MIN (w, ARROW_WIDTH); x = (allocation.width - w) / 2; y = (allocation.height - w) / 2; GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); gtk_style_context_save (context); gtk_style_context_set_state (context, gtk_widget_get_state_flags (widget)); gtk_render_arrow (context, cr, G_PI, x, y, w); gtk_style_context_restore (context); } return TRUE; }
static void nruler_make_pixmap(Nruler *ruler, GtkWidget *widget, GtkWidget *parent) { gint width; gint height; GtkAllocation allocation, parent_allocation; if (! gtk_widget_is_drawable(widget)) { return; } gtk_widget_get_allocation(widget, &allocation); gtk_widget_get_allocation(parent, &parent_allocation); if (ruler->orientation == GTK_ORIENTATION_HORIZONTAL) { ruler->length = parent_allocation.width; ruler->size = allocation.height; ruler->ofst = (parent_allocation.width - allocation.width) / 2; } else { ruler->length = parent_allocation.height; ruler->size = allocation.width; ruler->ofst = (parent_allocation.height - allocation.height) / 2; } if (ruler->backing_store) { #if GTK_CHECK_VERSION(3, 0, 0) width = cairo_image_surface_get_width(ruler->backing_store); height = cairo_image_surface_get_height(ruler->backing_store); #elif GTK_CHECK_VERSION(2, 24, 0) gdk_pixmap_get_size(ruler->backing_store, &width, &height); #else gdk_drawable_get_size(ruler->backing_store, &width, &height); #endif if ((width == allocation.width) && (height == allocation.height)) { return; } #if GTK_CHECK_VERSION(3, 0, 0) cairo_surface_destroy(ruler->backing_store); #else g_object_unref(ruler->backing_store); #endif } #if GTK_CHECK_VERSION(3, 0, 0) ruler->backing_store = cairo_image_surface_create(CAIRO_FORMAT_RGB24, allocation.width, allocation.height); #else ruler->backing_store = gdk_pixmap_new(gtk_widget_get_window(widget), allocation.width, allocation.height, -1); #endif ruler->save_l = 0; ruler->save_u = 0; }
gboolean nsgtk_widget_is_drawable(GtkWidget *widget) { #if GTK_CHECK_VERSION(2,18,0) return gtk_widget_is_drawable(widget); #else return GTK_WIDGET_DRAWABLE(widget); #endif }
static GdkRectangle gimp_ruler_get_pos_rect (GimpRuler *ruler, gdouble position) { GtkWidget *widget = GTK_WIDGET (ruler); GtkStyleContext *context = gtk_widget_get_style_context (widget); GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler); GtkAllocation allocation; GtkBorder border; gint width, height; gdouble upper, lower; gdouble increment; GdkRectangle rect = { 0, }; if (! gtk_widget_is_drawable (widget)) return rect; gtk_widget_get_allocation (widget, &allocation); gtk_style_context_get_border (context, 0, &border); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { width = allocation.width; height = allocation.height - (border.top + border.bottom); rect.width = height / 2 + 2; rect.width |= 1; /* make sure it's odd */ rect.height = rect.width / 2 + 1; } else { width = allocation.width - (border.left + border.right); height = allocation.height; rect.height = width / 2 + 2; rect.height |= 1; /* make sure it's odd */ rect.width = rect.height / 2 + 1; } gimp_ruler_get_range (ruler, &lower, &upper, NULL); if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { increment = (gdouble) width / (upper - lower); rect.x = ROUND ((position - lower) * increment) + (border.left + border.right - rect.width) / 2 - 1; rect.y = (height + rect.height) / 2 + border.top; } else { increment = (gdouble) height / (upper - lower); rect.x = (width + rect.width) / 2 + border.left; rect.y = ROUND ((position - lower) * increment) + (border.top + border.bottom - rect.height) / 2 - 1; } return rect; }
void selectcolor_set_circle(GtkWidget * sc, gboolean circle) { g_return_if_fail(sc != NULL); g_return_if_fail(IS_SELECT_COLOR(sc)); SELECT_COLOR(sc)->circle = circle; if (gtk_widget_is_drawable(GTK_WIDGET(sc))) { selectcolor_paint(sc); } }
void scope_setdata(Scope *scope, short *samples) { g_return_if_fail(scope != NULL); g_return_if_fail(IS_SCOPE(scope)); memcpy(scope->y, samples, sizeof(scope->y)); if (gtk_widget_is_drawable(GTK_WIDGET(scope))) { if (!scope->idlefunc) scope->idlefunc = g_idle_add_full(PRIO, idle_callback, scope, NULL); } }
void selectcolor_set_color(GtkWidget * sc, gint color) { g_return_if_fail(sc != NULL); g_return_if_fail(IS_SELECT_COLOR(sc)); SELECT_COLOR(sc)->color = color; if (gtk_widget_is_drawable(GTK_WIDGET(sc))) { selectcolor_paint(sc); } }
static gint idle_callback(gpointer data) { g_return_val_if_fail(data != NULL, FALSE); g_return_val_if_fail(IS_SCOPE(data), FALSE); SCOPE(data)->idlefunc = 0; if (!gtk_widget_is_drawable(GTK_WIDGET(data))) return FALSE; draw(SCOPE(data)); return FALSE; /* don't call this callback again */ }
static gboolean gimp_palette_view_expose (GtkWidget *widget, GdkEventExpose *eevent) { GimpPaletteView *pal_view = GIMP_PALETTE_VIEW (widget); GimpView *view = GIMP_VIEW (widget); if (! gtk_widget_is_drawable (widget)) return FALSE; GTK_WIDGET_CLASS (parent_class)->expose_event (widget, eevent); if (view->renderer->viewable && pal_view->selected) { GimpViewRendererPalette *renderer; GtkStyle *style = gtk_widget_get_style (widget); GtkAllocation allocation; cairo_t *cr; gint row, col; renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer); gtk_widget_get_allocation (widget, &allocation); row = pal_view->selected->position / renderer->columns; col = pal_view->selected->position % renderer->columns; cr = gdk_cairo_create (gtk_widget_get_window (widget)); gdk_cairo_region (cr, eevent->region); cairo_clip (cr); cairo_translate (cr, allocation.x, allocation.y); cairo_rectangle (cr, col * renderer->cell_width + 0.5, row * renderer->cell_height + 0.5, renderer->cell_width, renderer->cell_height); cairo_set_line_width (cr, 1.0); gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_SELECTED]); cairo_stroke_preserve (cr); if (gimp_cairo_set_focus_line_pattern (cr, widget)) { gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]); cairo_stroke (cr); } cairo_destroy (cr); } return FALSE; }
void gimp_widget_flush_expose (GtkWidget *widget) { g_return_if_fail (GTK_IS_WIDGET (widget)); if (! gtk_widget_is_drawable (widget)) return; gdk_window_process_updates (gtk_widget_get_window (widget), FALSE); gdk_flush (); }
static void gimp_progress_bar_pulse (gpointer user_data) { GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar)); if (gtk_widget_is_drawable (GTK_WIDGET (bar))) while (gtk_events_pending ()) gtk_main_iteration (); }
/* This should be points_per_unit. This is the size of the unit * in 1/72nd's of an inch and has nothing to do with screen pixels */ gdouble pixels_per_unit; gdouble ruler_scale[MAXIMUM_SCALES]; gint subdivide[MAXIMUM_SUBDIVIDE]; /* five possible modes of subdivision */ }; static const struct _NrulerMetric Metric = { "Centimeters", "Cn", 28.35, { 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 }, { 1, 5, 10, 50, 100 } }; #define RULER_DATA_KEY "nruler" static void nruler_make_pixmap(Nruler *ruler, GtkWidget *widget, GtkWidget *parent); static void nruler_draw_ticks(Nruler *ruler, GtkWidget *widget); static void nruler_realize(GtkWidget *widget, gpointer user_data); static void nruler_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data); static gboolean nruler_destroy(GtkWidget *widget, gpointer user_data); #if GTK_CHECK_VERSION(3, 0, 0) static void nruler_draw_pos(Nruler *ruler, GtkWidget *widget, cairo_t *cr); static gboolean nruler_expose(GtkWidget *widget, cairo_t *cr, gpointer user_data); static GtkStyleContext *nruler_get_color(Nruler *ruler, GdkRGBA *fg); #else /* GTK_CHECK_VERSION(3, 0, 0) */ static void nruler_draw_pos(Nruler *ruler, GtkWidget *widget); static gboolean nruler_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); static void nruler_get_color(Nruler *ruler, GdkColor *fg, GdkColor *bg); #endif /* GTK_CHECK_VERSION(3, 0, 0) */ GtkWidget * nruler_new(GtkOrientation orientation) { Nruler *ruler; GtkWidget *w, *frame; ruler = g_malloc0(sizeof(*ruler)); if (ruler == NULL) { return NULL; } w = gtk_drawing_area_new(); if (orientation == GTK_ORIENTATION_VERTICAL) { gtk_widget_set_size_request(w, RULER_WIDTH, -1); } else { gtk_widget_set_size_request(w, -1, RULER_WIDTH); } frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); gtk_container_add(GTK_CONTAINER(frame), w); ruler->orientation = orientation; ruler->widget = w; ruler->parent = frame; #if GTK_CHECK_VERSION(3, 0, 0) ruler->saved_style = NULL; #endif g_object_set_data(G_OBJECT(frame), RULER_DATA_KEY, ruler); #if GTK_CHECK_VERSION(3, 0, 0) g_signal_connect(w, "draw", G_CALLBACK(nruler_expose), ruler); #else /* GTK_CHECK_VERSION(3, 0, 0) */ g_signal_connect(w, "expose-event", G_CALLBACK(nruler_expose), ruler); #endif /* GTK_CHECK_VERSION(3, 0, 0) */ g_signal_connect(w, "realize", G_CALLBACK(nruler_realize), ruler); g_signal_connect(w, "size-allocate", G_CALLBACK(nruler_size_allocate), ruler); g_signal_connect(frame, "unrealize", G_CALLBACK(nruler_destroy), ruler); return frame; } void nruler_set_range(GtkWidget *frame, double lower, double upper) { Nruler *ruler; if (frame == NULL) { return; } ruler = g_object_get_data(G_OBJECT(frame), RULER_DATA_KEY); if (ruler == NULL) { return; } ruler->lower = lower; ruler->upper = upper; if (gtk_widget_is_drawable(ruler->widget)) { gtk_widget_queue_draw(ruler->widget); } } void nruler_set_position(GtkWidget *frame, double position) { Nruler *ruler; if (frame == NULL) { return; } ruler = g_object_get_data(G_OBJECT(frame), RULER_DATA_KEY); if (ruler == NULL) { return; } ruler->position = position; if (gtk_widget_is_drawable(ruler->widget)) { gtk_widget_queue_draw(ruler->widget); } } static gboolean nruler_destroy(GtkWidget *widget, gpointer user_data) { Nruler *ruler; g_object_set_data(G_OBJECT(widget), RULER_DATA_KEY, NULL); ruler = (Nruler *) user_data; if (ruler) { if (ruler->backing_store) { #if GTK_CHECK_VERSION(3, 0, 0) cairo_surface_destroy(ruler->backing_store); #else g_object_unref(ruler->backing_store); #endif } g_free(ruler); } return FALSE; } static void nruler_size_allocate(GtkWidget *widget, GtkAllocation *allocation, gpointer user_data) { Nruler *ruler; ruler = (Nruler *) user_data; nruler_make_pixmap(ruler, widget, ruler->parent); } static void nruler_realize(GtkWidget *widget, gpointer user_data) { Nruler *ruler; ruler = (Nruler *) user_data; nruler_make_pixmap(ruler, widget, ruler->parent); } #if GTK_CHECK_VERSION(3, 0, 0) static gboolean nruler_expose(GtkWidget *widget, cairo_t *cr, gpointer user_data) { if (gtk_widget_is_drawable(widget)) { Nruler *ruler = (Nruler *) user_data; nruler_draw_ticks(ruler, widget); nruler_draw_pos(ruler, widget, cr); } return FALSE; } #else /* GTK_CHECK_VERSION(3, 0, 0) */ static gboolean nruler_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) { if (gtk_widget_is_drawable(widget)) { Nruler *ruler = (Nruler *) user_data; nruler_draw_ticks(ruler, widget); nruler_draw_pos(ruler, widget); } return FALSE; }
static void gimp_progress_bar_set_text (const gchar *message, gpointer user_data) { GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data); gtk_progress_bar_set_text (GTK_PROGRESS_BAR (bar), message ? message : " "); if (gtk_widget_is_drawable (GTK_WIDGET (bar))) while (gtk_events_pending ()) gtk_main_iteration (); }
static gboolean test_widgets_for_current_action (GtkFileChooserDialog *dialog, GtkFileChooserAction expected_action) { GtkFileChooserDefault *impl; gboolean passed; if (gtk_file_chooser_get_action (GTK_FILE_CHOOSER (dialog)) != expected_action) return FALSE; impl = get_impl_from_dialog (GTK_WIDGET (dialog)); g_assert (impl->action == expected_action); passed = TRUE; /* OPEN implies that the "new folder" button is hidden; otherwise it is shown */ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN) passed = passed && !gtk_widget_get_visible (impl->browse_new_folder_button); else passed = passed && gtk_widget_get_visible (impl->browse_new_folder_button); /* Check that the widgets are present/visible or not */ if (has_action (open_actions, G_N_ELEMENTS (open_actions), impl->action)) { passed = passed && (impl->save_widgets == NULL && (impl->location_mode == LOCATION_MODE_PATH_BAR ? impl->location_entry == NULL : impl->location_entry != NULL) && impl->save_folder_label == NULL && impl->save_folder_combo == NULL && impl->save_expander == NULL && GTK_IS_CONTAINER (impl->browse_widgets) && gtk_widget_is_drawable (impl->browse_widgets)); } else if (has_action (save_actions, G_N_ELEMENTS (save_actions), impl->action)) { /* FIXME: we can't use GTK_IS_FILE_CHOOSER_ENTRY() because it uses * _gtk_file_chooser_entry_get_type(), which is a non-exported symbol. * So, we just test impl->location_entry for being non-NULL */ passed = passed && (GTK_IS_CONTAINER (impl->save_widgets) && gtk_widget_is_drawable (impl->save_widgets) && impl->location_entry != NULL && gtk_widget_is_drawable (impl->location_entry) && GTK_IS_LABEL (impl->save_folder_label) && gtk_widget_is_drawable (impl->save_folder_label) && GTK_IS_COMBO_BOX (impl->save_folder_combo) && gtk_widget_is_drawable (impl->save_folder_combo) && GTK_IS_EXPANDER (impl->save_expander) && gtk_widget_is_drawable (impl->save_expander) && GTK_IS_CONTAINER (impl->browse_widgets)); /* FIXME: we are in a SAVE mode; test the visibility and sensitivity of * the children that change depending on the state of the expander. */ } else { g_error ("BAD TEST: test_widgets_for_current_action() doesn't know about %s", get_action_name (impl->action)); passed = FALSE; } return passed; }
static gboolean gimp_frame_expose_event (GtkWidget *widget, GdkEventExpose *event) { if (gtk_widget_is_drawable (widget)) { GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class); return widget_class->expose_event (widget, event); } return FALSE; }
static void bar_pane_exif_dnd_receive(GtkWidget *pane, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection_data, guint info, guint time, gpointer data) { PaneExifData *ped; GList *work, *list; gint pos; GtkWidget *new_entry = NULL; ped = g_object_get_data(G_OBJECT(pane), "pane_data"); if (!ped) return; switch (info) { case TARGET_APP_EXIF_ENTRY: new_entry = *(gpointer *)gtk_selection_data_get_data(selection_data); if (gtk_widget_get_parent(new_entry) && gtk_widget_get_parent(new_entry) != ped->vbox) bar_pane_exif_reparent_entry(new_entry, pane); break; default: /* FIXME: this needs a check for valid exif keys */ new_entry = bar_pane_exif_add_entry(ped, (gchar *)gtk_selection_data_get_data(selection_data), NULL, TRUE, FALSE); break; } list = gtk_container_get_children(GTK_CONTAINER(ped->vbox)); work = list; pos = 0; while (work) { gint nx, ny; GtkWidget *entry = work->data; GtkAllocation allocation; work = work->next; if (entry == new_entry) continue; gtk_widget_get_allocation(entry, &allocation); if (gtk_widget_is_drawable(entry) && gtk_widget_translate_coordinates(pane, entry, x, y, &nx, &ny) && ny < allocation.height / 2) break; pos++; } g_list_free(list); gtk_box_reorder_child(GTK_BOX(ped->vbox), new_entry, pos); }
static gint scope_expose(GtkWidget *widget, GdkEventExpose *event) { Scope *scope; g_return_val_if_fail(widget != NULL, FALSE); g_return_val_if_fail(IS_SCOPE(widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); if (gtk_widget_is_drawable(widget)) { scope = SCOPE(widget); if (!scope->idlefunc) scope->idlefunc = g_idle_add_full(PRIO, idle_callback, scope, NULL); } return FALSE; }
static void redraw(RSLoupe *loupe) { if (!loupe->filter) return; if (!gtk_widget_is_drawable(loupe->canvas)) return; cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(loupe->canvas)); gint width; gint height; rs_filter_get_size_simple(loupe->filter, RS_FILTER_REQUEST_QUICK, &width, &height); /* Get window size */ gint window_width, window_height; gtk_window_get_size(GTK_WINDOW(loupe), &window_width, &window_height); /* Create request ROI */ RSFilterRequest *request = rs_filter_request_new(); GdkRectangle roi; roi.x = CLAMP(loupe->center_x - window_width/2, 0, width-window_width-1); roi.y = CLAMP(loupe->center_y - window_height/2, 0, height-window_height-1); roi.width = window_width; roi.height = window_height; rs_filter_request_set_roi(request, &roi); rs_filter_param_set_object(RS_FILTER_PARAM(request), "colorspace", loupe->display_color_space); gdk_threads_leave(); RSFilterResponse *response = rs_filter_get_image8(loupe->filter, request); gdk_threads_enter(); GdkPixbuf *buffer = rs_filter_response_get_image8(response); g_object_unref(response); g_object_unref(request); gdk_cairo_set_source_pixbuf(cr, buffer, -roi.x, -roi.y); cairo_paint(cr); /* Draw border */ cairo_rectangle(cr, 0.0, 0.0, roi.width, roi.height); cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); cairo_stroke(cr); cairo_destroy(cr); g_object_unref(buffer); }
static void gimp_progress_bar_set_value (gdouble percentage, gpointer user_data) { GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data); if (percentage >= 0.0) gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage); else gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar)); if (gtk_widget_is_drawable (GTK_WIDGET (bar))) while (gtk_events_pending ()) gtk_main_iteration (); }