{
GPtrArray *columns; /* GdaExGridColumn */
+ gchar *title;
+
GtkTreeModel *model;
+ GtkWidget *view;
};
G_DEFINE_TYPE (GdaExGrid, gdaex_grid, G_TYPE_OBJECT)
GdaExGridPrivate *priv = GDAEX_GRID_GET_PRIVATE (gdaex_grid);
priv->columns = g_ptr_array_new ();
+ priv->title = NULL;
+ priv->view = NULL;
}
GdaExGrid
return gdaex_grid;
}
+void
+gdaex_grid_set_title (GdaExGrid *grid, const gchar *title)
+{
+ GdaExGridPrivate *priv;
+
+ g_return_if_fail (GDAEX_IS_GRID (grid));
+
+ priv = GDAEX_GRID_GET_PRIVATE (grid);
+
+ if (priv->title != NULL)
+ {
+ g_free (priv->title);
+ }
+
+ if (title != NULL)
+ {
+ priv->title = g_strdup (title);
+ }
+ else
+ {
+ priv->title = NULL;
+ }
+}
+
+const gchar
+*gdaex_grid_get_title (GdaExGrid *grid)
+{
+ GdaExGridPrivate *priv;
+
+ g_return_val_if_fail (GDAEX_IS_GRID (grid), NULL);
+
+ priv = GDAEX_GRID_GET_PRIVATE (grid);
+
+ if (priv->title != NULL)
+ {
+ return g_strdup (priv->title);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
void
gdaex_grid_add_column (GdaExGrid *grid, GdaExGridColumn *column)
{
}
}
+ priv->view = view;
+
#ifdef REPTOOL_FOUND
g_signal_connect (view,
- "key-release-event", G_CALLBACK (gdaex_grid_on_key_release_event), (gpointer)view);
+ "key-release-event", G_CALLBACK (gdaex_grid_on_key_release_event), (gpointer)grid);
#endif
return GTK_TREE_VIEW (view);
GdkEventKey *event,
gpointer user_data)
{
+ GdaExGridPrivate *priv;
+
RptReport *rptr;
RptPrint *rptp;
+ gchar *_title;
+
switch (event->keyval)
{
case GDK_F12:
{
if (event->state & GDK_CONTROL_MASK)
{
- rptr = rpt_report_new_from_gtktreeview (GTK_TREE_VIEW (user_data), NULL);
+ priv = GDAEX_GRID_GET_PRIVATE (user_data);
+
+ if (priv->title != NULL)
+ {
+ _title = g_strdup_printf ("\"%s\"", priv->title);
+ }
+ else
+ {
+ _title = NULL;
+ }
+ rptr = rpt_report_new_from_gtktreeview (GTK_TREE_VIEW (priv->view), _title);
if (rptr != NULL)
{
if (rptp != NULL)
{
rpt_print_set_output_type (rptp, RPT_OUTPUT_GTK);
- rpt_print_print (rptp, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (user_data))));
+ rpt_print_print (rptp, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->view))));
}
}
+ if (_title != NULL)
+ {
+ g_free (_title);
+ }
return TRUE;
}
break;
GdaExGrid *gdaex_grid_new (void);
+void gdaex_grid_set_title (GdaExGrid *grid, const gchar *title);
+const gchar *gdaex_grid_get_title (GdaExGrid *grid);
+
void gdaex_grid_add_column (GdaExGrid *grid, GdaExGridColumn *column);
void gdaex_grid_add_columns (GdaExGrid *grid, GSList *columns);
gtk_container_add (GTK_CONTAINER (w), scrolledw);
grid = gdaex_grid_new ();
+ gdaex_grid_set_title (grid, "The grid title");
gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, FALSE, FALSE, FALSE, -1);
gdaex_grid_add_column (grid, gcol);