static gint panels_expose(GtkWidget *widget, GdkEventExpose *event) { Panels *panels; GtkWidget *child; GList *children; GdkEventExpose child_event; g_return_val_if_fail(widget != NULL, FALSE); g_return_val_if_fail(IS_PANELS(widget), FALSE); g_return_val_if_fail(event != NULL, FALSE); if (GTK_WIDGET_DRAWABLE(widget)) { panels = PANELS(widget); child_event = *event; for (children = panels->children; children && (child = children->data); children = children->next) { if (child && GTK_WIDGET_DRAWABLE(child) && GTK_WIDGET_NO_WINDOW(child) && gtk_widget_intersect(child, &event->area, &child_event.area)) gtk_widget_event(child, (GdkEvent *)&child_event); } } return FALSE; }
static void gtk_form_draw(GtkWidget *widget, GdkRectangle *area) { GtkForm *form; GList *children; GtkFormChild *child; GdkRectangle child_area; g_return_if_fail(GTK_IS_FORM(widget)); if (GTK_WIDGET_DRAWABLE(widget)) { form = GTK_FORM(widget); children = form->children; while (children) { child = children->data; if (GTK_WIDGET_DRAWABLE(child->widget) && gtk_widget_intersect(child->widget, area, &child_area)) gtk_widget_draw(child->widget, &child_area); children = children->next; } } }
static void gtk_pizza_draw (GtkWidget *widget, GdkRectangle *area) { GtkPizza *pizza; GtkPizzaChild *child; GdkRectangle child_area; GList *children; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_PIZZA (widget)); pizza = GTK_PIZZA (widget); /* Sometimes, We handle all expose events in window.cpp now. */ if (pizza->external_expose) return; children = pizza->children; if ( !(GTK_WIDGET_APP_PAINTABLE (widget)) && (pizza->clear_on_draw)) { gdk_window_clear_area( pizza->bin_window, area->x, area->y, area->width, area->height); } while (children) { child = children->data; children = children->next; if (gtk_widget_intersect (child->widget, area, &child_area)) gtk_widget_draw (child->widget, &child_area); } }
static void gtk_check_item_draw (GtkWidget *widget, GdkRectangle *area) { GtkCheckItem *check_item; GtkToggleButton *toggle_button; GtkBin *bin; GdkRectangle child_area; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_CHECK_ITEM (widget)); g_return_if_fail (area != NULL); check_item = GTK_CHECK_ITEM (widget); toggle_button = GTK_TOGGLE_BUTTON (widget); bin = GTK_BIN (widget); if (GTK_WIDGET_DRAWABLE (widget)) { if (toggle_button->draw_indicator) { gtk_check_item_paint (widget, area); if (bin->child && gtk_widget_intersect (bin->child, area, &child_area)) gtk_widget_draw (bin->child, &child_area); } else { if (GTK_WIDGET_CLASS (parent_class)->draw) (* GTK_WIDGET_CLASS (parent_class)->draw) (widget, area); } } }
static gint columns_expose(GtkWidget *widget, GdkEventExpose *event) { Columns *cols; ColumnsChild *child; GList *children; GdkEventExpose child_event; g_return_val_if_fail(widget != NULL, FALSE); g_return_val_if_fail(IS_COLUMNS(widget), FALSE); g_return_val_if_fail(event != NULL, FALSE); if (GTK_WIDGET_DRAWABLE(widget)) { cols = COLUMNS(widget); child_event = *event; for (children = cols->children; children && (child = children->data); children = children->next) { if (child->widget && GTK_WIDGET_DRAWABLE(child->widget) && GTK_WIDGET_NO_WINDOW(child->widget) && gtk_widget_intersect(child->widget, &event->area, &child_event.area)) gtk_widget_event(child->widget, (GdkEvent *)&child_event); } } return FALSE; }
static gint awt_gtk_panel_expose (GtkWidget *widget, GdkEventExpose *event) { AWTGtkPanel *panel; GtkWidget *child; GdkEventExpose child_event; GList *children; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (event != NULL, FALSE); if (GTK_WIDGET_DRAWABLE (widget)) { panel = AWT_GTK_PANEL (widget); child_event = *event; children = panel->children; while (children) { child = children->data; children = children->next; if (GTK_WIDGET_NO_WINDOW (child) && gtk_widget_intersect (child, &event->area, &child_event.area)) gtk_widget_event (child, (GdkEvent*) &child_event); } } return FALSE; }
static void awt_gtk_panel_draw (GtkWidget *widget, GdkRectangle *area) { AWTGtkPanel *panel; GtkWidget *child; GdkRectangle child_area; GList *children; g_return_if_fail (widget != NULL); if (GTK_WIDGET_DRAWABLE (widget)) { panel = AWT_GTK_PANEL (widget); awt_gtk_panel_paint (widget, area); children = panel->children; while (children) { child = children->data; children = children->next; if (gtk_widget_intersect (child, area, &child_area)) gtk_widget_draw (child, &child_area); } } }
/* ML_3 (gtk_widget_popup, GtkWidget_val, Int_val, Int_val, Unit) */ CAMLprim value ml_gtk_widget_intersect (value w, value area) { GdkRectangle inter; if (gtk_widget_intersect(GtkWidget_val(w), GdkRectangle_val(area), &inter)) return ml_some (Val_copy (inter)); return Val_unit; }
static VALUE rg_intersect(VALUE self, VALUE area) { GdkRectangle intersection; gboolean ret = gtk_widget_intersect(_SELF(self), (GdkRectangle*)RVAL2BOXED(area, GDK_TYPE_RECTANGLE), &intersection); return ret ? BOXED2RVAL(&intersection, GDK_TYPE_RECTANGLE) : Qnil; }
static void columns_draw(GtkWidget *widget, GdkRectangle *area) { Columns *cols; ColumnsChild *child; GList *children; GdkRectangle child_area; g_return_if_fail(widget != NULL); g_return_if_fail(IS_COLUMNS(widget)); if (GTK_WIDGET_DRAWABLE(widget)) { cols = COLUMNS(widget); for (children = cols->children; children && (child = children->data); children = children->next) { if (child->widget && GTK_WIDGET_DRAWABLE(child->widget) && gtk_widget_intersect(child->widget, area, &child_area)) gtk_widget_draw(child->widget, &child_area); } } }
static gint gtk_pizza_expose (GtkWidget *widget, GdkEventExpose *event) { GtkPizza *pizza; GtkPizzaChild *child; GdkEventExpose child_event; GList *children; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_PIZZA (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); pizza = GTK_PIZZA (widget); if (event->window != pizza->bin_window) return FALSE; /* We handle all expose events in window.cpp now. */ if (pizza->external_expose) return FALSE; children = pizza->children; while (children) { child = children->data; children = children->next; child_event = *event; if (GTK_WIDGET_NO_WINDOW (child->widget) && GTK_WIDGET_DRAWABLE (child->widget) && gtk_widget_intersect (child->widget, &event->area, &child_event.area)) { gtk_widget_event (child->widget, (GdkEvent*) &child_event); } } return TRUE; }
static void panels_draw(GtkWidget *widget, GdkRectangle *area) { Panels *panels; GtkWidget *child; GList *children; GdkRectangle child_area; g_return_if_fail(widget != NULL); g_return_if_fail(IS_PANELS(widget)); if (GTK_WIDGET_DRAWABLE(widget)) { panels = PANELS(widget); for (children = panels->children; children && (child = children->data); children = children->next) { if (child && GTK_WIDGET_DRAWABLE(child) && gtk_widget_intersect(child, area, &child_area)) gtk_widget_draw(child, &child_area); } } }
static gboolean gtk_check_item_expose (GtkWidget *widget, GdkEventExpose *event) { GtkCheckItem *check_item; GtkToggleButton *toggle_button; GtkBin *bin; GdkEventExpose child_event; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_CHECK_ITEM (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); check_item = GTK_CHECK_ITEM (widget); toggle_button = GTK_TOGGLE_BUTTON (widget); bin = GTK_BIN (widget); if (GTK_WIDGET_DRAWABLE (widget)) { if (toggle_button->draw_indicator) { gtk_check_item_paint (widget, &event->area); child_event = *event; if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) && gtk_widget_intersect (bin->child, &event->area, &child_event.area)) gtk_widget_event (bin->child, (GdkEvent*) &child_event); } else { if (GTK_WIDGET_CLASS (parent_class)->expose_event) (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event); } } return FALSE; }