Пример #1
0
static void
gtk_databox_marker_real_create_gc (GtkDataboxGraph *graph,
                                  GtkDataboxCanvas *canvas)
{
   GtkDataboxMarker *marker = GTK_DATABOX_MARKER (graph);
   GdkGCValues values;

   g_return_if_fail (GTK_DATABOX_IS_MARKER (graph));

   GTK_DATABOX_GRAPH_CLASS (parent_class)->create_gc (graph, canvas);

   if (marker->priv->type == GTK_DATABOX_MARKER_DASHED_LINE)
   {
      values.line_style = GDK_LINE_ON_OFF_DASH;
      values.cap_style = GDK_CAP_BUTT;
      values.join_style = GDK_JOIN_MITER;
      gdk_gc_set_values (graph->gc, &values, 
                         GDK_GC_LINE_STYLE | 
                         GDK_GC_CAP_STYLE |
                         GDK_GC_JOIN_STYLE);
   }
   
   if (marker->priv->label_gc)
      g_object_unref (marker->priv->label_gc);

   marker->priv->label_gc = gdk_gc_new (canvas->pixmap);
   gdk_gc_copy(marker->priv->label_gc, graph->gc);
   gdk_gc_set_line_attributes (marker->priv->label_gc, 1, 
                               GDK_LINE_SOLID,
                               GDK_CAP_ROUND,
                               GDK_JOIN_ROUND);
}
Пример #2
0
static void
gtk_databox_marker_class_init (gpointer g_class,
                              gpointer g_class_data)
{
   GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
   GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (g_class);
   GtkDataboxMarkerClass *klass = GTK_DATABOX_MARKER_CLASS (g_class);
   GParamSpec *marker_param_spec;

   parent_class = g_type_class_peek_parent (klass);
   
   gobject_class->set_property = gtk_databox_marker_set_property;
   gobject_class->get_property = gtk_databox_marker_get_property;
   gobject_class->finalize     = marker_finalize;

   marker_param_spec = g_param_spec_int ("marker-type",
                                         "Type of marker",
                                         "Type of marker for this graph, e.g. triangles or lines",
                                         G_MININT,
                                         G_MAXINT,
                                         0, /*  default value */
                                         G_PARAM_CONSTRUCT |
                                         G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
                                    PROP_TYPE,
                                    marker_param_spec);
   graph_class->draw = gtk_databox_marker_real_draw;
   graph_class->create_gc = gtk_databox_marker_real_create_gc;
}
static void
gtk_databox_bars_class_init (GtkDataboxBarsClass *klass)
{
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (klass);

   gobject_class->finalize = bars_finalize;

   graph_class->draw = gtk_databox_bars_real_draw;

	g_type_class_add_private(klass, sizeof(GtkDataboxBarsPrivate));
}
Пример #4
0
static void
gtk_databox_bars_class_init (gpointer g_class,
                              gpointer g_class_data)
{
   GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
   GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (g_class);
   GtkDataboxBarsClass *klass = GTK_DATABOX_BARS_CLASS (g_class);

   parent_class = g_type_class_peek_parent (klass);
   
   gobject_class->finalize     = bars_finalize;

   graph_class->draw = gtk_databox_bars_real_draw;
}
static cairo_t*
gtk_databox_grid_real_create_gc (GtkDataboxGraph * graph,
				 GtkDatabox* box)
{
   cairo_t *cr;
   static const double grid_dash = 5.0;

   g_return_val_if_fail (GTK_DATABOX_IS_GRID (graph), NULL);

   cr = GTK_DATABOX_GRAPH_CLASS (gtk_databox_grid_parent_class)->create_gc (graph, box);

   if (cr)
      cairo_set_dash(cr, &grid_dash, 1, 0.0);

   return cr;
}
Пример #6
0
static void
gtk_databox_xyc_graph_class_init (gpointer g_class
				  /*, gpointer g_class_data */ )
{
   GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
   GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (g_class);
   GtkDataboxXYCGraphClass *klass = GTK_DATABOX_XYC_GRAPH_CLASS (g_class);
   GParamSpec *xyc_graph_param_spec;

   parent_class = g_type_class_peek_parent (klass);

   gobject_class->set_property = gtk_databox_xyc_graph_set_property;
   gobject_class->get_property = gtk_databox_xyc_graph_get_property;
   gobject_class->finalize = xyc_graph_finalize;

   xyc_graph_param_spec = g_param_spec_pointer ("X-Values",
						"X coordinates",
						"X values of data",
						G_PARAM_CONSTRUCT_ONLY |
						G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    PROP_X, xyc_graph_param_spec);

   xyc_graph_param_spec = g_param_spec_pointer ("Y-Values",
						"Y coordinates",
						"Y values of data",
						G_PARAM_CONSTRUCT_ONLY |
						G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    PROP_Y, xyc_graph_param_spec);

   xyc_graph_param_spec = g_param_spec_int ("length", "length of X and Y", "number of data points", G_MININT, G_MAXINT, 0,	/* default value */
					    G_PARAM_CONSTRUCT_ONLY |
					    G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    PROP_LEN, xyc_graph_param_spec);

   graph_class->calculate_extrema =
      gtk_databox_xyc_graph_real_calculate_extrema;
}
static void
gtk_databox_grid_class_init (GtkDataboxGridClass *klass)
{
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   GtkDataboxGraphClass *graph_class = GTK_DATABOX_GRAPH_CLASS (klass);
   GParamSpec *grid_param_spec;

   gobject_class->set_property = gtk_databox_grid_set_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 */
				       G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    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 */
				       G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    GRID_VLINES, grid_param_spec);

   grid_param_spec = g_param_spec_pointer ("grid-hline-vals", "Grid Hline Vals", "The locations of each of the horizontal lines", G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    GRID_HLINE_VALS, grid_param_spec);

   grid_param_spec = g_param_spec_pointer ("grid-vline-vals", "Grid Vline Vals", "The locations of each of the vertical lines", G_PARAM_READWRITE);

   g_object_class_install_property (gobject_class,
				    GRID_VLINE_VALS, grid_param_spec);

   graph_class->draw = gtk_databox_grid_real_draw;
   graph_class->create_gc = gtk_databox_grid_real_create_gc;

   g_type_class_add_private (klass, sizeof (GtkDataboxGridPrivate));
}