gtkdatabox_grid.c (gtkdatabox-0.9.3.1) | : | gtkdatabox_grid.c (gtkdatabox-1.0.0) | ||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
* as published by the Free Software Foundation; either version 2.1 | * as published by the Free Software Foundation; either version 2.1 | |||
* of the License, or (at your option) any later version. | * of the License, or (at your option) any later version. | |||
* | * | |||
* This program is distributed in the hope that it will be useful, | * This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | * GNU Lesser General Public License for more details. | |||
* | * | |||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | |||
* along with this program; if not, write to the Free Software | * along with this program; if not, write to the Free Software | |||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |||
*/ | */ | |||
#include <gtkdatabox_grid.h> | #include <gtkdatabox_grid.h> | |||
#include <math.h> | #include <math.h> | |||
G_DEFINE_TYPE(GtkDataboxGrid, gtk_databox_grid, | ||||
GTK_DATABOX_TYPE_GRAPH) | ||||
static void gtk_databox_grid_real_draw (GtkDataboxGraph * grid, | static void gtk_databox_grid_real_draw (GtkDataboxGraph * grid, | |||
GtkDatabox* box); | GtkDatabox* box); | |||
static GdkGC* gtk_databox_grid_real_create_gc (GtkDataboxGraph * graph, | static cairo_t* gtk_databox_grid_real_create_gc (GtkDataboxGraph * graph, | |||
GtkDatabox* box); | GtkDatabox* box); | |||
/* IDs of properties */ | /* IDs of properties */ | |||
enum | enum | |||
{ | { | |||
GRID_HLINES = 1, | GRID_HLINES = 1, | |||
GRID_VLINES, | GRID_VLINES, | |||
GRID_HLINE_VALS, | GRID_HLINE_VALS, | |||
GRID_VLINE_VALS, | GRID_VLINE_VALS, | |||
GRID_LINE_STYLE | GRID_LINE_STYLE | |||
skipping to change at line 59 | skipping to change at line 56 | |||
struct _GtkDataboxGridPrivate | struct _GtkDataboxGridPrivate | |||
{ | { | |||
gint hlines; | gint hlines; | |||
gint vlines; | gint vlines; | |||
gfloat *hline_vals; | gfloat *hline_vals; | |||
gfloat *vline_vals; | gfloat *vline_vals; | |||
GtkDataboxGridLineStyle line_style; | GtkDataboxGridLineStyle line_style; | |||
}; | }; | |||
G_DEFINE_TYPE_WITH_PRIVATE(GtkDataboxGrid, gtk_databox_grid, | ||||
GTK_DATABOX_TYPE_GRAPH) | ||||
static void | static void | |||
gtk_databox_grid_set_property (GObject * object, | gtk_databox_grid_set_property (GObject * object, | |||
guint property_id, | guint property_id, | |||
const GValue * value, GParamSpec * pspec) | const GValue * value, GParamSpec * pspec) | |||
{ | { | |||
GtkDataboxGrid *grid = GTK_DATABOX_GRID (object); | GtkDataboxGrid *grid = GTK_DATABOX_GRID (object); | |||
switch (property_id) | switch (property_id) | |||
{ | { | |||
case GRID_HLINES: | case GRID_HLINES: | |||
skipping to change at line 141 | skipping to change at line 141 | |||
g_value_set_int (value, gtk_databox_grid_get_line_style (grid)); | g_value_set_int (value, gtk_databox_grid_get_line_style (grid)); | |||
} | } | |||
break; | break; | |||
default: | default: | |||
/* We don't have any other property... */ | /* We don't have any other property... */ | |||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); | |||
break; | break; | |||
} | } | |||
} | } | |||
static GdkGC* | static cairo_t* | |||
gtk_databox_grid_real_create_gc (GtkDataboxGraph * graph, | gtk_databox_grid_real_create_gc (GtkDataboxGraph * graph, | |||
GtkDatabox* box) | GtkDatabox* box) | |||
{ | { | |||
GdkGC *gc; | cairo_t *cr; | |||
GdkGCValues values; | ||||
g_return_val_if_fail (GTK_DATABOX_IS_GRID (graph), NULL); | g_return_val_if_fail (GTK_DATABOX_IS_GRID (graph), NULL); | |||
gc = GTK_DATABOX_GRAPH_CLASS (gtk_databox_grid_parent_class)->create_gc (grap h, box); | cr = GTK_DATABOX_GRAPH_CLASS (gtk_databox_grid_parent_class)->create_gc (grap h, box); | |||
if (gc) | return cr; | |||
{ | } | |||
values.line_style = GDK_LINE_ON_OFF_DASH; | ||||
values.cap_style = GDK_CAP_BUTT; | ||||
values.join_style = GDK_JOIN_MITER; | ||||
gdk_gc_set_values (gc, &values, | ||||
GDK_GC_LINE_STYLE | | ||||
GDK_GC_CAP_STYLE | GDK_GC_JOIN_STYLE); | ||||
} | ||||
return gc; | static void | |||
grid_finalize (GObject * object) | ||||
{ | ||||
/* Chain up to the parent class */ | ||||
G_OBJECT_CLASS (gtk_databox_grid_parent_class)->finalize (object); | ||||
} | } | |||
static void | static void | |||
gtk_databox_grid_class_init (GtkDataboxGridClass *klass) | gtk_databox_grid_class_init (GtkDataboxGridClass *klass) | |||
{ | { | |||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | |||
GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (klass); | GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (klass); | |||
GParamSpec *grid_param_spec; | GParamSpec *grid_param_spec; | |||
gobject_class->set_property = gtk_databox_grid_set_property; | gobject_class->set_property = gtk_databox_grid_set_property; | |||
gobject_class->get_property = gtk_databox_grid_get_property; | gobject_class->get_property = gtk_databox_grid_get_property; | |||
gobject_class->finalize = grid_finalize; | ||||
grid_param_spec = g_param_spec_int ("grid-hlines", "grid-hlines", "Number of horizontal lines", G_MININT, G_MAXINT, 0, /* default value */ | grid_param_spec = g_param_spec_int ("grid-hlines", "grid-hlines", "Number of horizontal lines", G_MININT, G_MAXINT, 0, /* default value */ | |||
G_PARAM_READWRITE); | G_PARAM_READWRITE); | |||
g_object_class_install_property (gobject_class, | g_object_class_install_property (gobject_class, | |||
GRID_HLINES, grid_param_spec); | GRID_HLINES, grid_param_spec); | |||
grid_param_spec = g_param_spec_int ("grid-vlines", "grid-vlines", "Number of vertical lines", G_MININT, G_MAXINT, 0, /* default value */ | grid_param_spec = g_param_spec_int ("grid-vlines", "grid-vlines", "Number of vertical lines", G_MININT, G_MAXINT, 0, /* default value */ | |||
G_PARAM_READWRITE); | G_PARAM_READWRITE); | |||
skipping to change at line 207 | skipping to change at line 204 | |||
grid_param_spec = g_param_spec_int ("line-style", "line-style", "Line style o f grid lines", | grid_param_spec = g_param_spec_int ("line-style", "line-style", "Line style o f grid lines", | |||
GTK_DATABOX_GRID_DASHED_LINES, GTK_DATABOX _GRID_DOTTED_LINES, | GTK_DATABOX_GRID_DASHED_LINES, GTK_DATABOX _GRID_DOTTED_LINES, | |||
GTK_DATABOX_GRID_DASHED_LINES, | GTK_DATABOX_GRID_DASHED_LINES, | |||
G_PARAM_READWRITE); | G_PARAM_READWRITE); | |||
g_object_class_install_property (gobject_class, | g_object_class_install_property (gobject_class, | |||
GRID_LINE_STYLE, grid_param_spec); | GRID_LINE_STYLE, grid_param_spec); | |||
graph_class->draw = gtk_databox_grid_real_draw; | graph_class->draw = gtk_databox_grid_real_draw; | |||
graph_class->create_gc = gtk_databox_grid_real_create_gc; | graph_class->create_gc = gtk_databox_grid_real_create_gc; | |||
g_type_class_add_private (klass, sizeof (GtkDataboxGridPrivate)); | ||||
} | } | |||
static void | static void | |||
gtk_databox_grid_init (GtkDataboxGrid *grid __attribute__((unused))) | gtk_databox_grid_init (GtkDataboxGrid *grid) | |||
{ | { | |||
if (grid == NULL) g_warning ("grid_init with NULL"); | ||||
} | } | |||
/** | /** | |||
* gtk_databox_grid_new: | * gtk_databox_grid_new: | |||
* @hlines: number of horizontal lines in the grid | * @hlines: number of horizontal lines in the grid | |||
* @vlines: number of vertical lines in the grid | * @vlines: number of vertical lines in the grid | |||
* @color: color of the grid | * @color: color of the grid | |||
* @size: line width of the grid | * @size: line width of the grid | |||
* | * | |||
* Creates a new #GtkDataboxGrid object which can be added to a #GtkDatabox widg et as nice decoration for other graphs. | * Creates a new #GtkDataboxGrid object which can be added to a #GtkDatabox widg et as nice decoration for other graphs. | |||
* | * | |||
* Return value: A new #GtkDataboxGrid object | * Return value: A new #GtkDataboxGrid object | |||
**/ | **/ | |||
GtkDataboxGraph * | GtkDataboxGraph * | |||
gtk_databox_grid_new (gint hlines, gint vlines, GdkColor * color, guint size) | gtk_databox_grid_new (gint hlines, gint vlines, GdkRGBA * color, guint size) | |||
{ | { | |||
GtkDataboxGrid *grid; | GtkDataboxGrid *grid; | |||
grid = g_object_new (GTK_DATABOX_TYPE_GRID, | grid = g_object_new (GTK_DATABOX_TYPE_GRID, | |||
"color", color, | "color", color, | |||
"size", size, | "size", size, | |||
"grid-hlines", hlines, "grid-vlines", vlines, "grid-hline -vals",NULL, "grid-vline-vals", NULL, NULL); | "grid-hlines", hlines, "grid-vlines", vlines, "grid-hline -vals",NULL, "grid-vline-vals", NULL, NULL); | |||
return GTK_DATABOX_GRAPH (grid); | return GTK_DATABOX_GRAPH (grid); | |||
} | } | |||
skipping to change at line 253 | skipping to change at line 249 | |||
* @hline_vals: a pointer to an array of gfloat horizontal grid coordinate | * @hline_vals: a pointer to an array of gfloat horizontal grid coordinate | |||
* @vline_vals: a pointer to an array of gfloat vertical grid coordinate | * @vline_vals: a pointer to an array of gfloat vertical grid coordinate | |||
* @color: color of the grid | * @color: color of the grid | |||
* @size: line width of the grid | * @size: line width of the grid | |||
* | * | |||
* Creates a new #GtkDataboxGrid object which can be added to a #GtkDatabox widg et as nice decoration for other graphs. | * Creates a new #GtkDataboxGrid object which can be added to a #GtkDatabox widg et as nice decoration for other graphs. | |||
* | * | |||
* Return value: A new #GtkDataboxGrid object | * Return value: A new #GtkDataboxGrid object | |||
**/ | **/ | |||
GtkDataboxGraph *gtk_databox_grid_array_new (gint hlines, gint vlines, gfloat * local_hline_vals, gfloat * local_vline_vals, | GtkDataboxGraph *gtk_databox_grid_array_new (gint hlines, gint vlines, gfloat * local_hline_vals, gfloat * local_vline_vals, | |||
GdkColor * color, guint size) | GdkRGBA * color, guint size) | |||
{ | { | |||
GtkDataboxGrid *grid; | GtkDataboxGrid *grid; | |||
grid = g_object_new (GTK_DATABOX_TYPE_GRID, | grid = g_object_new (GTK_DATABOX_TYPE_GRID, | |||
"color", color, | "color", color, | |||
"size", size, | "size", size, | |||
"grid-hlines", hlines, "grid-vlines", vlines, "grid-hline -vals", local_hline_vals, "grid-vline-vals", local_vline_vals, NULL); | "grid-hlines", hlines, "grid-vlines", vlines, "grid-hline -vals", local_hline_vals, "grid-vline-vals", local_vline_vals, NULL); | |||
return GTK_DATABOX_GRAPH (grid); | return GTK_DATABOX_GRAPH (grid); | |||
} | } | |||
static void | static void | |||
gtk_databox_grid_real_draw (GtkDataboxGraph * graph, | gtk_databox_grid_real_draw (GtkDataboxGraph * graph, | |||
GtkDatabox* box) | GtkDatabox* box) | |||
{ | { | |||
GtkWidget *widget; | GtkWidget *widget; | |||
GtkDataboxGrid *grid = GTK_DATABOX_GRID (graph); | GtkDataboxGrid *grid = GTK_DATABOX_GRID (graph); | |||
GtkDataboxGridPrivate *priv = GTK_DATABOX_GRID_GET_PRIVATE(grid); | GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | |||
GdkPixmap *pixmap; | ||||
gint i = 0; | gint i = 0; | |||
gfloat x; | gfloat x; | |||
gfloat y; | gfloat y; | |||
gint16 width; | gint16 width; | |||
gint16 height; | gint16 height; | |||
gfloat offset_x; | gfloat offset_x; | |||
gfloat offset_y; | gfloat offset_y; | |||
gfloat factor_x; | gfloat factor_x; | |||
gfloat factor_y; | gfloat factor_y; | |||
gint16 pixel_x; | gint16 pixel_x; | |||
gint16 pixel_y; | gint16 pixel_y; | |||
gfloat left, right, top, bottom; | gfloat left, right, top, bottom; | |||
double pixel_right, pixel_left, pixel_top, pixel_bottom; | double pixel_right, pixel_left, pixel_top, pixel_bottom; | |||
double target_spacing, grid_spacing; | double target_spacing, grid_spacing; | |||
double grid_dot[] = {0.0, 0.0}; | double grid_dot[] = {0.0, 0.0}; | |||
cairo_t *cr; | cairo_t *cr; | |||
GdkColor *color; | ||||
uint lineSize; | ||||
GtkAllocation allocation; | GtkAllocation allocation; | |||
g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | |||
g_return_if_fail (GTK_IS_DATABOX (box)); | g_return_if_fail (GTK_IS_DATABOX (box)); | |||
widget = GTK_WIDGET(box); | widget = GTK_WIDGET(box); | |||
gtk_widget_get_allocation(widget, &allocation); | gtk_widget_get_allocation(widget, &allocation); | |||
pixmap = gtk_databox_get_backing_pixmap (box); | ||||
gtk_databox_get_total_limits (box, &left, &right, &top, &bottom); | gtk_databox_get_total_limits (box, &left, &right, &top, &bottom); | |||
cr = gdk_cairo_create (pixmap); | cr = gtk_databox_graph_create_gc (graph, box); | |||
g_object_get (grid, "color", &color, "size", &lineSize, NULL); | ||||
cairo_set_source_rgb (cr, color->red/65535.,color->green/65535.,color->blue/6 | ||||
5535.); | ||||
cairo_set_line_width (cr, (gfloat)lineSize); | ||||
width = allocation.width; | width = allocation.width; | |||
height = allocation.height; | height = allocation.height; | |||
offset_x = left; | offset_x = left; | |||
factor_x = | factor_x = | |||
(right - left) / (priv->vlines + 1); | (right - left) / (priv->vlines + 1); | |||
offset_y = top; | offset_y = top; | |||
factor_y = | factor_y = | |||
skipping to change at line 363 | skipping to change at line 352 | |||
case GTK_DATABOX_GRID_SOLID_LINES: | case GTK_DATABOX_GRID_SOLID_LINES: | |||
break; | break; | |||
} | } | |||
if (priv->hline_vals == NULL) | if (priv->hline_vals == NULL) | |||
for (i = 0; i < priv->hlines; i++) | for (i = 0; i < priv->hlines; i++) | |||
{ | { | |||
y = offset_y + (i + 1) * factor_y; | y = offset_y + (i + 1) * factor_y; | |||
pixel_y = gtk_databox_value_to_pixel_y (box, y); | pixel_y = gtk_databox_value_to_pixel_y (box, y); | |||
cairo_move_to (cr, 0.0, pixel_y + 0.5); | cairo_move_to (cr, 0.0, pixel_y + 0.5); | |||
cairo_line_to (cr, width, pixel_y + 0.5); | cairo_line_to (cr, width, pixel_y + 0.5); | |||
} | } | |||
else | else | |||
for (i = 0; i < priv->hlines; i++) | for (i = 0; i < priv->hlines; i++) | |||
{ | { | |||
y = priv->hline_vals[i]; | y = priv->hline_vals[i]; | |||
pixel_y = gtk_databox_value_to_pixel_y (box, y); | pixel_y = gtk_databox_value_to_pixel_y (box, y); | |||
cairo_move_to (cr, 0.0, pixel_y + 0.5); | cairo_move_to (cr, 0.0, pixel_y + 0.5); | |||
cairo_line_to (cr, width, pixel_y + 0.5); | cairo_line_to (cr, width, pixel_y + 0.5); | |||
} | } | |||
cairo_stroke(cr); | cairo_stroke(cr); | |||
pixel_bottom = gtk_databox_value_to_pixel_y (box, bottom); | pixel_bottom = gtk_databox_value_to_pixel_y (box, bottom); | |||
pixel_top = gtk_databox_value_to_pixel_y (box, top); | pixel_top = gtk_databox_value_to_pixel_y (box, top); | |||
grid_spacing = (pixel_bottom - pixel_top)/(priv->hlines+1); | grid_spacing = (pixel_bottom - pixel_top)/(priv->hlines+1); | |||
switch (priv->line_style) { | switch (priv->line_style) { | |||
case GTK_DATABOX_GRID_DASHED_LINES: | case GTK_DATABOX_GRID_DASHED_LINES: | |||
skipping to change at line 402 | skipping to change at line 391 | |||
case GTK_DATABOX_GRID_SOLID_LINES: | case GTK_DATABOX_GRID_SOLID_LINES: | |||
break; | break; | |||
} | } | |||
if (priv->vline_vals == NULL) | if (priv->vline_vals == NULL) | |||
for (i = 0; i < priv->vlines; i++) | for (i = 0; i < priv->vlines; i++) | |||
{ | { | |||
x = offset_x + (i + 1) * factor_x; | x = offset_x + (i + 1) * factor_x; | |||
pixel_x = gtk_databox_value_to_pixel_x (box, x); | pixel_x = gtk_databox_value_to_pixel_x (box, x); | |||
cairo_move_to (cr, pixel_x + 0.5, 0.0); | cairo_move_to (cr, pixel_x + 0.5, 0.0); | |||
cairo_line_to (cr, pixel_x + 0.5, height); | cairo_line_to (cr, pixel_x + 0.5, height); | |||
} | } | |||
else | else | |||
for (i = 0; i < priv->vlines; i++) | for (i = 0; i < priv->vlines; i++) | |||
{ | { | |||
x = priv->vline_vals[i]; | x = priv->vline_vals[i]; | |||
pixel_x = gtk_databox_value_to_pixel_x (box, x); | pixel_x = gtk_databox_value_to_pixel_x (box, x); | |||
cairo_move_to (cr, pixel_x + 0.5, 0.0); | cairo_move_to (cr, pixel_x + 0.5, 0); | |||
cairo_line_to (cr, pixel_x + 0.5, height); | cairo_line_to (cr, pixel_x + 0.5, height); | |||
} | } | |||
cairo_stroke(cr); | cairo_stroke(cr); | |||
cairo_destroy(cr); | cairo_destroy(cr); | |||
return; | return; | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_set_hlines: | * gtk_databox_grid_set_hlines: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* @hlines: number of vertical lines in the grid | * @hlines: number of vertical lines in the grid | |||
* | * | |||
* Sets the number of horizontal lines in the @grid. | * Sets the number of horizontal lines in the @grid. | |||
**/ | **/ | |||
void | void | |||
gtk_databox_grid_set_hlines (GtkDataboxGrid * grid, gint hlines) | gtk_databox_grid_set_hlines (GtkDataboxGrid * grid, gint hlines) | |||
{ | { | |||
g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
GTK_DATABOX_GRID_GET_PRIVATE(grid)->hlines = MAX (1, hlines); | priv->hlines = MAX (1, hlines); | |||
g_object_notify (G_OBJECT (grid), "grid-hlines"); | g_object_notify (G_OBJECT (grid), "grid-hlines"); | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_get_hlines: | * gtk_databox_grid_get_hlines: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* | * | |||
* Gets the number of horizontal lines in the @grid. | * Gets the number of horizontal lines in the @grid. | |||
* | * | |||
* Return value: Number of horizontal lines in the @grid. | * Return value: Number of horizontal lines in the @grid. | |||
**/ | **/ | |||
gint | gint | |||
gtk_databox_grid_get_hlines (GtkDataboxGrid * grid) | gtk_databox_grid_get_hlines (GtkDataboxGrid * grid) | |||
{ | { | |||
g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), -1); | g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), -1); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
return GTK_DATABOX_GRID_GET_PRIVATE(grid)->hlines; | return priv->hlines; | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_set_vlines: | * gtk_databox_grid_set_vlines: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* @vlines: number of vertical lines in the grid | * @vlines: number of vertical lines in the grid | |||
* | * | |||
* Sets the number of vertical lines in the @grid. | * Sets the number of vertical lines in the @grid. | |||
**/ | **/ | |||
void | void | |||
gtk_databox_grid_set_vlines (GtkDataboxGrid * grid, gint vlines) | gtk_databox_grid_set_vlines (GtkDataboxGrid * grid, gint vlines) | |||
{ | { | |||
g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
GTK_DATABOX_GRID_GET_PRIVATE(grid)->vlines = MAX (1, vlines); | priv->vlines = MAX (1, vlines); | |||
g_object_notify (G_OBJECT (grid), "grid-vlines"); | g_object_notify (G_OBJECT (grid), "grid-vlines"); | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_get_vlines: | * gtk_databox_grid_get_vlines: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* | * | |||
* Gets the number of vertical lines in the @grid. | * Gets the number of vertical lines in the @grid. | |||
* | * | |||
* Return value: Number of vertical lines in the @grid. | * Return value: Number of vertical lines in the @grid. | |||
**/ | **/ | |||
gint | gint | |||
gtk_databox_grid_get_vlines (GtkDataboxGrid * grid) | gtk_databox_grid_get_vlines (GtkDataboxGrid * grid) | |||
{ | { | |||
g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), -1); | g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), -1); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
return GTK_DATABOX_GRID_GET_PRIVATE(grid)->vlines; | return priv->vlines; | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_set_hline_vals: | * gtk_databox_grid_set_hline_vals: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* @hline_vals: sets the pointer to the hline values for the grid | * @hline_vals: sets the pointer to the hline values for the grid | |||
* | * | |||
* Sets the pointer to the horizontal lines in the @grid. | * Sets the pointer to the horizontal lines in the @grid. | |||
**/ | **/ | |||
void | void | |||
gtk_databox_grid_set_hline_vals (GtkDataboxGrid * grid, gfloat *hline_vals) | gtk_databox_grid_set_hline_vals (GtkDataboxGrid * grid, gfloat *hline_vals) | |||
{ | { | |||
g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
GTK_DATABOX_GRID_GET_PRIVATE(grid)->hline_vals = hline_vals; | priv->hline_vals = hline_vals; | |||
g_object_notify (G_OBJECT (grid), "grid-hline-vals"); | g_object_notify (G_OBJECT (grid), "grid-hline-vals"); | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_get_hline_vals: | * gtk_databox_grid_get_hline_vals: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* | * | |||
* Gets the pointer to the horizontal line values for the @grid. | * Gets the pointer to the horizontal line values for the @grid. | |||
* | * | |||
* Return value: Pointer to the horizontal line values for the @grid. | * Return value: Pointer to the horizontal line values for the @grid. (or NULL i f error) | |||
**/ | **/ | |||
gfloat* | gfloat* | |||
gtk_databox_grid_get_hline_vals (GtkDataboxGrid * grid) | gtk_databox_grid_get_hline_vals (GtkDataboxGrid * grid) | |||
{ | { | |||
g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), NULL); | g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), NULL); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
return GTK_DATABOX_GRID_GET_PRIVATE(grid)->hline_vals; | return priv->hline_vals; | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_set_vline_vals: | * gtk_databox_grid_set_vline_vals: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* @vline_vals: sets the pointer to the vline values for the grid | * @vline_vals: sets the pointer to the vline values for the grid | |||
* | * | |||
* Sets the pointer to the vertical lines in the @grid. | * Sets the pointer to the vertical lines in the @grid. | |||
**/ | **/ | |||
void | void | |||
gtk_databox_grid_set_vline_vals (GtkDataboxGrid * grid, gfloat *vline_vals) | gtk_databox_grid_set_vline_vals (GtkDataboxGrid * grid, gfloat *vline_vals) | |||
{ | { | |||
g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
GTK_DATABOX_GRID_GET_PRIVATE(grid)->vline_vals = vline_vals; | priv->vline_vals = vline_vals; | |||
g_object_notify (G_OBJECT (grid), "grid-vline-vals"); | g_object_notify (G_OBJECT (grid), "grid-vline-vals"); | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_get_vline_vals: | * gtk_databox_grid_get_vline_vals: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* | * | |||
* Gets the pointer to the vertical line values for the @grid. | * Gets the pointer to the vertical line values for the @grid. | |||
* | * | |||
* Return value: Pointer to the vertical line values for the @grid. | * Return value: Pointer to the vertical line values for the @grid. (or NULL if error) | |||
**/ | **/ | |||
gfloat* | gfloat* | |||
gtk_databox_grid_get_vline_vals (GtkDataboxGrid * grid) | gtk_databox_grid_get_vline_vals (GtkDataboxGrid * grid) | |||
{ | { | |||
g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), NULL); | g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), NULL); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
return GTK_DATABOX_GRID_GET_PRIVATE(grid)->vline_vals; | return priv->vline_vals; | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_set_line_style: | * gtk_databox_grid_set_line_style: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* @line_style: GTK_DATABOX_GRID_DASHED_LINES, | * @line_style: GTK_DATABOX_GRID_DASHED_LINES, | |||
* GTK_DATABOX_GRID_SOLID_LINES, or GTK_DATABOX_GRID_DOTTED_LINES | * GTK_DATABOX_GRID_SOLID_LINES, or GTK_DATABOX_GRID_DOTTED_LINES | |||
* | * | |||
* Sets the line style to draw the lines in the @grid. | * Sets the line style to draw the lines in the @grid. | |||
**/ | **/ | |||
void | void | |||
gtk_databox_grid_set_line_style (GtkDataboxGrid *grid, gint line_style) | gtk_databox_grid_set_line_style (GtkDataboxGrid *grid, gint line_style) | |||
{ | { | |||
g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | g_return_if_fail (GTK_DATABOX_IS_GRID (grid)); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
GTK_DATABOX_GRID_GET_PRIVATE(grid)->line_style = line_style; | priv->line_style = line_style; | |||
g_object_notify (G_OBJECT (grid), "line-style"); | g_object_notify (G_OBJECT (grid), "line-style"); | |||
} | } | |||
/** | /** | |||
* gtk_databox_grid_get_line_style: | * gtk_databox_grid_get_line_style: | |||
* @grid: a #GtkDataboxGrid graph object | * @grid: a #GtkDataboxGrid graph object | |||
* | * | |||
* Retrieve the line style to draw the lines in the @grid. | * Retrieve the line style to draw the lines in the @grid. | |||
* | * | |||
* Return value: GTK_DATABOX_GRID_DASHED_LINES, | * Return value: GTK_DATABOX_GRID_DASHED_LINES, | |||
* GTK_DATABOX_GRID_SOLID_LINES, or GTK_DATABOX_GRID_DOTTED_LINES | * GTK_DATABOX_GRID_SOLID_LINES, or GTK_DATABOX_GRID_DOTTED_LINES | |||
**/ | **/ | |||
gint | gint | |||
gtk_databox_grid_get_line_style (GtkDataboxGrid *grid) | gtk_databox_grid_get_line_style (GtkDataboxGrid *grid) | |||
{ | { | |||
g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), -1); | g_return_val_if_fail (GTK_DATABOX_IS_GRID (grid), -1); | |||
GtkDataboxGridPrivate *priv = gtk_databox_grid_get_instance_private(grid); | ||||
return GTK_DATABOX_GRID_GET_PRIVATE(grid)->line_style; | return priv->line_style; | |||
} | } | |||
End of changes. 36 change blocks. | ||||
65 lines changed or deleted | 52 lines changed or added |