/*
 * DO NOT EDIT THIS FILE - it is generated by Glade.
 */

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>

#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"

GtkWidget*
create_window (void)
{
  GtkWidget *window;
  GtkWidget *vbox1;
  extern GtkWidget *draw_main;
  GtkWidget *hbox1;
  GtkWidget *button_change;
  GtkWidget *button_run;
  GtkWidget *button_clear;
  GtkWidget *button_save;
  GtkWidget *button_load;
  extern GtkWidget *entry_option;

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data (GTK_OBJECT (window), "window", window);
  gtk_window_set_title (GTK_WINDOW (window), "SVM Toy");

  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (window), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (window), vbox1);

  draw_main = gtk_drawing_area_new ();
  gtk_widget_ref (draw_main);
  gtk_object_set_data_full (GTK_OBJECT (window), "draw_main", draw_main,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (draw_main);
  gtk_box_pack_start (GTK_BOX (vbox1), draw_main, TRUE, TRUE, 0);
  gtk_widget_set_usize (draw_main, 500, 500);
  gtk_widget_set_events (draw_main, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (window), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);

  button_change = gtk_button_new_with_label ("Change");
  gtk_widget_ref (button_change);
  gtk_object_set_data_full (GTK_OBJECT (window), "button_change", button_change,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_change);
  gtk_box_pack_start (GTK_BOX (hbox1), button_change, FALSE, FALSE, 0);

  button_run = gtk_button_new_with_label ("Run");
  gtk_widget_ref (button_run);
  gtk_object_set_data_full (GTK_OBJECT (window), "button_run", button_run,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_run);
  gtk_box_pack_start (GTK_BOX (hbox1), button_run, FALSE, FALSE, 0);

  button_clear = gtk_button_new_with_label ("Clear");
  gtk_widget_ref (button_clear);
  gtk_object_set_data_full (GTK_OBJECT (window), "button_clear", button_clear,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_clear);
  gtk_box_pack_start (GTK_BOX (hbox1), button_clear, FALSE, FALSE, 0);

  button_save = gtk_button_new_with_label ("Save");
  gtk_widget_ref (button_save);
  gtk_object_set_data_full (GTK_OBJECT (window), "button_save", button_save,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_save);
  gtk_box_pack_start (GTK_BOX (hbox1), button_save, FALSE, FALSE, 0);

  button_load = gtk_button_new_with_label ("Load");
  gtk_widget_ref (button_load);
  gtk_object_set_data_full (GTK_OBJECT (window), "button_load", button_load,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button_load);
  gtk_box_pack_start (GTK_BOX (hbox1), button_load, FALSE, FALSE, 0);

  entry_option = gtk_entry_new ();
  gtk_widget_ref (entry_option);
  gtk_object_set_data_full (GTK_OBJECT (window), "entry_option", entry_option,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (entry_option);
  gtk_box_pack_start (GTK_BOX (hbox1), entry_option, TRUE, TRUE, 0);

  gtk_signal_connect (GTK_OBJECT (window), "destroy",
                      GTK_SIGNAL_FUNC (on_window1_destroy),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (draw_main), "button_press_event",
                      GTK_SIGNAL_FUNC (on_draw_main_button_press_event),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (draw_main), "expose_event",
                      GTK_SIGNAL_FUNC (on_draw_main_expose_event),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button_change), "clicked",
                      GTK_SIGNAL_FUNC (on_button_change_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button_run), "clicked",
                      GTK_SIGNAL_FUNC (on_button_run_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button_clear), "clicked",
                      GTK_SIGNAL_FUNC (on_button_clear_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button_save), "clicked",
                      GTK_SIGNAL_FUNC (on_button_save_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button_load), "clicked",
                      GTK_SIGNAL_FUNC (on_button_load_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (entry_option), "activate",
                      GTK_SIGNAL_FUNC (on_button_run_clicked),
                      NULL);

  return window;
}

GtkWidget*
create_fileselection (void)
{
  GtkWidget *fileselection;
  GtkWidget *filesel_ok;
  GtkWidget *filesel_cancel;

  fileselection = gtk_file_selection_new ("Select File");
  gtk_object_set_data (GTK_OBJECT (fileselection), "fileselection", fileselection);
  gtk_container_set_border_width (GTK_CONTAINER (fileselection), 10);
  gtk_window_set_modal (GTK_WINDOW (fileselection), TRUE);

  filesel_ok = GTK_FILE_SELECTION (fileselection)->ok_button;
  gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_ok", filesel_ok);
  gtk_widget_show (filesel_ok);
  GTK_WIDGET_SET_FLAGS (filesel_ok, GTK_CAN_DEFAULT);

  filesel_cancel = GTK_FILE_SELECTION (fileselection)->cancel_button;
  gtk_object_set_data (GTK_OBJECT (fileselection), "filesel_cancel", filesel_cancel);
  gtk_widget_show (filesel_cancel);
  GTK_WIDGET_SET_FLAGS (filesel_cancel, GTK_CAN_DEFAULT);

  gtk_signal_connect (GTK_OBJECT (fileselection), "destroy",
                      GTK_SIGNAL_FUNC (on_fileselection_destroy),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (filesel_ok), "clicked",
                      GTK_SIGNAL_FUNC (on_filesel_ok_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (filesel_cancel), "clicked",
                      GTK_SIGNAL_FUNC (on_filesel_cancel_clicked),
                      NULL);

  return fileselection;
}

