00001
00007 #ifndef INCL_SHAPEDRAW
00008 #define INCL_SHAPEDRAW 1
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <gtk/gtk.h>
00029 #include <gdk/gdktypes.h>
00030
00031 class Vga_file;
00032 class Shape_frame;
00033 class Image_buffer8;
00034
00035 typedef void (*Drop_callback)(int filenum,
00036 int shapenum, int framenum, void *udata);
00037
00038
00039
00040
00041 class Shape_draw
00042 {
00043 protected:
00044 Vga_file *ifile;
00045 GtkWidget *draw;
00046 GdkGC *drawgc;
00047 Image_buffer8 *iwin;
00048 GdkRgbCmap *palette;
00049 Drop_callback drop_callback;
00050 void *drop_user_data;
00051 bool dragging;
00052 public:
00053 Shape_draw(Vga_file *i, unsigned char *palbuf, GtkWidget *drw);
00054 virtual ~Shape_draw();
00055
00056 void show(GdkDrawable *drawable, int x, int y, int w, int h);
00057 void show(int x, int y, int w, int h)
00058 { show(draw->window, x, y, w, h); }
00059 void show()
00060 { show(0, 0, draw->allocation.width, draw->allocation.height);}
00061 guint32 get_color(int i)
00062 { return palette->colors[i]; }
00063 void draw_shape(Shape_frame *shape, int x, int y);
00064 void draw_shape(int shapenum, int framenum, int x, int y);
00065 void draw_shape_outline(int shapenum, int framenum,
00066 int x, int y, unsigned char color);
00067 void draw_shape_centered(int shapenum, int framenum);
00068 virtual void render();
00069 void set_background_color(guint32 c);
00070
00071 void configure();
00072
00073 static void drag_data_received(GtkWidget *widget,
00074 GdkDragContext *context, gint x, gint y,
00075 GtkSelectionData *selection_data, guint info, guint time,
00076 gpointer udata);
00077 void enable_drop(Drop_callback callback, void *udata);
00078 void set_drag_icon(GdkDragContext *context, Shape_frame *shape);
00079
00080 void start_drag(char *target, int id, GdkEvent *event);
00081 void mouse_up()
00082 { dragging = false; }
00083 };
00084
00085 #endif