libhpdftbl 1.5.0
Table construction library for Haru PDF library
|
Functions for theme handling. More...
Macros | |
#define | HPDFTBL_DEFAULT_TITLE_STYLE (hpdf_text_style_t){HPDF_FF_HELVETICA_BOLD,11,(HPDF_RGBColor){0,0,0},(HPDF_RGBColor){0.9f,0.9f,0.9f}, LEFT} |
Default style for table title. | |
#define | HPDFTBL_DEFAULT_HEADER_STYLE (hpdf_text_style_t){HPDF_FF_HELVETICA_BOLD,10,(HPDF_RGBColor){0,0,0},(HPDF_RGBColor){0.9f,0.9f,0.97f}, CENTER} |
Default style for table header row. More... | |
#define | HPDFTBL_DEFAULT_LABEL_STYLE (hpdf_text_style_t){HPDF_FF_TIMES_ITALIC,9,(HPDF_RGBColor){0.4f,0.4f,0.4f},(HPDF_RGBColor){1,1,1}, LEFT} |
Default style for table header row. More... | |
#define | HPDFTBL_DEFAULT_CONTENT_STYLE (hpdf_text_style_t){HPDF_FF_COURIER,10,(HPDF_RGBColor){0.2f,0.2f,0.2f},(HPDF_RGBColor){1,1,1}, LEFT} |
Default style for table header row. More... | |
#define | HPDFTBL_DEFAULT_INNER_VGRID_STYLE (hpdftbl_grid_style_t){0.7, (HPDF_RGBColor){0.5f,0.5f,0.5f},0} |
Default style for table vertical inner grid. More... | |
#define | HPDFTBL_DEFAULT_INNER_HGRID_STYLE (hpdftbl_grid_style_t){0.7, (HPDF_RGBColor){0.5f,0.5f,0.5f},0} |
Default style for table horizontal inner grid. More... | |
#define | HPDFTBL_DEFAULT_OUTER_GRID_STYLE (hpdftbl_grid_style_t){1.0f, (HPDF_RGBColor){0.2f,0.2f,0.2f},0} |
Default style for table outer grid (border) More... | |
#define | HPDFTBL_DEFAULT_ZEBRA_COLOR1 HPDF_COLOR_WHITE |
Default style for alternating row backgrounds color 1. | |
#define | HPDFTBL_DEFAULT_ZEBRA_COLOR2 HPDF_COLOR_XLIGHT_GRAY |
Default style for alternating row backgrounds color 2. | |
Functions | |
int | hpdftbl_apply_theme (hpdftbl_t t, hpdftbl_theme_t *theme) |
Apply a specified theme to a table. More... | |
int | hpdftbl_get_theme (hpdftbl_t tbl, hpdftbl_theme_t *theme) |
Extract theme from settings of a specific table. More... | |
hpdftbl_theme_t * | hpdftbl_get_default_theme (void) |
Return the default theme. More... | |
int | hpdftbl_destroy_theme (hpdftbl_theme_t *theme) |
Destroy existing theme structure and free memory. More... | |
Functions for theme handling.
Copyright (C) 2022 Johan Persson
Released under the MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define HPDFTBL_DEFAULT_CONTENT_STYLE (hpdf_text_style_t){HPDF_FF_COURIER,10,(HPDF_RGBColor){0.2f,0.2f,0.2f},(HPDF_RGBColor){1,1,1}, LEFT} |
Default style for table header row.
#define HPDFTBL_DEFAULT_HEADER_STYLE (hpdf_text_style_t){HPDF_FF_HELVETICA_BOLD,10,(HPDF_RGBColor){0,0,0},(HPDF_RGBColor){0.9f,0.9f,0.97f}, CENTER} |
Default style for table header row.
#define HPDFTBL_DEFAULT_INNER_HGRID_STYLE (hpdftbl_grid_style_t){0.7, (HPDF_RGBColor){0.5f,0.5f,0.5f},0} |
Default style for table horizontal inner grid.
#define HPDFTBL_DEFAULT_INNER_VGRID_STYLE (hpdftbl_grid_style_t){0.7, (HPDF_RGBColor){0.5f,0.5f,0.5f},0} |
Default style for table vertical inner grid.
#define HPDFTBL_DEFAULT_LABEL_STYLE (hpdf_text_style_t){HPDF_FF_TIMES_ITALIC,9,(HPDF_RGBColor){0.4f,0.4f,0.4f},(HPDF_RGBColor){1,1,1}, LEFT} |
Default style for table header row.
#define HPDFTBL_DEFAULT_OUTER_GRID_STYLE (hpdftbl_grid_style_t){1.0f, (HPDF_RGBColor){0.2f,0.2f,0.2f},0} |
Default style for table outer grid (border)
int hpdftbl_apply_theme | ( | hpdftbl_t | t, |
hpdftbl_theme_t * | theme | ||
) |
Apply a specified theme to a table.
Note however that a limitation (by design) of themes is that settings in individual cells are not recorded in a theme since a theme can be applied to any table despite the structure. This mean only settings that are generic to a table is stored in a theme. Not individal cells.
The default table theme can be retrieved with hpdftbl_get_default_theme()
t | Table handle |
theme | Theme reference |
Referenced by hpdftbl_create_title(), and hpdftbl_stroke_from_data().
int hpdftbl_destroy_theme | ( | hpdftbl_theme_t * | theme | ) |
Destroy existing theme structure and free memory.
Free all memory allocated by a theme
theme | The theme to free |
Referenced by hpdftbl_create_title(), and hpdftbl_theme_loads().
hpdftbl_theme_t * hpdftbl_get_default_theme | ( | void | ) |
Return the default theme.
Create and return a theme corresponding to the default table theme. It is the calling functions responsibility to call hpdftbl_destroy_theme() to free the allocated memory. The default theme is a good starting point to just make minor modifications without having to define all elements.
Referenced by hpdftbl_create_title().
int hpdftbl_get_theme | ( | hpdftbl_t | tbl, |
hpdftbl_theme_t * | theme | ||
) |
Extract theme from settings of a specific table.
This is useful if a table has been specified with some specific look & feel and another table should be given the same l&f.
Note however that a limitation (by design) of themes is that settings in individual cells are not recorded in a theme since a theme can be applied to any table despite the structure. This mean only settings that are generic to a table is stored in a theme. Not individal cells.
tbl | Table handle for table to have its settings extracted |
theme | Theme to be read out to. |