#include <gtk/gtk.h>
#include <vector>

typedef struct {
     double x, y, theta;
}Point;

typedef struct{
     Point p1;
     Point p2;
}Line;

typedef struct {
  GtkWidget *window;
  GdkGC *gc;
}GuiInterface;

typedef struct{
  double total_points;
  double offset_fov; // offset of fov[rad]
  double fov; // field of view[rad]
  double resolution; // [rad]
  std::vector<double> range; // [m]
}LaserRangeData;

GdkColor make_color(gushort r, gushort g, gushort b);
void set_screen_offset(int x, int y);
void set_screen_resolution(double resolution);
void get_draw_size(GuiInterface *gui, int *width, int *height);
void draw_area_initialize(GuiInterface *gui);
void draw_point(GuiInterface *gui, Point *pose, int point_size, GdkColor color);
void draw_laser_range(GuiInterface *gui,
		      LaserRangeData *laser, Point *pose);
void show_draw_area(GuiInterface *gui);


void
initialize_for_gtk(void);

GThreadFunc
gtk_main_thread(gpointer data);

void
on_window1_destroy                     (GtkObject       *object,
                                        gpointer         user_data);

gboolean
on_drawingarea1_key_press_event        (GtkWidget       *widget,
                                        GdkEventKey     *event,
                                        gpointer         user_data);

gboolean
on_drawingarea1_button_press_event     (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data);

gboolean
on_drawingarea1_button_release_event   (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data);

gboolean
on_drawingarea1_motion_notify_event    (GtkWidget       *widget,
                                        GdkEventMotion  *event,
                                        gpointer         user_data);

gboolean
on_drawingarea1_expose_event           (GtkWidget       *widget,
                                        GdkEventExpose  *event,
                                        gpointer         user_data);

gboolean
on_drawingarea1_configure_event        (GtkWidget       *widget,
                                        GdkEventConfigure *event,
                                        gpointer         user_data);
