1 /********************************************************************\ 2 * This program is free software; you can redistribute it and/or * 3 * modify it under the terms of the GNU General Public License as * 4 * published by the Free Software Foundation; either version 2 of * 5 * the License, or (at your option) any later version. * 6 * * 7 * This program is distributed in the hope that it will be useful, * 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 10 * GNU General Public License for more details. * 11 * * 12 * You should have received a copy of the GNU General Public License* 13 * along with this program; if not, contact: * 14 * * 15 * Free Software Foundation Voice: +1-617-542-5942 * 16 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 17 * Boston, MA 02110-1301, USA gnu@gnu.org * 18 * * 19 \********************************************************************/ 20 21 #ifndef GNUCASH_STYLE_H 22 #define GNUCASH_STYLE_H 23 24 #include "gnucash-sheet.h" 25 /** @ingroup Register 26 * @addtogroup Gnome 27 * @{ 28 */ 29 /** @file gnucash-style.h 30 * @brief Styling functions for RegisterGnome. 31 */ 32 typedef struct 33 { 34 gint pixel_height; 35 gint pixel_width; 36 37 gint origin_x; 38 gint origin_y; 39 40 gboolean can_span_over; 41 } CellDimensions; 42 43 typedef struct 44 { 45 gint nrows; 46 gint ncols; 47 48 /* totals, in pixels */ 49 gint height; 50 gint width; 51 52 /* per cell parameters */ 53 GTable *cell_dimensions; 54 55 gint refcount; 56 } BlockDimensions; 57 58 struct _SheetBlockStyle 59 { 60 CellBlock * cursor; 61 62 gint nrows; 63 gint ncols; 64 65 BlockDimensions *dimensions; 66 67 gint refcount; 68 }; 69 70 71 gboolean gnucash_style_init (void); 72 73 void gnucash_sheet_style_init(void); 74 75 gint gnucash_style_col_is_resizable (SheetBlockStyle *style, int col); 76 77 CellDimensions * gnucash_style_get_cell_dimensions (SheetBlockStyle *style, 78 int row, int col); 79 80 void gnucash_sheet_set_col_width (GnucashSheet *sheet, int col, int width); 81 82 gint gnucash_style_row_width(SheetBlockStyle *style, int row); 83 84 void gnucash_sheet_styles_set_dimensions (GnucashSheet *sheet, int width); 85 86 void gnucash_sheet_style_destroy (GnucashSheet *sheet, SheetBlockStyle *style); 87 88 void gnucash_sheet_clear_styles (GnucashSheet *sheet); 89 void gnucash_sheet_create_styles (GnucashSheet *sheet); 90 91 void gnucash_sheet_compile_styles (GnucashSheet *sheet); 92 93 void gnucash_sheet_styles_recompile (GnucashSheet *sheet); 94 95 SheetBlockStyle *gnucash_sheet_get_style (GnucashSheet *sheet, 96 VirtualCellLocation vcell_loc); 97 98 SheetBlockStyle * 99 gnucash_sheet_get_style_from_table (GnucashSheet *sheet, 100 VirtualCellLocation vcell_loc); 101 102 SheetBlockStyle * 103 gnucash_sheet_get_style_from_cursor (GnucashSheet *sheet, 104 const char *cursor_name); 105 106 void gnucash_sheet_style_get_cell_pixel_rel_coords (SheetBlockStyle *style, 107 gint cell_row, 108 gint cell_col, 109 gint *x, gint *y, 110 gint *w, gint *h); 111 112 void gnucash_sheet_style_ref (GnucashSheet *sheet, SheetBlockStyle *style); 113 void gnucash_sheet_style_unref (GnucashSheet *sheet, SheetBlockStyle *style); 114 115 void gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc, 116 PhysicalCellBorders *borders); 117 118 typedef GHashTable *GNCHeaderWidths; 119 120 GNCHeaderWidths gnc_header_widths_new (void); 121 void gnc_header_widths_destroy (GNCHeaderWidths widths); 122 void gnc_header_widths_set_width (GNCHeaderWidths widths, 123 const char *cell_name, 124 int width); 125 int gnc_header_widths_get_width (GNCHeaderWidths widths, 126 const char *cell_name); 127 128 void gnucash_sheet_get_header_widths (GnucashSheet *sheet, 129 GNCHeaderWidths widths); 130 void gnucash_sheet_set_header_widths (GnucashSheet *sheet, 131 GNCHeaderWidths widths); 132 /** @} */ 133 #endif 134