gtdc/graph_tab.c
2008-03-16 00:39:37 +01:00

43 lines
1.3 KiB
C

#include <gtk/gtk.h>
#include <gtkdatabox.h>
gint graph_tab_init(GtkNotebook *notebook)
{
GtkWidget *table = gtk_table_new(3, 3, FALSE);
GtkWidget *box = gtk_databox_new();
gtk_table_attach(GTK_TABLE(table), box, 1, 2, 1, 2,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
GtkWidget *scrollbar = gtk_hscrollbar_new(gtk_databox_get_hadjustment(GTK_DATABOX(box)));
gtk_table_attach(GTK_TABLE(table), scrollbar, 1, 2, 2, 3,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
GTK_FILL, 0, 0);
scrollbar = gtk_vscrollbar_new(gtk_databox_get_vadjustment(GTK_DATABOX(box)));
gtk_table_attach(GTK_TABLE(table), scrollbar, 2, 3, 1, 2,
GTK_FILL,
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
GtkWidget *ruler = gtk_hruler_new();
gtk_table_attach(GTK_TABLE(table), ruler, 1, 2, 0, 1,
GTK_FILL | GTK_EXPAND | GTK_SHRINK,
GTK_FILL, 0, 0);
gtk_databox_set_hruler(GTK_DATABOX(box), GTK_RULER(ruler));
ruler = gtk_vruler_new();
gtk_table_attach (GTK_TABLE (table), ruler, 0, 1, 1, 2,
GTK_FILL,
GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0);
gtk_databox_set_vruler(GTK_DATABOX(box), GTK_RULER(ruler));
/*
* TODO:
* komplette datenhaltung.. (wie skalieren?)
* legende der graphen
*/
GtkWidget *label = gtk_label_new(" Graph ");
return gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
}