diff options
author | Havoc Pennington <hp@src.gnome.org> | 2000-05-26 03:08:05 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-05-26 03:08:05 +0000 |
commit | 3143ddb0df0c1c9ed7d22397b9d72534844f5c4b (patch) | |
tree | 650d6081f6ecf2e797141078f23478b1cff265cb | |
parent | 5b894c227873a583d01c74ffc8d7f50aca7ca80f (diff) | |
download | gtk+-gdk-object.tar.gz |
GtkStyle becomes a GObject, and xthickness/ythickness moved to instance structgdk-object
40 files changed, 600 insertions, 589 deletions
diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h index ef0e81da4f..e6f9019d3e 100644 --- a/gdk/gdkdnd.h +++ b/gdk/gdkdnd.h @@ -45,6 +45,8 @@ typedef struct _GdkDragContextClass GdkDragContextClass; struct _GdkDragContext { GObject parent_instance; + + /*< public >*/ GdkDragProtocol protocol; @@ -60,6 +62,8 @@ struct _GdkDragContext { guint32 start_time; + /*< private >*/ + gpointer windowing_data; }; diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c index 353a594799..ae16358a9d 100644 --- a/gdk/x11/gdkevents-x11.c +++ b/gdk/x11/gdkevents-x11.c @@ -206,7 +206,7 @@ gdk_event_get_graphics_expose (GdkWindow *window) if (xevent.xany.type == GraphicsExpose) { event = gdk_event_new (); - + if (gdk_event_translate (event, &xevent)) return event; else @@ -306,7 +306,9 @@ gdk_event_translate (GdkEvent *event, if (window_private && GDK_WINDOW_DESTROYED (window)) { if (xevent->type != DestroyNotify) - return FALSE; + { + return FALSE; + } } else { diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 5be1374d09..0cd6544565 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -240,6 +240,8 @@ gdk_windowing_window_init (void) unsigned int border_width; unsigned int depth; int x, y; + + g_assert (gdk_parent_root == NULL); XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window, &x, &y, &width, &height, &border_width, &depth); diff --git a/gtk/gtk-boxed.defs b/gtk/gtk-boxed.defs index 8692fe5368..23f82b65cf 100644 --- a/gtk/gtk-boxed.defs +++ b/gtk/gtk-boxed.defs @@ -16,10 +16,6 @@ (define-boxed GtkSelectionData ) -(define-boxed GtkStyle - gtk_style_ref - gtk_style_unref) - (define-boxed GtkCTreeNode ) diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c index 3d084b1c9c..c07fa0a98d 100644 --- a/gtk/gtkaspectframe.c +++ b/gtk/gtkaspectframe.c @@ -261,7 +261,7 @@ gtk_aspect_frame_paint (GtkWidget *widget, frame = GTK_FRAME (widget); allocation = >K_ASPECT_FRAME(widget)->center_allocation; - height_extra = frame->label_height - widget->style->klass->xthickness; + height_extra = frame->label_height - widget->style->xthickness; height_extra = MAX (height_extra, 0); x = GTK_CONTAINER (frame)->border_width; @@ -271,10 +271,10 @@ gtk_aspect_frame_paint (GtkWidget *widget, { label_area_width = (allocation->width + GTK_CONTAINER (frame)->border_width * 2 - - widget->style->klass->xthickness * 2); + widget->style->xthickness * 2); x2 = ((label_area_width - frame->label_width) * frame->label_xalign + - GTK_CONTAINER (frame)->border_width + widget->style->klass->xthickness); + GTK_CONTAINER (frame)->border_width + widget->style->xthickness); y2 = (GTK_CONTAINER (frame)->border_width + widget->style->font->ascent); gtk_paint_shadow_gap (widget->style, widget->window, @@ -415,14 +415,14 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget, ratio = aspect_frame->ratio; x = (GTK_CONTAINER (frame)->border_width + - GTK_WIDGET (frame)->style->klass->xthickness); + GTK_WIDGET (frame)->style->xthickness); width = allocation->width - x * 2; y = (GTK_CONTAINER (frame)->border_width + - MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness)); + MAX (frame->label_height, GTK_WIDGET (frame)->style->ythickness)); height = (allocation->height - y - GTK_CONTAINER (frame)->border_width - - GTK_WIDGET (frame)->style->klass->ythickness); + GTK_WIDGET (frame)->style->ythickness); /* make sure we don't allocate a negative width or height, * since that will be cast to a (very big) guint16 */ @@ -447,7 +447,7 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget, aspect_frame->center_allocation.x = child_allocation.x - x; aspect_frame->center_allocation.height = child_allocation.height + y + GTK_CONTAINER (frame)->border_width + - GTK_WIDGET (frame)->style->klass->ythickness; + GTK_WIDGET (frame)->style->ythickness; aspect_frame->center_allocation.y = child_allocation.y - y; gtk_widget_size_allocate (bin->child, &child_allocation); diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 3f0e4ff620..06d7d05a2f 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -429,15 +429,15 @@ gtk_button_size_request (GtkWidget *widget, button = GTK_BUTTON (widget); requisition->width = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING + - GTK_WIDGET (widget)->style->klass->xthickness) * 2; + GTK_WIDGET (widget)->style->xthickness) * 2; requisition->height = (GTK_CONTAINER (widget)->border_width + CHILD_SPACING + - GTK_WIDGET (widget)->style->klass->ythickness) * 2; + GTK_WIDGET (widget)->style->ythickness) * 2; if (GTK_WIDGET_CAN_DEFAULT (widget)) { - requisition->width += (GTK_WIDGET (widget)->style->klass->xthickness * 2 + + requisition->width += (GTK_WIDGET (widget)->style->xthickness * 2 + DEFAULT_SPACING); - requisition->height += (GTK_WIDGET (widget)->style->klass->ythickness * 2 + + requisition->height += (GTK_WIDGET (widget)->style->ythickness * 2 + DEFAULT_SPACING); } @@ -478,8 +478,8 @@ gtk_button_size_allocate (GtkWidget *widget, if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child)) { - child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness); - child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness); + child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->xthickness); + child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->ythickness); child_allocation.width = MAX (1, (gint)widget->allocation.width - child_allocation.x * 2 - border_width * 2); @@ -488,14 +488,14 @@ gtk_button_size_allocate (GtkWidget *widget, if (GTK_WIDGET_CAN_DEFAULT (button)) { - child_allocation.x += (GTK_WIDGET (widget)->style->klass->xthickness + + child_allocation.x += (GTK_WIDGET (widget)->style->xthickness + DEFAULT_LEFT_POS); - child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness + + child_allocation.y += (GTK_WIDGET (widget)->style->ythickness + DEFAULT_TOP_POS); child_allocation.width = MAX (1, (gint)child_allocation.width - - (gint)(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING)); + (gint)(GTK_WIDGET (widget)->style->xthickness * 2 + DEFAULT_SPACING)); child_allocation.height = MAX (1, (gint)child_allocation.height - - (gint)(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING)); + (gint)(GTK_WIDGET (widget)->style->xthickness * 2 + DEFAULT_SPACING)); } gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation); @@ -560,8 +560,8 @@ gtk_button_paint (GtkWidget *widget, if (GTK_WIDGET_CAN_DEFAULT (widget)) { - x += widget->style->klass->xthickness; - y += widget->style->klass->ythickness; + x += widget->style->xthickness; + y += widget->style->ythickness; width -= 2 * x + DEFAULT_SPACING; height -= 2 * y + DEFAULT_SPACING; x += DEFAULT_LEFT_POS; diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 1f220bda4d..8f2844e327 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -962,11 +962,11 @@ gtk_calendar_realize_day_names (GtkWidget *widget) attributes.colormap = gtk_widget_get_colormap (widget); attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - attributes.x = (widget->style->klass->xthickness + INNER_BORDER); - attributes.y = private_data->header_h + (widget->style->klass->ythickness + attributes.x = (widget->style->xthickness + INNER_BORDER); + attributes.y = private_data->header_h + (widget->style->ythickness + INNER_BORDER); attributes.width = (widget->allocation.width - - (widget->style->klass->xthickness + INNER_BORDER) + - (widget->style->xthickness + INNER_BORDER) * 2); attributes.height = private_data->day_name_h; private_data->day_name_win = gdk_window_new (widget->window, @@ -1007,9 +1007,9 @@ gtk_calendar_realize_week_numbers (GtkWidget *widget) attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - attributes.x = + (widget->style->klass->xthickness + INNER_BORDER); + attributes.x = + (widget->style->xthickness + INNER_BORDER); attributes.y = (private_data->header_h + private_data->day_name_h - + (widget->style->klass->ythickness + INNER_BORDER)); + + (widget->style->ythickness + INNER_BORDER)); attributes.width = private_data->week_width; attributes.height = private_data->main_h; private_data->week_win = gdk_window_new (widget->window, @@ -1075,11 +1075,11 @@ gtk_calendar_realize (GtkWidget *widget) attributes.x = private_data->week_width; else attributes.x = 0; - attributes.x += (widget->style->klass->xthickness + INNER_BORDER); + attributes.x += (widget->style->xthickness + INNER_BORDER); attributes.y = (private_data->header_h + private_data->day_name_h - + (widget->style->klass->ythickness + INNER_BORDER)); + + (widget->style->ythickness + INNER_BORDER)); attributes.width = (widget->allocation.width - attributes.x - - (widget->style->klass->xthickness + INNER_BORDER)); + - (widget->style->xthickness + INNER_BORDER)); attributes.height = private_data->main_h; private_data->main_win = gdk_window_new (widget->window, &attributes, attributes_mask); @@ -1255,7 +1255,7 @@ gtk_calendar_size_request (GtkWidget *widget, : 0)); - requisition->width = MAX (header_width+4, main_width + (widget->style->klass->xthickness + INNER_BORDER) *2); + requisition->width = MAX (header_width+4, main_width + (widget->style->xthickness + INNER_BORDER) *2); /* * Calculate the requisition height for the widget. @@ -1316,7 +1316,7 @@ gtk_calendar_size_request (GtkWidget *widget, height = (private_data->header_h + private_data->day_name_h + private_data->main_h); - requisition->height = height + (widget->style->klass->ythickness + INNER_BORDER) * 2; + requisition->height = height + (widget->style->ythickness + INNER_BORDER) * 2; } static void @@ -1338,17 +1338,17 @@ gtk_calendar_size_allocate (GtkWidget *widget, if (calendar->display_flags & GTK_CALENDAR_SHOW_WEEK_NUMBERS) { private_data->day_width = (private_data->min_day_width - * ((allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2 + * ((allocation->width - (widget->style->xthickness + INNER_BORDER) * 2 - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 7) - CALENDAR_XSEP * 2)) / (7 * private_data->min_day_width + private_data->max_week_char_width * 2)); - private_data->week_width = ((allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2 + private_data->week_width = ((allocation->width - (widget->style->xthickness + INNER_BORDER) * 2 - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 7) - CALENDAR_XSEP * 2 ) - private_data->day_width * 7 + CALENDAR_MARGIN + CALENDAR_XSEP); } else { private_data->day_width = (allocation->width - - (widget->style->klass->xthickness + INNER_BORDER) * 2 + - (widget->style->xthickness + INNER_BORDER) * 2 - (CALENDAR_MARGIN * 2) - (DAY_XSEP * 7))/7; private_data->week_width = 0; @@ -1392,25 +1392,25 @@ gtk_calendar_size_allocate (GtkWidget *widget, private_data->header_h - 7); if (private_data->day_name_win) gdk_window_move_resize (private_data->day_name_win, - widget->style->klass->xthickness + INNER_BORDER, - private_data->header_h + (widget->style->klass->ythickness + INNER_BORDER), - allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2, + widget->style->xthickness + INNER_BORDER, + private_data->header_h + (widget->style->ythickness + INNER_BORDER), + allocation->width - (widget->style->xthickness + INNER_BORDER) * 2, private_data->day_name_h); if (private_data->week_win) gdk_window_move_resize (private_data->week_win, - (widget->style->klass->xthickness + INNER_BORDER), + (widget->style->xthickness + INNER_BORDER), private_data->header_h + private_data->day_name_h - + (widget->style->klass->ythickness + INNER_BORDER), + + (widget->style->ythickness + INNER_BORDER), private_data->week_width, private_data->main_h); gdk_window_move_resize (private_data->main_win, (private_data->week_width ? private_data->week_width + CALENDAR_XSEP :0) - + (widget->style->klass->xthickness + INNER_BORDER), + + (widget->style->xthickness + INNER_BORDER), private_data->header_h + private_data->day_name_h - + (widget->style->klass->ythickness + INNER_BORDER), + + (widget->style->ythickness + INNER_BORDER), allocation->width - (private_data->week_width ? private_data->week_width + CALENDAR_XSEP :0) - - (widget->style->klass->xthickness + INNER_BORDER) * 2, + - (widget->style->xthickness + INNER_BORDER) * 2, private_data->main_h); } } diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c index d149fdbc09..74afbf104e 100644 --- a/gtk/gtkcheckmenuitem.c +++ b/gtk/gtkcheckmenuitem.c @@ -247,7 +247,7 @@ gtk_real_check_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item, width = 8; height = 8; x = (GTK_CONTAINER (check_menu_item)->border_width + - widget->style->klass->xthickness + 2); + widget->style->xthickness + 2); y = (widget->allocation.height - height) / 2; if (check_menu_item->active || diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 15c2499420..f0d73c75fc 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -2051,7 +2051,7 @@ new_column_width (GtkCList *clist, gint column, gint *x) { - gint xthickness = GTK_WIDGET (clist)->style->klass->xthickness; + gint xthickness = GTK_WIDGET (clist)->style->xthickness; gint width; gint cx; gint dx; @@ -4471,9 +4471,9 @@ gtk_clist_realize (GtkWidget *widget) /* clist-window */ attributes.x = (clist->internal_allocation.x + - widget->style->klass->xthickness); + widget->style->xthickness); attributes.y = (clist->internal_allocation.y + - widget->style->klass->ythickness + + widget->style->ythickness + clist->column_title_area.height); attributes.width = clist->clist_window_width; attributes.height = clist->clist_window_height; @@ -4761,9 +4761,9 @@ gtk_clist_draw (GtkWidget *widget, GTK_STATE_NORMAL, clist->shadow_type, 0, 0, clist->clist_window_width + - (2 * widget->style->klass->xthickness), + (2 * widget->style->xthickness), clist->clist_window_height + - (2 * widget->style->klass->ythickness) + + (2 * widget->style->ythickness) + clist->column_title_area.height); gdk_window_clear_area (clist->clist_window, 0, 0, 0, 0); @@ -4800,9 +4800,9 @@ gtk_clist_expose (GtkWidget *widget, GTK_STATE_NORMAL, clist->shadow_type, 0, 0, clist->clist_window_width + - (2 * widget->style->klass->xthickness), + (2 * widget->style->xthickness), clist->clist_window_height + - (2 * widget->style->klass->ythickness) + + (2 * widget->style->ythickness) + clist->column_title_area.height); /* exposure events on the list */ @@ -5409,10 +5409,10 @@ gtk_clist_size_request (GtkWidget *widget, child_requisition.height); } - requisition->width += (widget->style->klass->xthickness + + requisition->width += (widget->style->xthickness + GTK_CONTAINER (widget)->border_width) * 2; requisition->height += (clist->column_title_area.height + - (widget->style->klass->ythickness + + (widget->style->ythickness + GTK_CONTAINER (widget)->border_width) * 2); /* if (!clist->hadjustment) */ @@ -5458,14 +5458,14 @@ gtk_clist_size_allocate (GtkWidget *widget, /* allocate clist window assuming no scrollbars */ clist_allocation.x = (clist->internal_allocation.x + - widget->style->klass->xthickness); + widget->style->xthickness); clist_allocation.y = (clist->internal_allocation.y + - widget->style->klass->ythickness + + widget->style->ythickness + clist->column_title_area.height); clist_allocation.width = MAX (1, (gint)clist->internal_allocation.width - - (2 * (gint)widget->style->klass->xthickness)); + (2 * (gint)widget->style->xthickness)); clist_allocation.height = MAX (1, (gint)clist->internal_allocation.height - - (2 * (gint)widget->style->klass->ythickness) - + (2 * (gint)widget->style->ythickness) - (gint)clist->column_title_area.height); clist->clist_window_width = clist_allocation.width; @@ -5481,8 +5481,8 @@ gtk_clist_size_allocate (GtkWidget *widget, } /* position the window which holds the column title buttons */ - clist->column_title_area.x = widget->style->klass->xthickness; - clist->column_title_area.y = widget->style->klass->ythickness; + clist->column_title_area.x = widget->style->xthickness; + clist->column_title_area.y = widget->style->ythickness; clist->column_title_area.width = clist_allocation.width; if (GTK_WIDGET_REALIZED (widget)) @@ -5982,7 +5982,7 @@ draw_xor_line (GtkCList *clist) gdk_draw_line (widget->window, clist->xor_gc, clist->x_drag, - widget->style->klass->ythickness, + widget->style->ythickness, clist->x_drag, clist->column_title_area.height + clist->clist_window_height + 1); @@ -7450,7 +7450,7 @@ drag_dest_cell (GtkCList *clist, dest_info->insert_pos = GTK_CLIST_DRAG_NONE; y -= (GTK_CONTAINER (clist)->border_width + - widget->style->klass->ythickness + + widget->style->ythickness + clist->column_title_area.height); dest_info->cell.row = ROW_FROM_YPIXEL (clist, y); @@ -7462,7 +7462,7 @@ drag_dest_cell (GtkCList *clist, if (dest_info->cell.row < -1) dest_info->cell.row = -1; - x -= GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness; + x -= GTK_CONTAINER (widget)->border_width + widget->style->xthickness; dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x); if (dest_info->cell.row >= 0) diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index fc0f267b01..32b19ae622 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -325,17 +325,17 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w list_requisition.height += EMPTY_LIST_HEIGHT; alloc_width = (widget->allocation.width - - 2 * popwin->child->style->klass->xthickness - + 2 * popwin->child->style->xthickness - 2 * GTK_CONTAINER (popwin->child)->border_width - 2 * GTK_CONTAINER (combo->popup)->border_width - 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width - - 2 * GTK_BIN (popup)->child->style->klass->xthickness); + 2 * GTK_BIN (popup)->child->style->xthickness); - work_height = (2 * popwin->child->style->klass->ythickness + + work_height = (2 * popwin->child->style->ythickness + 2 * GTK_CONTAINER (popwin->child)->border_width + 2 * GTK_CONTAINER (combo->popup)->border_width + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width + - 2 * GTK_BIN (popup)->child->style->klass->xthickness); + 2 * GTK_BIN (popup)->child->style->xthickness); do { diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index 79ebafed39..f4090fe05a 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -5878,7 +5878,7 @@ drag_dest_cell (GtkCList *clist, dest_info->insert_pos = GTK_CLIST_DRAG_NONE; y -= (GTK_CONTAINER (widget)->border_width + - widget->style->klass->ythickness + clist->column_title_area.height); + widget->style->ythickness + clist->column_title_area.height); dest_info->cell.row = ROW_FROM_YPIXEL (clist, y); if (dest_info->cell.row >= clist->rows) @@ -5889,7 +5889,7 @@ drag_dest_cell (GtkCList *clist, if (dest_info->cell.row < -1) dest_info->cell.row = -1; - x -= GTK_CONTAINER (widget)->border_width + widget->style->klass->xthickness; + x -= GTK_CONTAINER (widget)->border_width + widget->style->xthickness; dest_info->cell.column = COLUMN_FROM_XPIXEL (clist, x); if (dest_info->cell.row >= 0) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 3f9eec91b2..ee9dc57f56 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -586,8 +586,8 @@ gtk_entry_realize (GtkWidget *widget) widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, entry); - attributes.x = widget->style->klass->xthickness; - attributes.y = widget->style->klass->ythickness; + attributes.x = widget->style->xthickness; + attributes.y = widget->style->ythickness; attributes.width = widget->allocation.width - attributes.x * 2; attributes.height = requisition.height - attributes.y * 2; attributes.cursor = entry->cursor = gdk_cursor_new (GDK_XTERM); @@ -764,10 +764,10 @@ gtk_entry_size_request (GtkWidget *widget, g_return_if_fail (GTK_IS_ENTRY (widget)); g_return_if_fail (requisition != NULL); - requisition->width = MIN_ENTRY_WIDTH + (widget->style->klass->xthickness + INNER_BORDER) * 2; + requisition->width = MIN_ENTRY_WIDTH + (widget->style->xthickness + INNER_BORDER) * 2; requisition->height = (widget->style->font->ascent + widget->style->font->descent + - (widget->style->klass->ythickness + INNER_BORDER) * 2); + (widget->style->ythickness + INNER_BORDER) * 2); } static void @@ -799,10 +799,10 @@ gtk_entry_size_allocate (GtkWidget *widget, allocation->y + (allocation->height - requisition.height) / 2, allocation->width, requisition.height); gdk_window_move_resize (entry->text_area, - widget->style->klass->xthickness, - widget->style->klass->ythickness, - allocation->width - widget->style->klass->xthickness * 2, - requisition.height - widget->style->klass->ythickness * 2); + widget->style->xthickness, + widget->style->ythickness, + allocation->width - widget->style->xthickness * 2, + requisition.height - widget->style->ythickness * 2); /* And make sure the cursor is on screen */ entry_adjust_scroll (entry); @@ -839,8 +839,8 @@ gtk_entry_draw (GtkWidget *widget, { GdkRectangle tmp_area = *area; - tmp_area.x -= widget->style->klass->xthickness; - tmp_area.y -= widget->style->klass->xthickness; + tmp_area.x -= widget->style->xthickness; + tmp_area.y -= widget->style->xthickness; gdk_window_begin_paint_rect (entry->text_area, &tmp_area); gtk_widget_draw_focus (widget); diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c index 453519efaf..7ee4312b5c 100644 --- a/gtk/gtkframe.c +++ b/gtk/gtkframe.c @@ -347,7 +347,7 @@ gtk_frame_paint (GtkWidget *widget, { frame = GTK_FRAME (widget); - height_extra = frame->label_height - widget->style->klass->xthickness; + height_extra = frame->label_height - widget->style->xthickness; height_extra = MAX (height_extra, 0); x = GTK_CONTAINER (frame)->border_width; @@ -357,10 +357,10 @@ gtk_frame_paint (GtkWidget *widget, { label_area_width = (widget->allocation.width - GTK_CONTAINER (frame)->border_width * 2 - - widget->style->klass->xthickness * 2); + widget->style->xthickness * 2); x2 = ((label_area_width - frame->label_width) * frame->label_xalign + - GTK_CONTAINER (frame)->border_width + widget->style->klass->xthickness); + GTK_CONTAINER (frame)->border_width + widget->style->xthickness); y2 = (GTK_CONTAINER (frame)->border_width + widget->style->font->ascent); gtk_paint_shadow_gap (widget->style, widget->window, @@ -455,13 +455,13 @@ gtk_frame_size_request (GtkWidget *widget, bin = GTK_BIN (widget); requisition->width = (GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->xthickness) * 2; + GTK_WIDGET (widget)->style->xthickness) * 2; - tmp_height = frame->label_height - GTK_WIDGET (widget)->style->klass->ythickness; + tmp_height = frame->label_height - GTK_WIDGET (widget)->style->ythickness; tmp_height = MAX (tmp_height, 0); requisition->height = tmp_height + (GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->ythickness) * 2; + GTK_WIDGET (widget)->style->ythickness) * 2; if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { @@ -507,14 +507,14 @@ gtk_frame_size_allocate (GtkWidget *widget, if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { child_allocation.x = (GTK_CONTAINER (frame)->border_width + - GTK_WIDGET (frame)->style->klass->xthickness); + GTK_WIDGET (frame)->style->xthickness); child_allocation.width = MAX(1, (gint)allocation->width - child_allocation.x * 2); child_allocation.y = (GTK_CONTAINER (frame)->border_width + - MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness)); + MAX (frame->label_height, GTK_WIDGET (frame)->style->ythickness)); child_allocation.height = MAX (1, ((gint)allocation->height - child_allocation.y - (gint)GTK_CONTAINER (frame)->border_width - - (gint)GTK_WIDGET (frame)->style->klass->ythickness)); + (gint)GTK_WIDGET (frame)->style->ythickness)); child_allocation.x += allocation->x; child_allocation.y += allocation->y; diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index ef2d7ad0c2..3060dfb53c 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -515,9 +515,9 @@ gtk_handle_box_size_request (GtkWidget *widget, { if (hb->handle_position == GTK_POS_LEFT || hb->handle_position == GTK_POS_RIGHT) - requisition->height += widget->style->klass->ythickness; + requisition->height += widget->style->ythickness; else - requisition->width += widget->style->klass->xthickness; + requisition->width += widget->style->xthickness; } } else diff --git a/gtk/gtkhruler.c b/gtk/gtkhruler.c index d827de748a..1d52de0ee7 100644 --- a/gtk/gtkhruler.c +++ b/gtk/gtkhruler.c @@ -92,8 +92,8 @@ gtk_hruler_init (GtkHRuler *hruler) GtkWidget *widget; widget = GTK_WIDGET (hruler); - widget->requisition.width = widget->style->klass->xthickness * 2 + 1; - widget->requisition.height = widget->style->klass->ythickness * 2 + RULER_HEIGHT; + widget->requisition.width = widget->style->xthickness * 2 + 1; + widget->requisition.height = widget->style->ythickness * 2 + RULER_HEIGHT; } @@ -163,8 +163,8 @@ gtk_hruler_draw_ticks (GtkRuler *ruler) bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; font = widget->style->font; - xthickness = widget->style->klass->xthickness; - ythickness = widget->style->klass->ythickness; + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; digit_height = font->ascent; /* assume descent == 0 ? */ width = widget->allocation.width; @@ -276,8 +276,8 @@ gtk_hruler_draw_pos (GtkRuler *ruler) widget = GTK_WIDGET (ruler); gc = widget->style->fg_gc[GTK_STATE_NORMAL]; - xthickness = widget->style->klass->xthickness; - ythickness = widget->style->klass->ythickness; + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; width = widget->allocation.width; height = widget->allocation.height - ythickness * 2; diff --git a/gtk/gtkhscale.c b/gtk/gtkhscale.c index 94ba294b03..39af613b4b 100644 --- a/gtk/gtkhscale.c +++ b/gtk/gtkhscale.c @@ -323,9 +323,9 @@ gtk_hscale_size_request (GtkWidget *widget, scale = GTK_SCALE (widget); requisition->width = (SCALE_CLASS (scale)->slider_length + - widget->style->klass->xthickness) * 2; + widget->style->xthickness) * 2; requisition->height = (RANGE_CLASS (scale)->slider_width + - widget->style->klass->ythickness * 2); + widget->style->ythickness * 2); if (scale->draw_value) { @@ -394,7 +394,7 @@ gtk_hscale_pos_trough (GtkHScale *hscale, *w = widget->allocation.width; *h = (RANGE_CLASS (scale)->slider_width + - widget->style->klass->ythickness * 2); + widget->style->ythickness * 2); if (scale->draw_value) { diff --git a/gtk/gtkhscrollbar.c b/gtk/gtkhscrollbar.c index e506ff0ae7..6851a893d8 100644 --- a/gtk/gtkhscrollbar.c +++ b/gtk/gtkhscrollbar.c @@ -165,9 +165,9 @@ gtk_hscrollbar_init (GtkHScrollbar *hscrollbar) requisition->width = (RANGE_CLASS (widget)->min_slider_size + RANGE_CLASS (widget)->stepper_size + RANGE_CLASS (widget)->stepper_slider_spacing + - widget->style->klass->xthickness) * 2; + widget->style->xthickness) * 2; requisition->height = (RANGE_CLASS (widget)->slider_width + - widget->style->klass->ythickness * 2); + widget->style->ythickness * 2); } GtkWidget* @@ -217,21 +217,21 @@ gtk_hscrollbar_realize (GtkWidget *widget) range->trough = widget->window; gdk_window_ref (range->trough); - attributes.x = widget->style->klass->xthickness; - attributes.y = widget->style->klass->ythickness; + attributes.x = widget->style->xthickness; + attributes.y = widget->style->ythickness; attributes.width = RANGE_CLASS (widget)->stepper_size; attributes.height = RANGE_CLASS (widget)->stepper_size; range->step_back = gdk_window_new (range->trough, &attributes, attributes_mask); attributes.x = (widget->allocation.width - - widget->style->klass->xthickness - + widget->style->xthickness - RANGE_CLASS (widget)->stepper_size); range->step_forw = gdk_window_new (range->trough, &attributes, attributes_mask); attributes.x = 0; - attributes.y = widget->style->klass->ythickness; + attributes.y = widget->style->ythickness; attributes.width = RANGE_CLASS (widget)->min_slider_size; attributes.height = RANGE_CLASS (widget)->slider_width; attributes.event_mask |= (GDK_BUTTON_MOTION_MASK | @@ -279,16 +279,16 @@ gtk_hscrollbar_size_allocate (GtkWidget *widget, allocation->y + (allocation->height - widget->requisition.height) / 2, allocation->width, widget->requisition.height); gdk_window_move_resize (range->step_back, - widget->style->klass->xthickness, - widget->style->klass->ythickness, + widget->style->xthickness, + widget->style->ythickness, RANGE_CLASS (widget)->stepper_size, - widget->requisition.height - widget->style->klass->ythickness * 2); + widget->requisition.height - widget->style->ythickness * 2); gdk_window_move_resize (range->step_forw, - allocation->width - widget->style->klass->xthickness - + allocation->width - widget->style->xthickness - RANGE_CLASS (widget)->stepper_size, - widget->style->klass->ythickness, + widget->style->ythickness, RANGE_CLASS (widget)->stepper_size, - widget->requisition.height - widget->style->klass->ythickness * 2); + widget->requisition.height - widget->style->ythickness * 2); gtk_range_slider_update (GTK_RANGE (widget)); } diff --git a/gtk/gtkhseparator.c b/gtk/gtkhseparator.c index 7d28457938..7fc9bafd65 100644 --- a/gtk/gtkhseparator.c +++ b/gtk/gtkhseparator.c @@ -72,7 +72,7 @@ static void gtk_hseparator_init (GtkHSeparator *hseparator) { GTK_WIDGET (hseparator)->requisition.width = 1; - GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->klass->ythickness; + GTK_WIDGET (hseparator)->requisition.height = GTK_WIDGET (hseparator)->style->ythickness; } GtkWidget* @@ -96,7 +96,7 @@ gtk_hseparator_expose (GtkWidget *widget, widget->allocation.x, widget->allocation.x + widget->allocation.width, widget->allocation.y + (widget->allocation.height - - widget->style->klass->ythickness) / 2); + widget->style->ythickness) / 2); return FALSE; } diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 8482cde215..b06aa32aac 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -403,7 +403,7 @@ gtk_list_item_size_request (GtkWidget *widget, bin = GTK_BIN (widget); requisition->width = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness) * 2; + widget->style->xthickness) * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) @@ -437,7 +437,7 @@ gtk_list_item_size_allocate (GtkWidget *widget, if (bin->child) { child_allocation.x = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness); + widget->style->xthickness); child_allocation.y = GTK_CONTAINER (widget)->border_width; child_allocation.width = allocation->width - child_allocation.x * 2; child_allocation.height = allocation->height - child_allocation.y * 2; diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index f74a3255cb..f567b44f72 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -862,9 +862,9 @@ gtk_menu_size_request (GtkWidget *widget, requisition->width += max_toggle_size + max_accel_width; requisition->width += (GTK_CONTAINER (menu)->border_width + - widget->style->klass->xthickness) * 2; + widget->style->xthickness) * 2; requisition->height += (GTK_CONTAINER (menu)->border_width + - widget->style->klass->ythickness) * 2; + widget->style->ythickness) * 2; children = menu_shell->children; while (children) @@ -903,9 +903,9 @@ gtk_menu_size_allocate (GtkWidget *widget, if (menu_shell->children) { child_allocation.x = (GTK_CONTAINER (menu)->border_width + - widget->style->klass->xthickness); + widget->style->xthickness); child_allocation.y = (GTK_CONTAINER (menu)->border_width + - widget->style->klass->ythickness); + widget->style->ythickness); child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2); children = menu_shell->children; diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index ecaeb3a03d..78a1e91532 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -257,10 +257,10 @@ gtk_menu_bar_size_request (GtkWidget *widget, } requisition->width += (GTK_CONTAINER (menu_bar)->border_width + - widget->style->klass->xthickness + + widget->style->xthickness + BORDER_SPACING) * 2; requisition->height += (GTK_CONTAINER (menu_bar)->border_width + - widget->style->klass->ythickness + + widget->style->ythickness + BORDER_SPACING) * 2; if (nchildren > 0) @@ -296,12 +296,12 @@ gtk_menu_bar_size_allocate (GtkWidget *widget, if (menu_shell->children) { child_allocation.x = (GTK_CONTAINER (menu_bar)->border_width + - widget->style->klass->xthickness + + widget->style->xthickness + BORDER_SPACING); offset = child_allocation.x; /* Window edge to menubar start */ child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width + - widget->style->klass->ythickness + + widget->style->ythickness + BORDER_SPACING); child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2); diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index c8e0cfd2f0..9459a8d1a4 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -348,10 +348,10 @@ gtk_menu_item_size_request (GtkWidget *widget, menu_item = GTK_MENU_ITEM (widget); requisition->width = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness + + widget->style->xthickness + BORDER_SPACING) * 2; requisition->height = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->ythickness) * 2; + widget->style->ythickness) * 2; if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { @@ -393,10 +393,10 @@ gtk_menu_item_size_allocate (GtkWidget *widget, if (bin->child) { child_allocation.x = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness + + widget->style->xthickness + BORDER_SPACING); child_allocation.y = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->ythickness); + widget->style->ythickness); child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2); child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2); child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size; diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index be49dc6ea2..54819e0608 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -647,8 +647,8 @@ gtk_notebook_size_request (GtkWidget *widget, if (notebook->show_border || notebook->show_tabs) { - widget->requisition.width += widget->style->klass->xthickness * 2; - widget->requisition.height += widget->style->klass->ythickness * 2; + widget->requisition.width += widget->style->xthickness * 2; + widget->requisition.height += widget->style->ythickness * 2; if (notebook->show_tabs) { @@ -672,10 +672,10 @@ gtk_notebook_size_request (GtkWidget *widget, page->requisition.width = child_requisition.width + - 2 * widget->style->klass->xthickness; + 2 * widget->style->xthickness; page->requisition.height = child_requisition.height + - 2 * widget->style->klass->ythickness; + 2 * widget->style->ythickness; switch (notebook->tab_pos) { @@ -880,12 +880,12 @@ gtk_notebook_size_allocate (GtkWidget *widget, if (notebook->show_tabs || notebook->show_border) { - child_allocation.x += widget->style->klass->xthickness; - child_allocation.y += widget->style->klass->ythickness; + child_allocation.x += widget->style->xthickness; + child_allocation.y += widget->style->ythickness; child_allocation.width = MAX (1, (gint)child_allocation.width - - (gint) widget->style->klass->xthickness * 2); + (gint) widget->style->xthickness * 2); child_allocation.height = MAX (1, (gint)child_allocation.height - - (gint) widget->style->klass->ythickness * 2); + (gint) widget->style->ythickness * 2); if (notebook->show_tabs && notebook->children && notebook->cur_page) { @@ -1881,28 +1881,28 @@ gtk_notebook_expose_tabs (GtkNotebook *notebook) case GTK_POS_BOTTOM: event.area.y = (widget->allocation.height - border - page->allocation.height - - widget->style->klass->ythickness); + widget->style->ythickness); if (page != notebook->cur_page) - event.area.y -= widget->style->klass->ythickness; + event.area.y -= widget->style->ythickness; case GTK_POS_TOP: event.area.width = widget->allocation.width - 2 * border; event.area.height = (page->allocation.height + - widget->style->klass->ythickness); + widget->style->ythickness); if (page != notebook->cur_page) - event.area.height += widget->style->klass->ythickness; + event.area.height += widget->style->ythickness; break; case GTK_POS_RIGHT: event.area.x = (widget->allocation.width - border - page->allocation.width - - widget->style->klass->xthickness); + widget->style->xthickness); if (page != notebook->cur_page) - event.area.x -= widget->style->klass->xthickness; + event.area.x -= widget->style->xthickness; case GTK_POS_LEFT: event.area.width = (page->allocation.width + - widget->style->klass->xthickness); + widget->style->xthickness); event.area.height = widget->allocation.height - 2 * border; if (page != notebook->cur_page) - event.area.width += widget->style->klass->xthickness; + event.area.width += widget->style->xthickness; break; } gtk_widget_event (widget, (GdkEvent *) &event); @@ -2238,14 +2238,14 @@ gtk_notebook_paint (GtkWidget *widget, switch (notebook->tab_pos) { case GTK_POS_TOP: - y += page->allocation.height + widget->style->klass->ythickness; + y += page->allocation.height + widget->style->ythickness; case GTK_POS_BOTTOM: - height -= page->allocation.height + widget->style->klass->ythickness; + height -= page->allocation.height + widget->style->ythickness; break; case GTK_POS_LEFT: - x += page->allocation.width + widget->style->klass->xthickness; + x += page->allocation.width + widget->style->xthickness; case GTK_POS_RIGHT: - width -= page->allocation.width + widget->style->klass->xthickness; + width -= page->allocation.width + widget->style->xthickness; break; } gtk_paint_box (widget->style, widget->window, @@ -2511,17 +2511,17 @@ gtk_notebook_set_shape (GtkNotebook *notebook) { case GTK_POS_TOP: y += page->allocation.height + - widget->style->klass->ythickness; + widget->style->ythickness; case GTK_POS_BOTTOM: height -= page->allocation.height + - widget->style->klass->ythickness; + widget->style->ythickness; break; case GTK_POS_LEFT: x += page->allocation.width + - widget->style->klass->xthickness; + widget->style->xthickness; case GTK_POS_RIGHT: width -= page->allocation.width + - widget->style->klass->xthickness; + widget->style->xthickness; break; } } @@ -2536,11 +2536,11 @@ gtk_notebook_set_shape (GtkNotebook *notebook) { if (notebook->tab_pos == GTK_POS_LEFT) { - x -= widget->style->klass->xthickness * 2; - width += widget->style->klass->xthickness * 2; + x -= widget->style->xthickness * 2; + width += widget->style->xthickness * 2; } else if (notebook->tab_pos == GTK_POS_RIGHT) - width += widget->style->klass->xthickness * 2; + width += widget->style->xthickness * 2; } switch (notebook->tab_pos) { @@ -3061,8 +3061,8 @@ gtk_notebook_page_allocate (GtkNotebook *notebook, widget = GTK_WIDGET (notebook); - xthickness = widget->style->klass->xthickness; - ythickness = widget->style->klass->ythickness; + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; /* If the size of the notebook tabs change, we need to queue * a redraw on the tab area diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c index f5cff3bf4d..7bb65919a5 100644 --- a/gtk/gtkoptionmenu.c +++ b/gtk/gtkoptionmenu.c @@ -296,13 +296,13 @@ gtk_option_menu_size_request (GtkWidget *widget, option_menu = GTK_OPTION_MENU (widget); requisition->width = ((GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->xthickness) * 2 + + GTK_WIDGET (widget)->style->xthickness) * 2 + option_menu->width + OPTION_INDICATOR_WIDTH + OPTION_INDICATOR_SPACING * 5 + CHILD_LEFT_SPACING + CHILD_RIGHT_SPACING + 2); requisition->height = ((GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->ythickness) * 2 + + GTK_WIDGET (widget)->style->ythickness) * 2 + option_menu->height + CHILD_TOP_SPACING + CHILD_BOTTOM_SPACING + 2); @@ -332,9 +332,9 @@ gtk_option_menu_size_allocate (GtkWidget *widget, if (child && GTK_WIDGET_VISIBLE (child)) { child_allocation.x = (GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->xthickness) + 1; + GTK_WIDGET (widget)->style->xthickness) + 1; child_allocation.y = (GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->ythickness) + 1; + GTK_WIDGET (widget)->style->ythickness) + 1; child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2 - OPTION_INDICATOR_WIDTH - OPTION_INDICATOR_SPACING * 5 - CHILD_LEFT_SPACING - CHILD_RIGHT_SPACING - 2); diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c index c0e9af2028..972399ce97 100644 --- a/gtk/gtkprogressbar.c +++ b/gtk/gtkprogressbar.c @@ -279,19 +279,19 @@ gtk_progress_bar_real_update (GtkProgress *progress) pbar->activity_pos += pbar->activity_step; if (pbar->activity_pos + size >= widget->allocation.width - - widget->style->klass->xthickness) + widget->style->xthickness) { pbar->activity_pos = widget->allocation.width - - widget->style->klass->xthickness - size; + widget->style->xthickness - size; pbar->activity_dir = 1; } } else { pbar->activity_pos -= pbar->activity_step; - if (pbar->activity_pos <= widget->style->klass->xthickness) + if (pbar->activity_pos <= widget->style->xthickness) { - pbar->activity_pos = widget->style->klass->xthickness; + pbar->activity_pos = widget->style->xthickness; pbar->activity_dir = 0; } } @@ -305,19 +305,19 @@ gtk_progress_bar_real_update (GtkProgress *progress) pbar->activity_pos += pbar->activity_step; if (pbar->activity_pos + size >= widget->allocation.height - - widget->style->klass->ythickness) + widget->style->ythickness) { pbar->activity_pos = widget->allocation.height - - widget->style->klass->ythickness - size; + widget->style->ythickness - size; pbar->activity_dir = 1; } } else { pbar->activity_pos -= pbar->activity_step; - if (pbar->activity_pos <= widget->style->klass->ythickness) + if (pbar->activity_pos <= widget->style->ythickness) { - pbar->activity_pos = widget->style->klass->ythickness; + pbar->activity_pos = widget->style->ythickness; pbar->activity_dir = 0; } } @@ -366,13 +366,13 @@ gtk_progress_bar_size_request (GtkWidget *widget, progress->adjustment->upper); requisition->width = MAX (MIN_HORIZONTAL_BAR_WIDTH, - 2 * widget->style->klass->xthickness + 3 + + 2 * widget->style->xthickness + 3 + gdk_text_width (widget->style->font, buf, strlen (buf)) + 2 * TEXT_SPACING); requisition->height = MAX (MIN_HORIZONTAL_BAR_HEIGHT, - 2 * widget->style->klass->ythickness + 3 + + 2 * widget->style->ythickness + 3 + gdk_text_height (widget->style->font, buf, strlen (buf)) + 2 * TEXT_SPACING); @@ -392,13 +392,13 @@ gtk_progress_bar_size_request (GtkWidget *widget, progress->adjustment->upper); requisition->width = MAX (MIN_VERTICAL_BAR_WIDTH, - 2 * widget->style->klass->xthickness + 3 + + 2 * widget->style->xthickness + 3 + gdk_text_width (widget->style->font, buf, strlen (buf)) + 2 * TEXT_SPACING); requisition->height = MAX (MIN_VERTICAL_BAR_HEIGHT, - 2 * widget->style->klass->ythickness + 3 + + 2 * widget->style->ythickness + 3 + gdk_text_height (widget->style->font, buf, strlen (buf)) + 2 * TEXT_SPACING); @@ -431,14 +431,14 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress) if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT) { - pbar->activity_pos = widget->style->klass->xthickness; + pbar->activity_pos = widget->style->xthickness; pbar->activity_dir = 0; } else { pbar->activity_pos = widget->allocation.width - - widget->style->klass->xthickness - (widget->allocation.height - - widget->style->klass->ythickness * 2); + widget->style->xthickness - (widget->allocation.height - + widget->style->ythickness * 2); pbar->activity_dir = 1; } } @@ -448,14 +448,14 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress) if (pbar->orientation == GTK_PROGRESS_TOP_TO_BOTTOM) { - pbar->activity_pos = widget->style->klass->ythickness; + pbar->activity_pos = widget->style->ythickness; pbar->activity_dir = 0; } else { pbar->activity_pos = widget->allocation.height - - widget->style->klass->ythickness - (widget->allocation.width - - widget->style->klass->xthickness * 2); + widget->style->ythickness - (widget->allocation.width - + widget->style->xthickness * 2); pbar->activity_dir = 1; } } @@ -484,10 +484,10 @@ gtk_progress_bar_paint (GtkProgress *progress) if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT || pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT) space = widget->allocation.width - - 2 * widget->style->klass->xthickness; + 2 * widget->style->xthickness; else space = widget->allocation.height - - 2 * widget->style->klass->ythickness; + 2 * widget->style->ythickness; percentage = gtk_progress_get_current_percentage (progress); @@ -513,9 +513,9 @@ gtk_progress_bar_paint (GtkProgress *progress) GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", pbar->activity_pos, - widget->style->klass->ythickness, + widget->style->ythickness, size, - widget->allocation.height - widget->style->klass->ythickness * 2); + widget->allocation.height - widget->style->ythickness * 2); return; } else @@ -526,9 +526,9 @@ gtk_progress_bar_paint (GtkProgress *progress) progress->offscreen_pixmap, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", - widget->style->klass->xthickness, + widget->style->xthickness, pbar->activity_pos, - widget->allocation.width - widget->style->klass->xthickness * 2, + widget->allocation.width - widget->style->xthickness * 2, size); return; } @@ -549,14 +549,14 @@ gtk_progress_bar_paint (GtkProgress *progress) progress->offscreen_pixmap, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", - widget->style->klass->xthickness, - widget->style->klass->ythickness, + widget->style->xthickness, + widget->style->ythickness, amount, - widget->allocation.height - widget->style->klass->ythickness * 2); + widget->allocation.height - widget->style->ythickness * 2); } else { - x = widget->style->klass->xthickness; + x = widget->style->xthickness; for (i = 0; i <= pbar->in_block; i++) { @@ -568,9 +568,9 @@ gtk_progress_bar_paint (GtkProgress *progress) GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", x, - widget->style->klass->ythickness, + widget->style->ythickness, block_delta, - widget->allocation.height - widget->style->klass->ythickness * 2); + widget->allocation.height - widget->style->ythickness * 2); x += block_delta; } @@ -586,16 +586,16 @@ gtk_progress_bar_paint (GtkProgress *progress) GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", widget->allocation.width - - widget->style->klass->xthickness - amount, - widget->style->klass->ythickness, + widget->style->xthickness - amount, + widget->style->ythickness, amount, widget->allocation.height - - widget->style->klass->ythickness * 2); + widget->style->ythickness * 2); } else { x = widget->allocation.width - - widget->style->klass->xthickness; + widget->style->xthickness; for (i = 0; i <= pbar->in_block; i++) { @@ -609,10 +609,10 @@ gtk_progress_bar_paint (GtkProgress *progress) GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", x, - widget->style->klass->ythickness, + widget->style->ythickness, block_delta, widget->allocation.height - - widget->style->klass->ythickness * 2); + widget->style->ythickness * 2); } } break; @@ -625,17 +625,17 @@ gtk_progress_bar_paint (GtkProgress *progress) progress->offscreen_pixmap, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", - widget->style->klass->xthickness, + widget->style->xthickness, widget->allocation.height - - widget->style->klass->ythickness - amount, + widget->style->ythickness - amount, widget->allocation.width - - widget->style->klass->xthickness * 2, + widget->style->xthickness * 2, amount); } else { y = widget->allocation.height - - widget->style->klass->ythickness; + widget->style->ythickness; for (i = 0; i <= pbar->in_block; i++) { @@ -648,10 +648,10 @@ gtk_progress_bar_paint (GtkProgress *progress) progress->offscreen_pixmap, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", - widget->style->klass->xthickness, + widget->style->xthickness, y, widget->allocation.width - - widget->style->klass->xthickness * 2, + widget->style->xthickness * 2, block_delta); } } @@ -665,15 +665,15 @@ gtk_progress_bar_paint (GtkProgress *progress) progress->offscreen_pixmap, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", - widget->style->klass->xthickness, - widget->style->klass->ythickness, + widget->style->xthickness, + widget->style->ythickness, widget->allocation.width - - widget->style->klass->xthickness * 2, + widget->style->xthickness * 2, amount); } else { - y = widget->style->klass->ythickness; + y = widget->style->ythickness; for (i = 0; i <= pbar->in_block; i++) { @@ -685,10 +685,10 @@ gtk_progress_bar_paint (GtkProgress *progress) progress->offscreen_pixmap, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, NULL, widget, "bar", - widget->style->klass->xthickness, + widget->style->xthickness, y, widget->allocation.width - - widget->style->klass->xthickness * 2, + widget->style->xthickness * 2, block_delta); y += block_delta; @@ -710,22 +710,22 @@ gtk_progress_bar_paint (GtkProgress *progress) buf = gtk_progress_get_current_text (progress); - x = widget->style->klass->xthickness + 1 + - (widget->allocation.width - 2 * widget->style->klass->xthickness - + x = widget->style->xthickness + 1 + + (widget->allocation.width - 2 * widget->style->xthickness - 3 - gdk_text_width (widget->style->font, buf, strlen (buf))) * progress->x_align; y = widget->style->font->ascent + 1 + - (widget->allocation.height - 2 * widget->style->klass->ythickness - + (widget->allocation.height - 2 * widget->style->ythickness - 3 - gdk_text_height (widget->style->font, buf, strlen (buf))) * progress->y_align; - rect.x = widget->style->klass->xthickness + 1; - rect.y = widget->style->klass->ythickness + 1; + rect.x = widget->style->xthickness + 1; + rect.y = widget->style->ythickness + 1; rect.width = widget->allocation.width - - 2 * widget->style->klass->xthickness - 3; + 2 * widget->style->xthickness - 3; rect.height = widget->allocation.height - - 2 * widget->style->klass->ythickness - 3; + 2 * widget->style->ythickness - 3; gdk_gc_set_clip_rectangle (widget->style->fg_gc[widget->state], &rect); diff --git a/gtk/gtkradiomenuitem.c b/gtk/gtkradiomenuitem.c index 4d61ead40a..ed49696ab5 100644 --- a/gtk/gtkradiomenuitem.c +++ b/gtk/gtkradiomenuitem.c @@ -284,7 +284,7 @@ gtk_radio_menu_item_draw_indicator (GtkCheckMenuItem *check_menu_item, width = 8; height = 8; x = (GTK_CONTAINER (check_menu_item)->border_width + - widget->style->klass->xthickness + 2); + widget->style->xthickness + 2); y = (widget->allocation.height - height) / 2; if (check_menu_item->active || diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 92f49210c4..097a113f49 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -428,7 +428,7 @@ gtk_range_default_hslider_update (GtkRange *range) else if (x > right) x = right; - gdk_window_move (range->slider, x, GTK_WIDGET (range)->style->klass->ythickness); + gdk_window_move (range->slider, x, GTK_WIDGET (range)->style->ythickness); } } @@ -467,7 +467,7 @@ gtk_range_default_vslider_update (GtkRange *range) else if (y > bottom) y = bottom; - gdk_window_move (range->slider, GTK_WIDGET (range)->style->klass->xthickness, y); + gdk_window_move (range->slider, GTK_WIDGET (range)->style->xthickness, y); } } @@ -487,7 +487,7 @@ gtk_range_default_htrough_click (GtkRange *range, g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE); g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE); - ythickness = GTK_WIDGET (range)->style->klass->ythickness; + ythickness = GTK_WIDGET (range)->style->ythickness; gtk_range_trough_hdims (range, &left, &right); gdk_window_get_size (range->slider, &slider_length, NULL); @@ -533,7 +533,7 @@ gtk_range_default_vtrough_click (GtkRange *range, g_return_val_if_fail (range != NULL, GTK_TROUGH_NONE); g_return_val_if_fail (GTK_IS_RANGE (range), GTK_TROUGH_NONE); - xthickness = GTK_WIDGET (range)->style->klass->xthickness; + xthickness = GTK_WIDGET (range)->style->xthickness; gtk_range_trough_vdims (range, &top, &bottom); gdk_window_get_size (range->slider, NULL, &slider_length); @@ -1488,8 +1488,8 @@ gtk_range_trough_hdims (GtkRange *range, gdk_window_get_size (range->trough, &trough_width, NULL); gdk_window_get_size (range->slider, &slider_length, NULL); - tleft = GTK_WIDGET (range)->style->klass->xthickness; - tright = trough_width - slider_length - GTK_WIDGET (range)->style->klass->xthickness; + tleft = GTK_WIDGET (range)->style->xthickness; + tright = trough_width - slider_length - GTK_WIDGET (range)->style->xthickness; if (range->step_back) { @@ -1525,8 +1525,8 @@ gtk_range_trough_vdims (GtkRange *range, gdk_window_get_size (range->trough, NULL, &trough_height); gdk_window_get_size (range->slider, NULL, &slider_length); - ttop = GTK_WIDGET (range)->style->klass->ythickness; - tbottom = trough_height - slider_length - GTK_WIDGET (range)->style->klass->ythickness; + ttop = GTK_WIDGET (range)->style->ythickness; + tbottom = trough_height - slider_length - GTK_WIDGET (range)->style->ythickness; if (range->step_back) { diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 47fccb3a51..fba248c075 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -427,7 +427,7 @@ gtk_spin_button_realize (GtkWidget *widget) spin_button = GTK_SPIN_BUTTON (widget); real_width = widget->allocation.width; - widget->allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness; + widget->allocation.width -= ARROW_SIZE + 2 * widget->style->xthickness; gtk_widget_set_events (widget, gtk_widget_get_events (widget) | GDK_KEY_RELEASE_MASK); GTK_WIDGET_CLASS (parent_class)->realize (widget); @@ -446,10 +446,10 @@ gtk_spin_button_realize (GtkWidget *widget) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; attributes.x = (widget->allocation.x + widget->allocation.width - ARROW_SIZE - - 2 * widget->style->klass->xthickness); + 2 * widget->style->xthickness); attributes.y = widget->allocation.y + (widget->allocation.height - widget->requisition.height) / 2; - attributes.width = ARROW_SIZE + 2 * widget->style->klass->xthickness; + attributes.width = ARROW_SIZE + 2 * widget->style->xthickness; attributes.height = widget->requisition.height; spin_button->panel = gdk_window_new (gtk_widget_get_parent_window (widget), @@ -496,7 +496,7 @@ gtk_spin_button_size_request (GtkWidget *widget, GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); requisition->width = MIN_SPIN_BUTTON_WIDTH + ARROW_SIZE - + 2 * widget->style->klass->xthickness; + + 2 * widget->style->xthickness; } static void @@ -510,8 +510,8 @@ gtk_spin_button_size_allocate (GtkWidget *widget, g_return_if_fail (allocation != NULL); child_allocation = *allocation; - if (child_allocation.width > ARROW_SIZE + 2 * widget->style->klass->xthickness) - child_allocation.width -= ARROW_SIZE + 2 * widget->style->klass->xthickness; + if (child_allocation.width > ARROW_SIZE + 2 * widget->style->xthickness) + child_allocation.width -= ARROW_SIZE + 2 * widget->style->xthickness; GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, &child_allocation); @@ -519,10 +519,10 @@ gtk_spin_button_size_allocate (GtkWidget *widget, if (GTK_WIDGET_REALIZED (widget)) { - child_allocation.width = ARROW_SIZE + 2 * widget->style->klass->xthickness; + child_allocation.width = ARROW_SIZE + 2 * widget->style->xthickness; child_allocation.height = widget->requisition.height; child_allocation.x = (allocation->x + allocation->width - ARROW_SIZE - - 2 * widget->style->klass->xthickness); + 2 * widget->style->xthickness); child_allocation.y = allocation->y + (allocation->height - widget->requisition.height) / 2; gdk_window_move_resize (GTK_SPIN_BUTTON (widget)->panel, @@ -551,7 +551,7 @@ gtk_spin_button_paint (GtkWidget *widget, GTK_STATE_NORMAL, spin->shadow_type, area, widget, "spinbutton", 0, 0, - ARROW_SIZE + 2 * widget->style->klass->xthickness, + ARROW_SIZE + 2 * widget->style->xthickness, widget->requisition.height); else { @@ -640,31 +640,31 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, { if (spin_button->shadow_type != GTK_SHADOW_NONE) { - x = widget->style->klass->xthickness; - y = widget->style->klass->ythickness; + x = widget->style->xthickness; + y = widget->style->ythickness; } else { - x = widget->style->klass->xthickness - 1; - y = widget->style->klass->ythickness - 1; + x = widget->style->xthickness - 1; + y = widget->style->ythickness - 1; } gtk_paint_arrow (widget->style, spin_button->panel, state_type, shadow_type, NULL, widget, "spinbutton", arrow, TRUE, x, y, ARROW_SIZE, widget->requisition.height / 2 - - widget->style->klass->ythickness); + - widget->style->ythickness); } else { if (spin_button->shadow_type != GTK_SHADOW_NONE) { - x = widget->style->klass->xthickness; + x = widget->style->xthickness; y = widget->requisition.height / 2; } else { - x = widget->style->klass->xthickness - 1; + x = widget->style->xthickness - 1; y = widget->requisition.height / 2 + 1; } gtk_paint_arrow (widget->style, spin_button->panel, @@ -672,7 +672,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, NULL, widget, "spinbutton", arrow, TRUE, x, y, ARROW_SIZE, widget->requisition.height / 2 - - widget->style->klass->ythickness); + - widget->style->ythickness); } } } @@ -905,7 +905,7 @@ gtk_spin_button_button_release (GtkWidget *widget, { if (event->y >= 0 && event->x >= 0 && event->y <= widget->requisition.height && - event->x <= ARROW_SIZE + 2 * widget->style->klass->xthickness) + event->x <= ARROW_SIZE + 2 * widget->style->xthickness) { if (spin->click_child == GTK_ARROW_UP && event->y <= widget->requisition.height / 2) diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 72bacd2c49..853393930b 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -44,10 +44,9 @@ #define M_PI_4 0.78539816339744830962 #endif /* M_PI_4 */ -static void gtk_style_init (GtkStyle *style, - GdkColormap *colormap, - gint depth); -static void gtk_style_destroy (GtkStyle *style); +static void gtk_style_construct (GtkStyle *style, + GdkColormap *colormap, + gint depth); static void gtk_default_draw_hline (GtkStyle *style, GdkWindow *window, @@ -299,33 +298,6 @@ static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k); static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b); static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s); - -static const GtkStyleClass default_class = -{ - 2, - 2, - gtk_default_draw_hline, - gtk_default_draw_vline, - gtk_default_draw_shadow, - gtk_default_draw_polygon, - gtk_default_draw_arrow, - gtk_default_draw_diamond, - gtk_default_draw_oval, - gtk_default_draw_string, - gtk_default_draw_box, - gtk_default_draw_flat_box, - gtk_default_draw_check, - gtk_default_draw_option, - gtk_default_draw_cross, - gtk_default_draw_ramp, - gtk_default_draw_tab, - gtk_default_draw_shadow_gap, - gtk_default_draw_box_gap, - gtk_default_draw_extension, - gtk_default_draw_focus, - gtk_default_draw_slider, - gtk_default_draw_handle -}; GdkFont *default_font = NULL; static GdkColor gtk_default_normal_fg = { 0, 0, 0, 0 }; @@ -340,69 +312,45 @@ static GdkColor gtk_default_prelight_bg = { 0, 0xea60, 0xea60, 0xea60 }; static GdkColor gtk_default_selected_bg = { 0, 0, 0, 0x9c40 }; static GdkColor gtk_default_insensitive_bg = { 0, 0xd6d6, 0xd6d6, 0xd6d6 }; -GtkStyle* -gtk_style_copy (GtkStyle *style) +static gpointer parent_class = NULL; + +static void gtk_style_init (GtkStyle *style); +static void gtk_style_class_init (GtkStyleClass *klass); +static void gtk_style_finalize (GObject *object); + +GType +gtk_style_get_type (void) { - GtkStyle *new_style; - guint i; - - g_return_val_if_fail (style != NULL, NULL); - - new_style = gtk_style_new (); - - for (i = 0; i < 5; i++) - { - new_style->fg[i] = style->fg[i]; - new_style->bg[i] = style->bg[i]; - new_style->text[i] = style->text[i]; - new_style->base[i] = style->base[i]; - - new_style->bg_pixmap[i] = style->bg_pixmap[i]; - } - - gdk_font_unref (new_style->font); - new_style->font = style->font; - gdk_font_ref (new_style->font); + static GType object_type = 0; - if (style->rc_style) - { - new_style->rc_style = style->rc_style; - gtk_rc_style_ref (style->rc_style); - } - - if (style->engine) + if (!object_type) { - new_style->engine = style->engine; - gtk_theme_engine_ref (new_style->engine); - new_style->engine->duplicate_style (new_style, style); + static const GTypeInfo object_info = + { + sizeof (GtkStyleClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) gtk_style_class_init, + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (GtkStyle), + 0, /* n_preallocs */ + (GInstanceInitFunc) gtk_style_init, + }; + + object_type = g_type_register_static (G_TYPE_OBJECT, + "GtkStyle", + &object_info); } - - return new_style; -} - -static GtkStyle* -gtk_style_duplicate (GtkStyle *style) -{ - GtkStyle *new_style; - - g_return_val_if_fail (style != NULL, NULL); - - new_style = gtk_style_copy (style); - - style->styles = g_slist_append (style->styles, new_style); - new_style->styles = style->styles; - return new_style; + return object_type; } -GtkStyle* -gtk_style_new (void) +static void +gtk_style_init (GtkStyle *style) { - GtkStyle *style; gint i; - style = g_new0 (GtkStyle, 1); - if (!default_font) { default_font = @@ -416,11 +364,9 @@ gtk_style_new (void) style->font = default_font; gdk_font_ref (style->font); - style->ref_count = 1; style->attach_count = 0; style->colormap = NULL; style->depth = -1; - style->klass = (GtkStyleClass *)&default_class; style->black.red = 0; style->black.green = 0; @@ -472,6 +418,142 @@ gtk_style_new (void) style->text_gc[i] = NULL; style->base_gc[i] = NULL; } + + style->xthickness = 2; + style->ythickness = 2; +} + +static void +gtk_style_class_init (GtkStyleClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = gtk_style_finalize; + + klass->draw_hline = gtk_default_draw_hline; + klass->draw_vline = gtk_default_draw_vline; + klass->draw_shadow = gtk_default_draw_shadow; + klass->draw_polygon = gtk_default_draw_polygon; + klass->draw_arrow = gtk_default_draw_arrow; + klass->draw_diamond = gtk_default_draw_diamond; + klass->draw_oval = gtk_default_draw_oval; + klass->draw_string = gtk_default_draw_string; + klass->draw_box = gtk_default_draw_box; + klass->draw_flat_box = gtk_default_draw_flat_box; + klass->draw_check = gtk_default_draw_check; + klass->draw_option = gtk_default_draw_option; + klass->draw_cross = gtk_default_draw_cross; + klass->draw_ramp = gtk_default_draw_ramp; + klass->draw_tab = gtk_default_draw_tab; + klass->draw_shadow_gap = gtk_default_draw_shadow_gap; + klass->draw_box_gap = gtk_default_draw_box_gap; + klass->draw_extension = gtk_default_draw_extension; + klass->draw_focus = gtk_default_draw_focus; + klass->draw_slider = gtk_default_draw_slider; + klass->draw_handle = gtk_default_draw_handle; +} + +static void +gtk_style_finalize (GObject *object) +{ + GtkStyle *style = GTK_STYLE (object); + + g_return_if_fail (style->attach_count == 0); + + if (style->styles) + { + if (style->styles->data != style) + g_slist_remove (style->styles, style); + else + { + GSList *tmp_list = style->styles->next; + + while (tmp_list) + { + ((GtkStyle*) tmp_list->data)->styles = style->styles->next; + tmp_list = tmp_list->next; + } + g_slist_free_1 (style->styles); + } + } + + if (style->engine) + { + style->engine->destroy_style (style); + gtk_theme_engine_unref (style->engine); + } + + gdk_font_unref (style->font); + if (style->rc_style) + gtk_rc_style_unref (style->rc_style); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + + +GtkStyle* +gtk_style_copy (GtkStyle *style) +{ + GtkStyle *new_style; + guint i; + + g_return_val_if_fail (style != NULL, NULL); + + new_style = gtk_style_new (); + + for (i = 0; i < 5; i++) + { + new_style->fg[i] = style->fg[i]; + new_style->bg[i] = style->bg[i]; + new_style->text[i] = style->text[i]; + new_style->base[i] = style->base[i]; + + new_style->bg_pixmap[i] = style->bg_pixmap[i]; + } + + gdk_font_unref (new_style->font); + new_style->font = style->font; + gdk_font_ref (new_style->font); + + if (style->rc_style) + { + new_style->rc_style = style->rc_style; + gtk_rc_style_ref (style->rc_style); + } + + if (style->engine) + { + new_style->engine = style->engine; + gtk_theme_engine_ref (new_style->engine); + new_style->engine->duplicate_style (new_style, style); + } + + return new_style; +} + +static GtkStyle* +gtk_style_duplicate (GtkStyle *style) +{ + GtkStyle *new_style; + + g_return_val_if_fail (style != NULL, NULL); + + new_style = gtk_style_copy (style); + + style->styles = g_slist_append (style->styles, new_style); + new_style->styles = style->styles; + + return new_style; +} + +GtkStyle* +gtk_style_new (void) +{ + GtkStyle *style; + + style = GTK_STYLE (g_type_create_instance (gtk_style_get_type ())); return style; } @@ -534,7 +616,7 @@ gtk_style_attach (GtkStyle *style, if (new_style->attach_count == 0) { - gtk_style_init (new_style, colormap, depth); + gtk_style_construct (new_style, colormap, depth); break; } else if (new_style->colormap == colormap && @@ -548,7 +630,7 @@ gtk_style_attach (GtkStyle *style, if (!new_style) { new_style = gtk_style_duplicate (style); - gtk_style_init (new_style, colormap, depth); + gtk_style_construct (new_style, colormap, depth); } /* A style gets a refcount from being attached */ @@ -601,28 +683,19 @@ gtk_style_detach (GtkStyle *style) GtkStyle* gtk_style_ref (GtkStyle *style) { - g_return_val_if_fail (style != NULL, NULL); - g_return_val_if_fail (style->ref_count > 0, NULL); - - style->ref_count += 1; - return style; + return (GtkStyle *) g_object_ref (G_OBJECT (style)); } void gtk_style_unref (GtkStyle *style) { - g_return_if_fail (style != NULL); - g_return_if_fail (style->ref_count > 0); - - style->ref_count -= 1; - if (style->ref_count == 0) - gtk_style_destroy (style); + g_object_unref (G_OBJECT (style)); } static void -gtk_style_init (GtkStyle *style, - GdkColormap *colormap, - gint depth) +gtk_style_construct (GtkStyle *style, + GdkColormap *colormap, + gint depth) { GdkGCValues gc_values; GdkGCValuesMask gc_values_mask; @@ -717,41 +790,6 @@ gtk_style_init (GtkStyle *style, style->engine->realize_style (style); } -static void -gtk_style_destroy (GtkStyle *style) -{ - g_return_if_fail (style->attach_count == 0); - - if (style->styles) - { - if (style->styles->data != style) - g_slist_remove (style->styles, style); - else - { - GSList *tmp_list = style->styles->next; - - while (tmp_list) - { - ((GtkStyle*) tmp_list->data)->styles = style->styles->next; - tmp_list = tmp_list->next; - } - g_slist_free_1 (style->styles); - } - } - - if (style->engine) - { - style->engine->destroy_style (style); - gtk_theme_engine_unref (style->engine); - } - - gdk_font_unref (style->font); - if (style->rc_style) - gtk_rc_style_unref (style->rc_style); - - g_free (style); -} - void gtk_draw_hline (GtkStyle *style, GdkWindow *window, @@ -761,10 +799,9 @@ gtk_draw_hline (GtkStyle *style, gint y) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_hline != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL); - style->klass->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y); + GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, NULL, NULL, NULL, x1, x2, y); } @@ -777,10 +814,9 @@ gtk_draw_vline (GtkStyle *style, gint x) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_vline != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL); - style->klass->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x); + GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, NULL, NULL, NULL, y1, y2, x); } @@ -795,10 +831,9 @@ gtk_draw_shadow (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_shadow != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL); - style->klass->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -811,10 +846,9 @@ gtk_draw_polygon (GtkStyle *style, gboolean fill) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_polygon != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_polygon != NULL); - style->klass->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill); + GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill); } void @@ -830,10 +864,9 @@ gtk_draw_arrow (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_arrow != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL); - style->klass->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height); } @@ -848,10 +881,9 @@ gtk_draw_diamond (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_diamond != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL); - style->klass->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } @@ -866,10 +898,9 @@ gtk_draw_oval (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_oval != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL); - style->klass->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -881,10 +912,9 @@ gtk_draw_string (GtkStyle *style, const gchar *string) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_string != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL); - style->klass->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string); + GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, NULL, NULL, NULL, x, y, string); } void @@ -898,10 +928,9 @@ gtk_draw_box (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_box != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL); - style->klass->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -915,10 +944,9 @@ gtk_draw_flat_box (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_flat_box != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL); - style->klass->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -932,10 +960,9 @@ gtk_draw_check (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_check != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL); - style->klass->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -949,10 +976,9 @@ gtk_draw_option (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_option != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL); - style->klass->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -966,10 +992,9 @@ gtk_draw_cross (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_cross != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL); - style->klass->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -984,10 +1009,9 @@ gtk_draw_ramp (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_ramp != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL); - style->klass->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height); } void @@ -1001,10 +1025,9 @@ gtk_draw_tab (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_tab != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL); - style->klass->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height); } void @@ -1021,10 +1044,9 @@ gtk_draw_shadow_gap (GtkStyle *style, gint gap_width) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_shadow_gap != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL); - style->klass->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width); + GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width); } void @@ -1041,10 +1063,9 @@ gtk_draw_box_gap (GtkStyle *style, gint gap_width) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_box_gap != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL); - style->klass->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width); + GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width); } void @@ -1059,10 +1080,9 @@ gtk_draw_extension (GtkStyle *style, GtkPositionType gap_side) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_extension != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL); - style->klass->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side); + GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side); } void @@ -1074,10 +1094,9 @@ gtk_draw_focus (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_focus != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL); - style->klass->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, NULL, NULL, NULL, x, y, width, height); } void @@ -1092,10 +1111,9 @@ gtk_draw_slider (GtkStyle *style, GtkOrientation orientation) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_slider != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL); - style->klass->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation); + GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation); } void @@ -1110,10 +1128,9 @@ gtk_draw_handle (GtkStyle *style, GtkOrientation orientation) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_handle != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL); - style->klass->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation); + GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation); } void @@ -1237,8 +1254,8 @@ gtk_default_draw_hline (GtkStyle *style, g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); - thickness_light = style->klass->ythickness / 2; - thickness_dark = style->klass->ythickness - thickness_light; + thickness_light = style->ythickness / 2; + thickness_dark = style->ythickness - thickness_light; if (area) { @@ -1294,8 +1311,8 @@ gtk_default_draw_vline (GtkStyle *style, g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); - thickness_light = style->klass->xthickness / 2; - thickness_dark = style->klass->xthickness - thickness_light; + thickness_light = style->xthickness / 2; + thickness_dark = style->xthickness - thickness_light; if (area) { @@ -2891,10 +2908,10 @@ gtk_default_draw_extension (GtkStyle *style, gtk_style_apply_default_background (style, window, widget && !GTK_WIDGET_NO_WINDOW (widget), state_type, area, - x + style->klass->xthickness, + x + style->xthickness, y, - width - (2 * style->klass->xthickness), - height - (style->klass->ythickness)); + width - (2 * style->xthickness), + height - (style->ythickness)); gdk_draw_line (window, gc1, x, y, x, y + height - 2); gdk_draw_line (window, gc2, @@ -2913,10 +2930,10 @@ gtk_default_draw_extension (GtkStyle *style, gtk_style_apply_default_background (style, window, widget && !GTK_WIDGET_NO_WINDOW (widget), state_type, area, - x + style->klass->xthickness, - y + style->klass->ythickness, - width - (2 * style->klass->xthickness), - height - (style->klass->ythickness)); + x + style->xthickness, + y + style->ythickness, + width - (2 * style->xthickness), + height - (style->ythickness)); gdk_draw_line (window, gc1, x + 1, y, x + width - 2, y); gdk_draw_line (window, gc1, @@ -2936,9 +2953,9 @@ gtk_default_draw_extension (GtkStyle *style, widget && !GTK_WIDGET_NO_WINDOW (widget), state_type, area, x, - y + style->klass->ythickness, - width - (style->klass->xthickness), - height - (2 * style->klass->ythickness)); + y + style->ythickness, + width - (style->xthickness), + height - (2 * style->ythickness)); gdk_draw_line (window, gc1, x, y, x + width - 2, y); gdk_draw_line (window, gc2, @@ -2957,10 +2974,10 @@ gtk_default_draw_extension (GtkStyle *style, gtk_style_apply_default_background (style, window, widget && !GTK_WIDGET_NO_WINDOW (widget), state_type, area, - x + style->klass->xthickness, - y + style->klass->ythickness, - width - (style->klass->xthickness), - height - (2 * style->klass->ythickness)); + x + style->xthickness, + y + style->ythickness, + width - (style->xthickness), + height - (2 * style->ythickness)); gdk_draw_line (window, gc1, x + 1, y, x + width - 1, y); gdk_draw_line (window, gc1, @@ -3072,12 +3089,12 @@ gtk_default_draw_slider (GtkStyle *style, if (orientation == GTK_ORIENTATION_HORIZONTAL) gtk_paint_vline (style, window, state_type, area, widget, detail, - style->klass->ythickness, - height - style->klass->ythickness - 1, width / 2); + style->ythickness, + height - style->ythickness - 1, width / 2); else gtk_paint_hline (style, window, state_type, area, widget, detail, - style->klass->xthickness, - width - style->klass->xthickness - 1, height / 2); + style->xthickness, + width - style->xthickness - 1, height / 2); } static void @@ -3153,8 +3170,8 @@ gtk_default_draw_handle (GtkStyle *style, } else { - xthick = style->klass->xthickness; - ythick = style->klass->ythickness; + xthick = style->xthickness; + ythick = style->ythickness; light_gc = style->light_gc[state_type]; dark_gc = style->dark_gc[state_type]; @@ -3403,10 +3420,9 @@ gtk_paint_hline (GtkStyle *style, gint y) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_hline != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_hline != NULL); - style->klass->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y); + GTK_STYLE_GET_CLASS (style)->draw_hline (style, window, state_type, area, widget, detail, x1, x2, y); } void @@ -3421,10 +3437,9 @@ gtk_paint_vline (GtkStyle *style, gint x) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_vline != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_vline != NULL); - style->klass->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x); + GTK_STYLE_GET_CLASS (style)->draw_vline (style, window, state_type, area, widget, detail, y1, y2, x); } void @@ -3441,10 +3456,9 @@ gtk_paint_shadow (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_shadow != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL); - style->klass->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_shadow (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3460,10 +3474,9 @@ gtk_paint_polygon (GtkStyle *style, gboolean fill) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_shadow != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow != NULL); - style->klass->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill); + GTK_STYLE_GET_CLASS (style)->draw_polygon (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill); } void @@ -3482,10 +3495,9 @@ gtk_paint_arrow (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_arrow != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_arrow != NULL); - style->klass->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_arrow (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height); } void @@ -3502,10 +3514,9 @@ gtk_paint_diamond (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_diamond != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_diamond != NULL); - style->klass->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_diamond (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3522,10 +3533,9 @@ gtk_paint_oval (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_oval != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_oval != NULL); - style->klass->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_oval (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3540,10 +3550,9 @@ gtk_paint_string (GtkStyle *style, const gchar *string) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_string != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_string != NULL); - style->klass->draw_string (style, window, state_type, area, widget, detail, x, y, string); + GTK_STYLE_GET_CLASS (style)->draw_string (style, window, state_type, area, widget, detail, x, y, string); } void @@ -3560,10 +3569,9 @@ gtk_paint_box (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_box != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box != NULL); - style->klass->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3580,10 +3588,9 @@ gtk_paint_flat_box (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_flat_box != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_flat_box != NULL); - style->klass->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3600,10 +3607,9 @@ gtk_paint_check (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_check != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_check != NULL); - style->klass->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_check (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3620,10 +3626,9 @@ gtk_paint_option (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_option != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_option != NULL); - style->klass->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_option (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3640,10 +3645,9 @@ gtk_paint_cross (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_cross != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_cross != NULL); - style->klass->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_cross (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3661,10 +3665,9 @@ gtk_paint_ramp (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_ramp != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_ramp != NULL); - style->klass->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_ramp (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height); } void @@ -3681,10 +3684,9 @@ gtk_paint_tab (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_tab != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_tab != NULL); - style->klass->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_tab (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } void @@ -3704,10 +3706,9 @@ gtk_paint_shadow_gap (GtkStyle *style, gint gap_width) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_shadow_gap != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_shadow_gap != NULL); - style->klass->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); + GTK_STYLE_GET_CLASS (style)->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); } @@ -3728,10 +3729,9 @@ gtk_paint_box_gap (GtkStyle *style, gint gap_width) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_box_gap != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_box_gap != NULL); - style->klass->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); + GTK_STYLE_GET_CLASS (style)->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); } void @@ -3749,10 +3749,9 @@ gtk_paint_extension (GtkStyle *style, GtkPositionType gap_side) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_extension != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_extension != NULL); - style->klass->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side); + GTK_STYLE_GET_CLASS (style)->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side); } void @@ -3767,10 +3766,9 @@ gtk_paint_focus (GtkStyle *style, gint height) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_focus != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_focus != NULL); - style->klass->draw_focus (style, window, area, widget, detail, x, y, width, height); + GTK_STYLE_GET_CLASS (style)->draw_focus (style, window, area, widget, detail, x, y, width, height); } void @@ -3788,10 +3786,9 @@ gtk_paint_slider (GtkStyle *style, GtkOrientation orientation) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_slider != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_slider != NULL); - style->klass->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); + GTK_STYLE_GET_CLASS (style)->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); } void @@ -3809,8 +3806,7 @@ gtk_paint_handle (GtkStyle *style, GtkOrientation orientation) { g_return_if_fail (style != NULL); - g_return_if_fail (style->klass != NULL); - g_return_if_fail (style->klass->draw_handle != NULL); + g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_handle != NULL); - style->klass->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); + GTK_STYLE_GET_CLASS (style)->draw_handle (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); } diff --git a/gtk/gtkstyle.h b/gtk/gtkstyle.h index e2de64e04f..1e429ab248 100644 --- a/gtk/gtkstyle.h +++ b/gtk/gtkstyle.h @@ -38,6 +38,13 @@ extern "C" { typedef struct _GtkStyle GtkStyle; typedef struct _GtkStyleClass GtkStyleClass; +#define GTK_TYPE_STYLE (gtk_style_get_type ()) +#define GTK_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_STYLE, GtkStyle)) +#define GTK_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STYLE, GtkStyleClass)) +#define GTK_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_STYLE)) +#define GTK_IS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE)) +#define GTK_STYLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass)) + /* Some forward declarations needed to rationalize the header * files. */ @@ -59,8 +66,10 @@ typedef struct _GtkWidget GtkWidget; struct _GtkStyle { - GtkStyleClass *klass; + GObject parent_instance; + /*< public >*/ + GdkColor fg[5]; GdkColor bg[5]; GdkColor light[5]; @@ -84,10 +93,12 @@ struct _GtkStyle GdkGC *white_gc; GdkPixmap *bg_pixmap[5]; + + gint xthickness; + gint ythickness; - /* private */ + /*< private >*/ - gint ref_count; gint attach_count; gint depth; @@ -105,8 +116,7 @@ struct _GtkStyle struct _GtkStyleClass { - gint xthickness; - gint ythickness; + GObjectClass parent_class; void (*draw_hline) (GtkStyle *style, GdkWindow *window, @@ -344,6 +354,7 @@ struct _GtkStyleClass GtkOrientation orientation); }; +GType gtk_style_get_type (void); GtkStyle* gtk_style_new (void); GtkStyle* gtk_style_copy (GtkStyle *style); GtkStyle* gtk_style_attach (GtkStyle *style, diff --git a/gtk/gtktearoffmenuitem.c b/gtk/gtktearoffmenuitem.c index ac775cd6cb..5af1baf2f5 100644 --- a/gtk/gtktearoffmenuitem.c +++ b/gtk/gtktearoffmenuitem.c @@ -108,10 +108,10 @@ gtk_tearoff_menu_item_size_request (GtkWidget *widget, tearoff = GTK_TEAROFF_MENU_ITEM (widget); requisition->width = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness + + widget->style->xthickness + BORDER_SPACING) * 2; requisition->height = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->ythickness) * 2; + widget->style->ythickness) * 2; if (tearoff->torn_off) { @@ -119,7 +119,7 @@ gtk_tearoff_menu_item_size_request (GtkWidget *widget, } else { - requisition->height += widget->style->klass->ythickness; + requisition->height += widget->style->ythickness; } } @@ -188,7 +188,7 @@ gtk_tearoff_menu_item_paint (GtkWidget *widget, { gtk_draw_hline (widget->style, widget->window, GTK_STATE_NORMAL, x, MIN (x+TEAR_LENGTH, right_max), - y + (height - widget->style->klass->ythickness)/2); + y + (height - widget->style->ythickness)/2); x += 2 * TEAR_LENGTH; } } diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 3b6bfd2aef..341e3b0dff 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1309,8 +1309,8 @@ gtk_text_realize (GtkWidget *widget) widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window_set_user_data (widget->window, text); - attributes.x = (widget->style->klass->xthickness + TEXT_BORDER_ROOM); - attributes.y = (widget->style->klass->ythickness + TEXT_BORDER_ROOM); + attributes.x = (widget->style->xthickness + TEXT_BORDER_ROOM); + attributes.y = (widget->style->ythickness + TEXT_BORDER_ROOM); attributes.width = MAX (1, (gint)widget->allocation.width - (gint)attributes.x * 2); attributes.height = MAX (1, (gint)widget->allocation.height - (gint)attributes.y * 2); @@ -1508,8 +1508,8 @@ clear_focus_area (GtkText *text, gint area_x, gint area_y, gint area_width, gint { GtkWidget *widget = GTK_WIDGET (text); - gint ythick = TEXT_BORDER_ROOM + widget->style->klass->ythickness; - gint xthick = TEXT_BORDER_ROOM + widget->style->klass->xthickness; + gint ythick = TEXT_BORDER_ROOM + widget->style->ythickness; + gint xthick = TEXT_BORDER_ROOM + widget->style->xthickness; gint width, height; @@ -1537,8 +1537,8 @@ gtk_text_draw_focus (GtkWidget *widget) if (GTK_WIDGET_DRAWABLE (widget)) { - gint ythick = widget->style->klass->ythickness; - gint xthick = widget->style->klass->xthickness; + gint ythick = widget->style->ythickness; + gint xthick = widget->style->xthickness; gint xextra = TEXT_BORDER_ROOM; gint yextra = TEXT_BORDER_ROOM; @@ -1608,8 +1608,8 @@ gtk_text_size_request (GtkWidget *widget, g_return_if_fail (GTK_IS_TEXT (widget)); g_return_if_fail (requisition != NULL); - xthickness = widget->style->klass->xthickness + TEXT_BORDER_ROOM; - ythickness = widget->style->klass->ythickness + TEXT_BORDER_ROOM; + xthickness = widget->style->xthickness + TEXT_BORDER_ROOM; + ythickness = widget->style->ythickness + TEXT_BORDER_ROOM; char_height = MIN_TEXT_HEIGHT_LINES * (widget->style->font->ascent + widget->style->font->descent); @@ -1645,11 +1645,11 @@ gtk_text_size_allocate (GtkWidget *widget, allocation->width, allocation->height); gdk_window_move_resize (text->text_area, - widget->style->klass->xthickness + TEXT_BORDER_ROOM, - widget->style->klass->ythickness + TEXT_BORDER_ROOM, - MAX (1, (gint)widget->allocation.width - (gint)(widget->style->klass->xthickness + + widget->style->xthickness + TEXT_BORDER_ROOM, + widget->style->ythickness + TEXT_BORDER_ROOM, + MAX (1, (gint)widget->allocation.width - (gint)(widget->style->xthickness + (gint)TEXT_BORDER_ROOM) * 2), - MAX (1, (gint)widget->allocation.height - (gint)(widget->style->klass->ythickness + + MAX (1, (gint)widget->allocation.height - (gint)(widget->style->ythickness + (gint)TEXT_BORDER_ROOM) * 2)); #ifdef USE_XIM diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c index 788ac67009..9ae77e89cb 100644 --- a/gtk/gtktogglebutton.c +++ b/gtk/gtktogglebutton.c @@ -344,8 +344,8 @@ gtk_toggle_button_paint (GtkWidget *widget, if (GTK_WIDGET_CAN_DEFAULT (widget)) { - x += widget->style->klass->xthickness; - y += widget->style->klass->ythickness; + x += widget->style->xthickness; + y += widget->style->ythickness; width -= 2 * x + DEFAULT_SPACING; height -= 2 * y + DEFAULT_SPACING; x += DEFAULT_LEFT_POS; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 9aa8d7d17b..56b1537af5 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -391,7 +391,7 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, SPACE_LINE_END / SPACE_LINE_DIVISION, child_space->alloc_x + (toolbar->space_size - - widget->style->klass->xthickness) / 2); + widget->style->xthickness) / 2); else gtk_paint_hline (widget->style, widget->window, GTK_WIDGET_STATE (widget), area, widget, @@ -402,7 +402,7 @@ gtk_toolbar_paint_space_line (GtkWidget *widget, SPACE_LINE_END / SPACE_LINE_DIVISION, child_space->alloc_y + (toolbar->space_size - - widget->style->klass->ythickness) / 2); + widget->style->ythickness) / 2); } static void diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 63e2d77203..06900650fb 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -499,7 +499,7 @@ gtk_tree_item_size_request (GtkWidget *widget, item = GTK_TREE_ITEM(widget); requisition->width = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness) * 2; + widget->style->xthickness) * 2; requisition->height = GTK_CONTAINER (widget)->border_width * 2; if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) @@ -546,7 +546,7 @@ gtk_tree_item_size_allocate (GtkWidget *widget, if (bin->child) { border_width = (GTK_CONTAINER (widget)->border_width + - widget->style->klass->xthickness); + widget->style->xthickness); child_allocation.x = border_width + GTK_TREE(widget->parent)->current_indent; child_allocation.y = GTK_CONTAINER (widget)->border_width; diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 481f59425a..ef18bacc74 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -449,8 +449,8 @@ gtk_viewport_realize (GtkWidget *widget) if (viewport->shadow_type != GTK_SHADOW_NONE) { - attributes.x = widget->style->klass->xthickness; - attributes.y = widget->style->klass->ythickness; + attributes.x = widget->style->xthickness; + attributes.y = widget->style->ythickness; } else { @@ -564,8 +564,8 @@ gtk_viewport_draw (GtkWidget *widget, gtk_viewport_paint (widget, &tmp_area); - tmp_area.x += viewport->hadjustment->value - widget->style->klass->xthickness; - tmp_area.y += viewport->vadjustment->value - widget->style->klass->ythickness; + tmp_area.x += viewport->hadjustment->value - widget->style->xthickness; + tmp_area.y += viewport->vadjustment->value - widget->style->ythickness; gtk_paint_flat_box(widget->style, viewport->bin_window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, @@ -654,10 +654,10 @@ gtk_viewport_size_request (GtkWidget *widget, bin = GTK_BIN (widget); requisition->width = (GTK_CONTAINER (widget)->border_width + - GTK_WIDGET (widget)->style->klass->xthickness) * 2 + 5; + GTK_WIDGET (widget)->style->xthickness) * 2 + 5; requisition->height = (GTK_CONTAINER (widget)->border_width * 2 + - GTK_WIDGET (widget)->style->klass->ythickness) * 2 + 5; + GTK_WIDGET (widget)->style->ythickness) * 2 + 5; if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { @@ -698,8 +698,8 @@ gtk_viewport_size_allocate (GtkWidget *widget, if (viewport->shadow_type != GTK_SHADOW_NONE) { - child_allocation.x = GTK_WIDGET (viewport)->style->klass->xthickness; - child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness; + child_allocation.x = GTK_WIDGET (viewport)->style->xthickness; + child_allocation.y = GTK_WIDGET (viewport)->style->ythickness; } child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2 - border_width * 2); diff --git a/gtk/gtkvruler.c b/gtk/gtkvruler.c index dec56a3bf5..ff8587e33f 100644 --- a/gtk/gtkvruler.c +++ b/gtk/gtkvruler.c @@ -92,8 +92,8 @@ gtk_vruler_init (GtkVRuler *vruler) GtkWidget *widget; widget = GTK_WIDGET (vruler); - widget->requisition.width = widget->style->klass->xthickness * 2 + RULER_WIDTH; - widget->requisition.height = widget->style->klass->ythickness * 2 + 1; + widget->requisition.width = widget->style->xthickness * 2 + RULER_WIDTH; + widget->requisition.height = widget->style->ythickness * 2 + 1; } GtkWidget* @@ -163,8 +163,8 @@ gtk_vruler_draw_ticks (GtkRuler *ruler) gc = widget->style->fg_gc[GTK_STATE_NORMAL]; bg_gc = widget->style->bg_gc[GTK_STATE_NORMAL]; font = widget->style->font; - xthickness = widget->style->klass->xthickness; - ythickness = widget->style->klass->ythickness; + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; digit_height = font->ascent; /* assume descent == 0 ? */ width = widget->allocation.height; @@ -280,8 +280,8 @@ gtk_vruler_draw_pos (GtkRuler *ruler) widget = GTK_WIDGET (ruler); gc = widget->style->fg_gc[GTK_STATE_NORMAL]; - xthickness = widget->style->klass->xthickness; - ythickness = widget->style->klass->ythickness; + xthickness = widget->style->xthickness; + ythickness = widget->style->ythickness; width = widget->allocation.width - xthickness * 2; height = widget->allocation.height; diff --git a/gtk/gtkvscale.c b/gtk/gtkvscale.c index 003760cbab..ef83fdf65b 100644 --- a/gtk/gtkvscale.c +++ b/gtk/gtkvscale.c @@ -326,9 +326,9 @@ gtk_vscale_size_request (GtkWidget *widget, scale = GTK_SCALE (widget); requisition->width = (RANGE_CLASS (scale)->slider_width + - widget->style->klass->ythickness * 2); + widget->style->ythickness * 2); requisition->height = (SCALE_CLASS (scale)->slider_length + - widget->style->klass->xthickness) * 2; + widget->style->xthickness) * 2; if (scale->draw_value) { @@ -395,7 +395,7 @@ gtk_vscale_pos_trough (GtkVScale *vscale, scale = GTK_SCALE (vscale); *w = (RANGE_CLASS (scale)->slider_width + - widget->style->klass->xthickness * 2); + widget->style->xthickness * 2); *h = widget->allocation.height; if (scale->draw_value) diff --git a/gtk/gtkvscrollbar.c b/gtk/gtkvscrollbar.c index 833f003a6f..1d9ccf72fe 100644 --- a/gtk/gtkvscrollbar.c +++ b/gtk/gtkvscrollbar.c @@ -163,11 +163,11 @@ gtk_vscrollbar_init (GtkVScrollbar *vscrollbar) requisition = &widget->requisition; requisition->width = (RANGE_CLASS (widget)->slider_width + - widget->style->klass->xthickness * 2); + widget->style->xthickness * 2); requisition->height = (RANGE_CLASS (widget)->min_slider_size + RANGE_CLASS (widget)->stepper_size + RANGE_CLASS (widget)->stepper_slider_spacing + - widget->style->klass->ythickness) * 2; + widget->style->ythickness) * 2; } GtkWidget* @@ -217,20 +217,20 @@ gtk_vscrollbar_realize (GtkWidget *widget) range->trough = widget->window; gdk_window_ref (range->trough); - attributes.x = widget->style->klass->xthickness; - attributes.y = widget->style->klass->ythickness; + attributes.x = widget->style->xthickness; + attributes.y = widget->style->ythickness; attributes.width = RANGE_CLASS (widget)->stepper_size; attributes.height = RANGE_CLASS (widget)->stepper_size; range->step_back = gdk_window_new (range->trough, &attributes, attributes_mask); attributes.y = (widget->allocation.height - - widget->style->klass->ythickness - + widget->style->ythickness - RANGE_CLASS (widget)->stepper_size); range->step_forw = gdk_window_new (range->trough, &attributes, attributes_mask); - attributes.x = widget->style->klass->ythickness; + attributes.x = widget->style->ythickness; attributes.y = 0; attributes.width = RANGE_CLASS (widget)->slider_width; attributes.height = RANGE_CLASS (widget)->min_slider_size; @@ -279,15 +279,15 @@ gtk_vscrollbar_size_allocate (GtkWidget *widget, allocation->y, widget->requisition.width, allocation->height); gdk_window_move_resize (range->step_back, - widget->style->klass->xthickness, - widget->style->klass->ythickness, - widget->requisition.width - widget->style->klass->xthickness * 2, + widget->style->xthickness, + widget->style->ythickness, + widget->requisition.width - widget->style->xthickness * 2, RANGE_CLASS (widget)->stepper_size); gdk_window_move_resize (range->step_forw, - widget->style->klass->xthickness, - allocation->height - widget->style->klass->ythickness - + widget->style->xthickness, + allocation->height - widget->style->ythickness - RANGE_CLASS (widget)->stepper_size, - widget->requisition.width - widget->style->klass->xthickness * 2, + widget->requisition.width - widget->style->xthickness * 2, RANGE_CLASS (widget)->stepper_size); gtk_range_slider_update (GTK_RANGE (widget)); diff --git a/gtk/gtkvseparator.c b/gtk/gtkvseparator.c index f74bdce463..bf537a1bb0 100644 --- a/gtk/gtkvseparator.c +++ b/gtk/gtkvseparator.c @@ -71,7 +71,7 @@ gtk_vseparator_class_init (GtkVSeparatorClass *klass) static void gtk_vseparator_init (GtkVSeparator *vseparator) { - GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->klass->xthickness; + GTK_WIDGET (vseparator)->requisition.width = GTK_WIDGET (vseparator)->style->xthickness; GTK_WIDGET (vseparator)->requisition.height = 1; } @@ -96,7 +96,7 @@ gtk_vseparator_expose (GtkWidget *widget, widget->allocation.y, widget->allocation.y + widget->allocation.height, widget->allocation.x + (widget->allocation.width - - widget->style->klass->xthickness) / 2); + widget->style->xthickness) / 2); return FALSE; } |