mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
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
This commit is contained in:
parent
0142bd3f02
commit
a1045cf317
@ -1,3 +1,10 @@
|
||||
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)
|
||||
|
||||
2007-09-18 Emmanuele Bassi <ebassi@gnome.org>
|
||||
|
||||
* gtk/gtksearchenginetracker.c: Search libtrackerclient.so.0
|
||||
|
@ -3251,6 +3251,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)
|
||||
{
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user