diff options
author | Havoc Pennington <hp@redhat.com> | 2001-06-04 23:15:51 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-06-04 23:15:51 +0000 |
commit | 1b3c9214371d89a4872574d700b86cb71d6eee56 (patch) | |
tree | cc6c602393a292313c61da2b246b5a6b4de2ff4d /gtk/gtkstyle.c | |
parent | 9cc992b6e732fef6edf2153821354a6b1b6a5af6 (diff) | |
download | gtk+-1b3c9214371d89a4872574d700b86cb71d6eee56.tar.gz |
Handle case where we need to parse the xsetting as if it were an RC file
2001-05-10 Havoc Pennington <hp@redhat.com>
* gtk/gtksettings.c (gtk_settings_get_property): Handle case where
we need to parse the xsetting as if it were an RC file string.
* gtk/gtkcolorsel.c (gtk_color_selection_class_init): load initial
value of palette from settings, not from static variable
* gdk/x11/gdkevents-x11.c: add color palette, toolbar mode to
xsettings translation table
* gtk/gtktoolbar.c (gtk_toolbar_new): Remove arguments, because
hardcoding the toolbar style conflicts with new customizable
toolbar style philosophy
(gtk_toolbar_class_init): add settings for default toolbar style;
these are used unless the app specifically forces a toolbar style
* gtk/gtksettings.c (settings_install_property_parser): only
return at the start if we warn and parser == NULL
* gtk/gtkcolorsel.c (gtk_color_selection_finalize): disconnect the
palette changed handler so we don't notify dead color selections
* gtk/gtkstyle.c (gtk_default_draw_shadow): handle
xthickness/ythickness of 0 or 1 properly
(gtk_default_draw_resize_grip): clear the background behind the
resize grips, and align to bottom right if we square the
area to be drawn.
* gtk/gtkstatusbar.c (gtk_statusbar_init): set horizontal usize on
statusbar label to 1, so it doesn't make toplevels resize oddly
(gtk_statusbar_size_request): add grip size to request
(gtk_statusbar_size_allocate): hack so the hbox still works with
the grip size in the request
* gtk/gtktoolbar.c (gtk_toolbar_show_all): override to fix
bug where showing all on a toplevel makes the toolbar
button text appear despite the toolbar mode
* gtk/gtkmenubar.c: add internal padding style property
* gtk/gtktoolbar.c: Add internal padding style property; add
shadow type style property
* gtk/gtkmenubar.c (gtk_menu_bar_paint): paint box with widget
state; and put Container::border_width outside the frame
* gtk/gtktextview.c: don't draw focus rectangle if we're in
interior focus mode, we just use blinking cursor
Diffstat (limited to 'gtk/gtkstyle.c')
-rw-r--r-- | gtk/gtkstyle.c | 273 |
1 files changed, 187 insertions, 86 deletions
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 6aaf330549..e0c526ecd9 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -2116,103 +2116,188 @@ gtk_default_draw_shadow (GtkStyle *style, break; case GTK_SHADOW_IN: - gdk_draw_line (window, gc1, - x, y + height - 1, x + width - 1, y + height - 1); - gdk_draw_line (window, gc1, - x + width - 1, y, x + width - 1, y + height - 1); - - gdk_draw_line (window, style->bg_gc[state_type], - x + 1, y + height - 2, x + width - 2, y + height - 2); - gdk_draw_line (window, style->bg_gc[state_type], - x + width - 2, y + 1, x + width - 2, y + height - 2); - - gdk_draw_line (window, style->black_gc, - x + 1, y + 1, x + width - 2, y + 1); - gdk_draw_line (window, style->black_gc, - x + 1, y + 1, x + 1, y + height - 2); - - gdk_draw_line (window, gc2, - x, y, x + width - 1, y); - gdk_draw_line (window, gc2, - x, y, x, y + height - 1); + /* Light around right and bottom edge */ + + if (style->ythickness > 0) + gdk_draw_line (window, gc1, + x, y + height - 1, x + width - 1, y + height - 1); + if (style->xthickness > 0) + gdk_draw_line (window, gc1, + x + width - 1, y, x + width - 1, y + height - 1); + + if (style->ythickness > 1) + gdk_draw_line (window, style->bg_gc[state_type], + x + 1, y + height - 2, x + width - 2, y + height - 2); + if (style->xthickness > 1) + gdk_draw_line (window, style->bg_gc[state_type], + x + width - 2, y + 1, x + width - 2, y + height - 2); + + /* Dark around left and top */ + + if (style->ythickness > 1) + gdk_draw_line (window, style->black_gc, + x + 1, y + 1, x + width - 2, y + 1); + if (style->xthickness > 1) + gdk_draw_line (window, style->black_gc, + x + 1, y + 1, x + 1, y + height - 2); + + if (style->ythickness > 0) + gdk_draw_line (window, gc2, + x, y, x + width - 1, y); + if (style->xthickness > 0) + gdk_draw_line (window, gc2, + x, y, x, y + height - 1); break; case GTK_SHADOW_OUT: - gdk_draw_line (window, gc1, - x + 1, y + height - 2, x + width - 2, y + height - 2); - gdk_draw_line (window, gc1, - x + width - 2, y + 1, x + width - 2, y + height - 2); - - gdk_draw_line (window, gc2, - x, y, x + width - 1, y); - gdk_draw_line (window, gc2, - x, y, x, y + height - 1); - - gdk_draw_line (window, style->bg_gc[state_type], - x + 1, y + 1, x + width - 2, y + 1); - gdk_draw_line (window, style->bg_gc[state_type], - x + 1, y + 1, x + 1, y + height - 2); + /* Dark around right and bottom edge */ + + if (style->ythickness > 0) + { + if (style->ythickness > 1) + { + gdk_draw_line (window, gc1, + x + 1, y + height - 2, x + width - 2, y + height - 2); + gdk_draw_line (window, style->black_gc, + x, y + height - 1, x + width - 1, y + height - 1); + } + else + { + gdk_draw_line (window, gc1, + x + 1, y + height - 1, x + width - 1, y + height - 1); + } + } + + if (style->xthickness > 0) + { + if (style->xthickness > 1) + { + gdk_draw_line (window, gc1, + x + width - 2, y + 1, x + width - 2, y + height - 2); + + gdk_draw_line (window, style->black_gc, + x + width - 1, y, x + width - 1, y + height - 1); + } + else + { + gdk_draw_line (window, gc1, + x + width - 1, y + 1, x + width - 1, y + height - 1); + } + } - gdk_draw_line (window, style->black_gc, - x, y + height - 1, x + width - 1, y + height - 1); - gdk_draw_line (window, style->black_gc, - x + width - 1, y, x + width - 1, y + height - 1); + /* Light around top and left */ + + if (style->ythickness > 0) + gdk_draw_line (window, gc2, + x, y, x + width - 1, y); + if (style->xthickness > 0) + gdk_draw_line (window, gc2, + x, y, x, y + height - 1); + + if (style->ythickness > 1) + gdk_draw_line (window, style->bg_gc[state_type], + x + 1, y + 1, x + width - 2, y + 1); + if (style->xthickness > 1) + gdk_draw_line (window, style->bg_gc[state_type], + x + 1, y + 1, x + 1, y + height - 2); break; case GTK_SHADOW_ETCHED_IN: case GTK_SHADOW_ETCHED_OUT: - thickness_light = 1; - thickness_dark = 1; + if (style->xthickness > 0) + { + if (style->xthickness > 1) + { + thickness_light = 1; + thickness_dark = 1; - for (i = 0; i < thickness_dark; i++) + for (i = 0; i < thickness_dark; i++) + { + gdk_draw_line (window, gc1, + x + width - i - 1, + y + i, + x + width - i - 1, + y + height - i - 1); + gdk_draw_line (window, gc2, + x + i, + y + i, + x + i, + y + height - i - 2); + } + + for (i = 0; i < thickness_light; i++) + { + gdk_draw_line (window, gc1, + x + thickness_dark + i, + y + thickness_dark + i, + x + thickness_dark + i, + y + height - thickness_dark - i - 1); + gdk_draw_line (window, gc2, + x + width - thickness_light - i - 1, + y + thickness_dark + i, + x + width - thickness_light - i - 1, + y + height - thickness_light - 1); + } + } + else + { + gdk_draw_line (window, + style->dark_gc[state_type], + x, y, x, y + height); + gdk_draw_line (window, + style->dark_gc[state_type], + x + width, y, x + width, y + height); + } + } + + if (style->ythickness > 0) { - gdk_draw_line (window, gc1, - x + i, - y + height - i - 1, - x + width - i - 1, - y + height - i - 1); - gdk_draw_line (window, gc1, - x + width - i - 1, - y + i, - x + width - i - 1, - y + height - i - 1); + if (style->ythickness > 1) + { + thickness_light = 1; + thickness_dark = 1; + + for (i = 0; i < thickness_dark; i++) + { + gdk_draw_line (window, gc1, + x + i, + y + height - i - 1, + x + width - i - 1, + y + height - i - 1); - gdk_draw_line (window, gc2, - x + i, - y + i, - x + width - i - 2, - y + i); - gdk_draw_line (window, gc2, - x + i, - y + i, - x + i, - y + height - i - 2); - } + gdk_draw_line (window, gc2, + x + i, + y + i, + x + width - i - 2, + y + i); + } - for (i = 0; i < thickness_light; i++) - { - gdk_draw_line (window, gc1, - x + thickness_dark + i, - y + thickness_dark + i, - x + width - thickness_dark - i - 1, - y + thickness_dark + i); - gdk_draw_line (window, gc1, - x + thickness_dark + i, - y + thickness_dark + i, - x + thickness_dark + i, - y + height - thickness_dark - i - 1); + for (i = 0; i < thickness_light; i++) + { + gdk_draw_line (window, gc1, + x + thickness_dark + i, + y + thickness_dark + i, + x + width - thickness_dark - i - 1, + y + thickness_dark + i); - gdk_draw_line (window, gc2, - x + thickness_dark + i, - y + height - thickness_light - i - 1, - x + width - thickness_light - 1, - y + height - thickness_light - i - 1); - gdk_draw_line (window, gc2, - x + width - thickness_light - i - 1, - y + thickness_dark + i, - x + width - thickness_light - i - 1, - y + height - thickness_light - 1); + gdk_draw_line (window, gc2, + x + thickness_dark + i, + y + height - thickness_light - i - 1, + x + width - thickness_light - 1, + y + height - thickness_light - i - 1); + } + } + else + { + gdk_draw_line (window, + style->dark_gc[state_type], + x, y, x + width, y); + gdk_draw_line (window, + style->dark_gc[state_type], + x, y + height, x + width, y + height); + } } + break; } if (area) @@ -4157,11 +4242,26 @@ gtk_default_draw_resize_grip (GtkStyle *style, { gdk_gc_set_clip_rectangle (style->light_gc[state_type], area); gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area); + gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area); } - /* make it square */ - if (width != height) - width = height = MIN (width, height); + /* make it square, aligning to bottom right */ + if (width < height) + { + y += (height - width); + height = width; + } + else if (height < width) + { + x += (width - height); + width = height; + } + + /* Clear background */ + gdk_draw_rectangle (window, + style->bg_gc[state_type], + TRUE, + x, y, width, height); switch (edge) { @@ -4209,6 +4309,7 @@ gtk_default_draw_resize_grip (GtkStyle *style, { gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL); gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL); + gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL); } } |