diff options
author | Cody Russell <bratsche@gnome.org> | 2007-09-20 16:51:16 +0000 |
---|---|---|
committer | Cody Russell <bratsche@src.gnome.org> | 2007-09-20 16:51:16 +0000 |
commit | a1045cf3173e431561038908c37b9c6394757c88 (patch) | |
tree | 9b9a740065a9090cc78e06462443378133d12e9b /modules | |
parent | 0142bd3f024664b655cd9899b8aa63bca4b5c057 (diff) | |
download | gtk+-a1045cf3173e431561038908c37b9c6394757c88.tar.gz |
Override draw_layout method in GtkStyle in order to adjust by 2 pixels any
2007-09-20 Cody Russell <bratsche@gnome.org>
* modules/engines/ms-windows/msw_style.c: Override draw_layout
method in GtkStyle in order to adjust by 2 pixels any labels
that are in GtkNotebook tabs using XP theme, so that they appear
correctly centered. (#478637)
svn path=/trunk/; revision=18848
Diffstat (limited to 'modules')
-rwxr-xr-x | modules/engines/ms-windows/msw_style.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/modules/engines/ms-windows/msw_style.c b/modules/engines/ms-windows/msw_style.c index 2b0e822b18..9b61f590ab 100755 --- a/modules/engines/ms-windows/msw_style.c +++ b/modules/engines/ms-windows/msw_style.c @@ -3252,6 +3252,48 @@ draw_focus ( GtkStyle *style, } static void +draw_layout (GtkStyle *style, + GdkWindow *window, + GtkStateType state_type, + gboolean use_text, + GdkRectangle *area, + GtkWidget *widget, + const gchar *detail, + gint old_x, + gint old_y, + PangoLayout *layout) +{ + GtkNotebook *notebook = NULL; + gint x = old_x; + gint y = old_y; + + /* In the XP theme, labels don't appear correctly centered inside + * notebook tabs, so we give them a gentle nudge two pixels to the + * right. A little hackish, but what are 'ya gonna do? -- Cody + */ + if (xp_theme_is_active () && detail && !strcmp (detail, "label")) + { + if (widget->parent != NULL) + { + if (GTK_IS_NOTEBOOK (widget->parent)) + { + notebook = GTK_NOTEBOOK (widget->parent); + int side = gtk_notebook_get_tab_pos (notebook); + + if (side == GTK_POS_TOP || side == GTK_POS_BOTTOM) + { + x += 2; + } + } + } + } + + parent_class->draw_layout (style, window, state_type, + use_text, area, widget, + detail, x, y, layout); +} + +static void msw_style_init_from_rc (GtkStyle * style, GtkRcStyle * rc_style) { setup_system_font (style); @@ -3404,6 +3446,7 @@ msw_style_class_init (MswStyleClass * klass) style_class->draw_resize_grip = draw_resize_grip; style_class->draw_slider = draw_slider; style_class->draw_focus = draw_focus; + style_class->draw_layout = draw_layout; style_class->realize = msw_style_realize; style_class->unrealize = msw_style_unrealize; |