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

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

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

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

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

#define GLADE_HOOKUP_OBJECT(component,widget,name) \
  g_object_set_data_full (G_OBJECT (component), name, \
    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)

#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
  g_object_set_data (G_OBJECT (component), name, widget)

//GtkWidget*
GuiInterface*
create_window1 (void)
{
  GuiInterface *gui;
  GtkWidget *window1;
  GtkWidget *drawingarea1;
  GdkPixmap *pixmap1;
  int width = 40;
  int height = 30;

  gui = new GuiInterface;
  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gui->window = window1;
  gtk_widget_show(window1);
  gui->gc = gdk_gc_new(window1->window);
  gtk_window_set_title (GTK_WINDOW (window1), _("LRF Viewer"));

  drawingarea1 = gtk_drawing_area_new ();
  gtk_widget_show (drawingarea1);
  gtk_container_add (GTK_CONTAINER (window1), drawingarea1);
  gtk_widget_set_size_request (drawingarea1, width, height);

  /// gdk_pixmap
  gtk_widget_realize(drawingarea1);
  pixmap1 = gdk_pixmap_new(drawingarea1->window, width, height, 24);
  g_object_set_data (G_OBJECT (window1), "pixmap1", pixmap1);
  gdk_draw_rectangle(pixmap1, drawingarea1->style->white_gc, TRUE, 0, 0, width, height);


  g_signal_connect ((gpointer) window1, "destroy",
                    G_CALLBACK (on_window1_destroy),
                    NULL);
  g_signal_connect ((gpointer) drawingarea1, "key_press_event",
                    G_CALLBACK (on_drawingarea1_key_press_event),
                    NULL);
  g_signal_connect ((gpointer) drawingarea1, "button_press_event",
                    G_CALLBACK (on_drawingarea1_button_press_event),
                    NULL);
  g_signal_connect ((gpointer) drawingarea1, "button_release_event",
                    G_CALLBACK (on_drawingarea1_button_release_event),
                    NULL);
  g_signal_connect ((gpointer) drawingarea1, "motion_notify_event",
                    G_CALLBACK (on_drawingarea1_motion_notify_event),
                    NULL);
  g_signal_connect ((gpointer) drawingarea1, "expose_event",
                    G_CALLBACK (on_drawingarea1_expose_event),
                    NULL);
  g_signal_connect ((gpointer) drawingarea1, "configure_event",
                    G_CALLBACK (on_drawingarea1_configure_event),
                    NULL);

  /* Store pointers to all widgets, for use by lookup_widget(). */
  GLADE_HOOKUP_OBJECT_NO_REF (window1, window1, "window1");
  GLADE_HOOKUP_OBJECT (window1, drawingarea1, "drawingarea1");

  gtk_widget_add_events(drawingarea1, GDK_EXPOSURE_MASK
			| GDK_KEY_PRESS_MASK
			| GDK_KEY_RELEASE_MASK
			| GDK_BUTTON_PRESS_MASK
			| GDK_BUTTON_RELEASE_MASK
			| GDK_POINTER_MOTION_MASK);

  gtk_widget_show_all (window1);

  //return window1;
  return gui;
}

void destroy_window(GuiInterface *gui)
{
  gtk_widget_destroy(gui->window);
  delete gui;
}
