00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifdef HAVE_CONFIG_H
00021 # include <config.h>
00022 #endif
00023
00024 #include "gamewin.h"
00025 #include "Gump.h"
00026 #include "Gump_widget.h"
00027
00028
00029
00030
00031
00032 int Gump_widget::on_widget
00033 (
00034 int mx, int my
00035 )
00036 {
00037 mx -= parent->get_x() + x;
00038 my -= parent->get_y() + y;
00039 Shape_frame *cshape = get_shape();
00040 return (cshape!=0)?cshape->has_point(mx, my):false;
00041 }
00042
00043
00044
00045
00046
00047 void Gump_widget::paint
00048 (
00049 )
00050 {
00051 int px = 0;
00052 int py = 0;
00053
00054 if (parent)
00055 {
00056 px = parent->get_x();
00057 py = parent->get_y();
00058 }
00059
00060 paint_shape(x+px, y+py);
00061 }
00062
00063
00064
00065
00066
00067 Rectangle Gump_widget::get_rect()
00068 {
00069 int px = x;
00070 int py = y;
00071
00072 if (parent)
00073 {
00074 px += parent->get_x();
00075 py += parent->get_y();
00076 }
00077
00078 Shape_frame *s = get_shape();
00079
00080 if (!s) return Rectangle(0,0,0,0);
00081
00082 return Rectangle(px - s->get_xleft(), py - s->get_yabove(),
00083 s->get_width(), s->get_height());
00084 }