From f70c74f37110d1bcb23227c720965a058cabf61c Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Sat, 2 Dec 2000 17:35:22 +0000 Subject: Federico gets into pixel-perfect neurosis. Xmag is my best friend. 2000-12-01 Federico Mena Quintero Federico gets into pixel-perfect neurosis. Xmag is my best friend. * e-table-item.c (eti_draw): Set the focus_gc stipple origin to match the upper-left corner of the focus rectangle. This way focusing will look consistent even among rows/columns with odd pixel sizes. Also, make the focus rectangle span the whole cell; there was one blank pixel column to the left of the rectangle. * e-table-header-utils.c: New file with utilities for drawing header buttons. This is so that ETableHeaderItem and ETableFieldChooserItem can share the same code. (e_table_header_compute_height): New function to compute the height of a column button. (make_composite_pixmap): New function to composite a pixbuf against a solid background and make a pixmap out of the result. This does some ultra-fancy fading-out of the original pixbuf if the destination area is smaller than the source. (compute_elision_length): New function to compute the elision length in O(n log n) instead of O(n^2), for n = strlen (str). (e_table_header_draw_button): New function to draw a header button. (e_table_draw_elided_string): New function to draw a string elided to a maximum width. * e-table-defines.h (HEADER_PADDING): Made the default padding be 1; now a header button's height is content_height + 2 * (HEADER_PADDING + style->ythickness). This is the correct way to measure button heights. * e-table-field-chooser-item.c (etfci_find_button): Use e_table_header_compute_height(). (etfci_reflow): Likewise. (etfci_draw): Use e_table_header_draw_button(). (etfci_start_drag): Likewise. (etfci_draw): Likewise. (etfci_start_drag): Likewise. (etfci_button_height): Removed function. (draw_button): Removed function. * e-table-header-item.c (draw_button): Removed function. (e_table_header_item_get_height): Use e_table_header_compute_height(). (ethi_draw): e_table_header_draw_button(). (ethi_start_drag): Likewise. (make_shaped_window_from_xpm): Fixed misspelling in function name. (draw_button): Removed function. * Makefile.am: Added e-table-header-utils.[ch]. svn path=/trunk/; revision=6766 --- widgets/table/e-table-header-utils.h | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 widgets/table/e-table-header-utils.h (limited to 'widgets/table/e-table-header-utils.h') diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h new file mode 100644 index 0000000000..bbfb1ee17b --- /dev/null +++ b/widgets/table/e-table-header-utils.h @@ -0,0 +1,43 @@ +/* ETable widget - utilities for drawing table header buttons + * + * Copyright (C) 2000 Helix Code, Inc. + * + * Authors: Chris Lahey + * Miguel de Icaza + * Federico Mena-Quintero + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef E_TABLE_HEADER_UTILS_H +#define E_TABLE_HEADER_UTILS_H + +#include + +int e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font); + +void e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol, + GtkStyle *style, GdkFont *font, GtkStateType state, + GtkWidget *widget, GdkGC *gc, + int x, int y, int width, int height, + int button_width, int button_height, + ETableColArrow arrow); + +void e_table_draw_elided_string (GdkDrawable *drawable, GdkFont *font, GdkGC *gc, + int x, int y, const char *str, int max_width, gboolean center); + + + +#endif -- cgit v1.2.3