gtdc/gui_graph_tab.c

61 lines
2.7 KiB
C

/***************************************************************************
* Copyright (C) 04/2008 by Olaf Rempel *
* razzor@kopf-tisch.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <gtk/gtk.h>
#include <gtkdatabox.h>
gint gui_graphtab_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);
}