vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
/* add additional spacing if necessary */
- if (GTK_IS_VBOX(parent_box) && GTK_BOX(parent_box)->children != NULL)
+ if (GTK_IS_VBOX(parent_box))
{
- pref_spacer(vbox, PREF_PAD_GROUP - PREF_PAD_GAP);
+ GList *list = gtk_container_get_children(GTK_CONTAINER(parent_box));
+ if (list)
+ {
+ pref_spacer(vbox, PREF_PAD_GROUP - PREF_PAD_GAP);
+ }
+ g_list_free(list);
}
gtk_box_pack_start(GTK_BOX(parent_box), vbox, fill, fill, 0);
gint x, y;
gint w, h;
gint xr, yr;
+ GdkWindow *window;
xr = (gint)event->x_root;
yr = (gint)event->y_root;
- gdk_window_get_origin(ds->window->window, &x, &y);
- gdk_drawable_get_size(ds->window->window, &w, &h);
+ window = gtk_widget_get_window(ds->window);
+ gdk_window_get_origin(window, &x, &y);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (xr < x || yr < y || xr > x + w || yr > y + h)
{
gint x, y;
gint wx, wy;
gint day, month, year;
+ GtkAllocation button_allocation;
+ GtkAllocation window_allocation;
if (ds->window) return;
gtk_widget_realize(ds->window);
- gdk_window_get_origin(ds->button->window, &wx, &wy);
+ gdk_window_get_origin(gtk_widget_get_window(ds->button), &wx, &wy);
- x = wx + ds->button->allocation.x + ds->button->allocation.width - ds->window->allocation.width;
- y = wy + ds->button->allocation.y + ds->button->allocation.height;
+ gtk_widget_get_allocation(ds->button, &button_allocation);
+ gtk_widget_get_allocation(ds->window, &window_allocation);
+
+ x = wx + button_allocation.x + button_allocation.width - window_allocation.width;
+ y = wy + button_allocation.y + button_allocation.height;
- if (y + ds->window->allocation.height > gdk_screen_height())
+ if (y + window_allocation.height > gdk_screen_height())
{
- y = wy + ds->button->allocation.y - ds->window->allocation.height;
+ y = wy + button_allocation.y - window_allocation.height;
}
if (x < 0) x = 0;
if (y < 0) y = 0;
gtk_widget_show(ds->window);
gtk_widget_grab_focus(ds->calendar);
- gdk_pointer_grab(ds->window->window, TRUE,
+ gdk_pointer_grab(gtk_widget_get_window(ds->window), TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME);
- gdk_keyboard_grab(ds->window->window, TRUE, GDK_CURRENT_TIME);
+ gdk_keyboard_grab(gtk_widget_get_window(ds->window), TRUE, GDK_CURRENT_TIME);
gtk_grab_add(ds->window);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ds->button), TRUE);
static void button_size_allocate_cb(GtkWidget *button, GtkAllocation *allocation, gpointer data)
{
GtkWidget *spin = data;
+ GtkRequisition spin_requisition;
+ gtk_widget_get_requisition(spin, &spin_requisition);
- if (allocation->height > spin->requisition.height)
+ if (allocation->height > spin_requisition.height)
{
GtkAllocation button_allocation;
+ GtkAllocation spin_allocation;
- button_allocation = button->allocation;
- button_allocation.height = spin->requisition.height;
- button_allocation.y = spin->allocation.y +
- (spin->allocation.height - spin->requisition.height) / 2;
+ gtk_widget_get_allocation(button, &button_allocation);
+ gtk_widget_get_allocation(spin, &spin_allocation);
+ button_allocation.height = spin_requisition.height;
+ button_allocation.y = spin_allocation.y +
+ (spin_allocation.height - spin_requisition.height) / 2;
gtk_widget_size_allocate(button, &button_allocation);
}
}
SizerData *sd = data;
gint x, y;
gint w, h;
+ GtkAllocation parent_allocation;
if (!sd->in_drag) return FALSE;
if (sd->bounding_widget)
{
- w = CLAMP(w, sd->sizer->allocation.width, sd->bounding_widget->allocation.width);
- h = CLAMP(h, sd->sizer->allocation.height, sd->bounding_widget->allocation.height);
+ GtkAllocation sizer_allocation;
+ GtkAllocation bounding_allocation;
+ gtk_widget_get_allocation(sd->sizer, &sizer_allocation);
+ gtk_widget_get_allocation(sd->bounding_widget, &bounding_allocation);
+ w = CLAMP(w, sizer_allocation.width, bounding_allocation.width);
+ h = CLAMP(h, sizer_allocation.height, bounding_allocation.height);
}
else
{
- if (w < sd->sizer->allocation.width) w = sd->sizer->allocation.width;
- if (h < sd->sizer->allocation.height) h = sd->sizer->allocation.height;
+ GtkAllocation sizer_allocation;
+ gtk_widget_get_allocation(sd->sizer, &sizer_allocation);
+ if (w < sizer_allocation.width) w = sizer_allocation.width;
+ if (h < sizer_allocation.height) h = sizer_allocation.height;
}
if (sd->hsize_max >= 0) w = MIN(w, sd->hsize_max);
if (sd->vsize_max >= 0) h = MIN(h, sd->vsize_max);
- if (w == sd->parent->allocation.width) w = -1;
- if (h == sd->parent->allocation.height) h = -1;
+ gtk_widget_get_allocation(sd->parent, &parent_allocation);
+ if (w == parent_allocation.width) w = -1;
+ if (h == parent_allocation.height) h = -1;
if (w > 0 || h > 0) gtk_widget_set_size_request(sd->parent, w, h);
static gboolean sizer_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
SizerData *sd = data;
+ GtkAllocation parent_allocation;
if (bevent->button != MOUSE_BUTTON_LEFT) return FALSE;
sd->press_x = bevent->x_root;
sd->press_y = bevent->y_root;
- sd->press_width = sd->parent->allocation.width;
- sd->press_height = sd->parent->allocation.height;
+ gtk_widget_get_allocation(sd->parent, &parent_allocation);
+ sd->press_width = parent_allocation.width;
+ sd->press_height = parent_allocation.height;
- gdk_pointer_grab(sd->sizer->window, FALSE,
+ gdk_pointer_grab(gtk_widget_get_window(sd->sizer), FALSE,
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
gtk_grab_add(sd->sizer);
static void sizer_set_prelight(SizerData *sd, gboolean prelit)
{
+ GtkAllocation sizer_allocation;
+ gtk_widget_get_allocation(sd->sizer, &sizer_allocation);
+
sd->handle_prelit = prelit;
gtk_widget_queue_draw_area(sd->sizer, 0, 0,
- sd->sizer->allocation.width, sd->sizer->allocation.height);
+ sizer_allocation.width, sizer_allocation.height);
}
static gboolean sizer_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
GdkRectangle clip;
GtkOrientation orientation;
GtkStateType state;
+ GtkAllocation allocation;
gdk_region_get_clipbox(event->region, &clip);
}
else
{
- state = widget->state;
+ state = gtk_widget_get_state(widget);
}
- gtk_paint_handle(widget->style, widget->window, state,
+ gtk_widget_get_allocation(widget, &allocation);
+ gtk_paint_handle(gtk_widget_get_style(widget), gtk_widget_get_window(widget), state,
GTK_SHADOW_NONE, &clip, widget, "paned",
0, 0,
- widget->allocation.width, widget->allocation.height,
+ allocation.width, allocation.height,
orientation);
return TRUE;
n = (n != 0) ? GDK_FLEUR : GDK_SB_H_DOUBLE_ARROW;
}
- if (n != 0 && widget->window)
+ if (n != 0 && gtk_widget_get_window(widget))
{
GdkCursor *cursor;
cursor = gdk_cursor_new(n);
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
gdk_cursor_unref(cursor);
}
}