00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _GUMP_H_
00020 #define _GUMP_H_
00021
00022 #include "exceptions.h"
00023 #include "rect.h"
00024 #include "shapeid.h"
00025
00026 class Checkmark_button;
00027 class Container_game_object;
00028 class Game_object;
00029 class Game_window;
00030 class Gump_button;
00031 class Gump_manager;
00032
00033
00034
00035
00036 class Gump : public ShapeID, public Paintable
00037 {
00038 UNREPLICATABLE_CLASS(Gump);
00039
00040 protected:
00041 Gump() : ShapeID() { };
00042 Container_game_object *container;
00043 int x, y;
00044 unsigned char shapenum;
00045 Rectangle object_area;
00046
00047 Checkmark_button *check_button;
00048 void set_object_area(Rectangle area, int checkx = 8, int checky = 64);
00049 public:
00050 Gump(Container_game_object *cont, int initx, int inity, int shnum,
00051 ShapeFile shfile = SF_GUMPS_VGA);
00052
00053 Gump(Container_game_object *cont, int shnum, ShapeFile shfile = SF_GUMPS_VGA);
00054 virtual ~Gump();
00055 int get_x()
00056 { return x; }
00057 int get_y()
00058 { return y; }
00059 void set_pos(int newx, int newy)
00060 {
00061 x = newx;
00062 y = newy;
00063 }
00064 void set_pos();
00065 Container_game_object *get_container()
00066 { return container; }
00067 virtual Container_game_object *find_actor(int mx, int my)
00068 { return 0; }
00069 inline Container_game_object *get_cont_or_actor(int mx, int my)
00070 {
00071 Container_game_object *ret = find_actor(mx, my);
00072 if (ret) return ret;
00073 return get_container();
00074 }
00075
00076 Rectangle get_shape_rect(Game_object *obj);
00077
00078 void get_shape_location(Game_object *obj, int& ox, int& oy);
00079
00080 virtual Game_object *find_object(int mx, int my);
00081 virtual Rectangle get_dirty();
00082 virtual Game_object *get_owner();
00083
00084 virtual Gump_button *on_button(int mx, int my);
00085
00086 virtual int add(Game_object *obj, int mx = -1, int my = -1,
00087 int sx = -1, int sy = -1, bool dont_check = false,
00088 bool combine = false);
00089 virtual void remove(Game_object *obj);
00090
00091 virtual void paint();
00092
00093 virtual void close();
00094
00095 virtual void update_gump () { }
00096
00097 virtual bool is_draggable() const { return true; }
00098
00099 virtual bool is_persistent() const { return false; }
00100 virtual bool is_modal() const { return false; }
00101
00102 virtual bool no_handcursor() const { return false; }
00103
00104 virtual bool has_point(int x, int y);
00105 virtual Rectangle get_rect();
00106
00107 };
00108
00109
00110
00111
00112 class Container_gump : public Gump
00113 {
00114 UNREPLICATABLE_CLASS(Container_gump);
00115
00116 void initialize(int shnum);
00117
00118 public:
00119 Container_gump(Container_game_object *cont, int initx, int inity, int shnum,
00120 ShapeFile shfile = SF_GUMPS_VGA)
00121 : Gump(cont, initx, inity, shnum, shfile)
00122 {
00123 initialize(shnum);
00124 }
00125
00126 Container_gump(Container_game_object *cont, int shnum, ShapeFile shfile = SF_GUMPS_VGA)
00127 : Gump(cont, shnum, shfile)
00128 {
00129 initialize(shnum);
00130 }
00131
00132 };
00133
00134 #endif