summaryrefslogtreecommitdiff
path: root/gtk/gtklistitem.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-12-04 03:27:30 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-12-04 03:27:30 +0000
commit7537825b34bee7094b6bf2e4f3f1e551114ed022 (patch)
treefb77377ab8aeb2e537f2177554e1d2ec9d390ee2 /gtk/gtklistitem.c
parentcac3ad31314da1c2b0a5c35f54f7328da5ed51a3 (diff)
downloadgtk+-7537825b34bee7094b6bf2e4f3f1e551114ed022.tar.gz
Patch from Bill Haneman (with many modifications) to make the focus color
Mon Dec 3 16:39:17 2001 Owen Taylor <otaylor@redhat.com> Patch from Bill Haneman (with many modifications) to make the focus color work on dark themes and to make the focus line width configurable. (#61079, #63074) * gtk/gtkwidget.c: Add style properties, ::focus-widget, ::focus-line-width, and ::focus-padding. * gtk/gtkstyle.[ch]: Make gtk_paint_focus() take a state argument as well so we can use fg[STATE] to draw instead of always drawing with black. Cange paint_focus() to respect GtkWidget::focus-width and GtkWidget::focus-line-pattern. Fix continuity problem where the default 1-1 stipple had a blob in one corner and a gap in the other. Change the interpretation of x/y/width/height to be the bounding box of the focus rect instead of the rectangle passed to gdk_draw_rectangle. * gtk/gtkcheckbutton.c gtk/gtklistitem.c gtk/gtknotebook.c gtk/gtkoptionmenu.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktextview.c gtk/gtktreeview.c: Handle ::focus-width and ::focus-line-padding. * gtk/gtkentry.c: Handle :;focus-width property; cleanup and remove duplicated code; fix drawing of focus rectangle when interior-focus = FALSE. (#63072, #63073) * gtk/gtkrange.c gtk/gtktext.c gtk/gtktreeitem.c gtk/gtktreeviewcolumn.c: Basic fixups to make compile; Range and TreeViewColumn will need more extensive fixing. * gtk/gtkcolorsel.c: Honor focus line attributes when drawing the focus on the color swatches. (#63071) * gtk/gtkhsv.c: Honor focus line attributes when drawing the focus for the ring and triangle. * docs/widget_geometry.txt: Start at documenting how various widgets are drawn. * gtk/gtkbutton.c (_gtk_button_paint): Export _gtk_button_paint() librarywide, so we don't have duplicate a bunch of code in gtktogglebutton.c. * gtk/gtktogglebutton.c: Use _gtk_button_paint().
Diffstat (limited to 'gtk/gtklistitem.c')
-rw-r--r--gtk/gtklistitem.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index 996fb618e6..952649f9fe 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -458,15 +458,22 @@ gtk_list_item_size_request (GtkWidget *widget,
{
GtkBin *bin;
GtkRequisition child_requisition;
+ gint focus_width;
+ gint focus_pad;
g_return_if_fail (GTK_IS_LIST_ITEM (widget));
g_return_if_fail (requisition != NULL);
bin = GTK_BIN (widget);
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus_width,
+ "focus-padding", &focus_pad,
+ NULL);
- requisition->width = (GTK_CONTAINER (widget)->border_width +
- widget->style->xthickness) * 2;
- requisition->height = GTK_CONTAINER (widget)->border_width * 2;
+ requisition->width = 2 * (GTK_CONTAINER (widget)->border_width +
+ widget->style->xthickness + focus_width + focus_pad - 1);
+ requisition->height = 2 * (GTK_CONTAINER (widget)->border_width +
+ focus_width + focus_pad - 1);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{
@@ -532,6 +539,7 @@ gtk_list_item_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkBin *bin;
+ gint focus_width;
g_return_val_if_fail (widget != NULL, FALSE);
@@ -558,17 +566,13 @@ gtk_list_item_expose (GtkWidget *widget,
if (GTK_WIDGET_HAS_FOCUS (widget))
{
if (GTK_IS_LIST (widget->parent) && GTK_LIST (widget->parent)->add_mode)
- gtk_paint_focus (widget->style, widget->window,
+ gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
NULL, widget, "add-mode",
- 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
+ 0, 0, widget->allocation.width, widget->allocation.height);
else
- gtk_paint_focus (widget->style, widget->window,
+ gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
NULL, widget, NULL,
- 0, 0,
- widget->allocation.width - 1,
- widget->allocation.height - 1);
+ 0, 0, widget->allocation.width, widget->allocation.height);
}
}