hotspotwidget.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Mike Polan                                      *
00003  *   kanadakid@gmail.com                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 // hotspotwidget.h: the HotspotWidget class
00021 
00022 #ifndef HOTSPOTWIDGET_H
00023 #define HOTSPOTWIDGET_H
00024 
00025 #include <gtkmm/drawingarea.h>
00026 #include <gtkmm/image.h>
00027 #include <vector>
00028 
00029 #include "case.h"
00030 
00035 class HotspotWidget: public Gtk::DrawingArea {
00036         public:
00038                 HotspotWidget();
00039                 
00044                 void update_coords(int x, int y);
00045                 
00050                 void update_dimensions(int w, int h);
00051                 
00055                 void set_image(const Glib::RefPtr<Gdk::Pixbuf> &pb) { m_Pixbuf=pb; }
00056                 
00060                 Case::Hotspot get_hotspot() const { return m_Hotspot; }
00061                 
00063                 sigc::signal<void, int, int> signal_point_changed() const { return m_SigPointChanged; }
00064                 
00066                 sigc::signal<void, int, int> signal_dimensions_changed() const { return m_SigDimensionsChanged; }
00067                 
00068         private:
00069                 // signals
00070                 sigc::signal<void, int, int> m_SigPointChanged;
00071                 sigc::signal<void, int, int> m_SigDimensionsChanged;
00072                 
00073                 // realize handler
00074                 virtual void on_realize();
00075                 
00076                 // expose event handler
00077                 virtual bool on_expose_event(GdkEventExpose *e);
00078                 
00079                 // button press handler
00080                 virtual bool on_button_press_event(GdkEventButton *e);
00081                 
00082                 // motion event handler
00083                 virtual bool on_motion_notify_event(GdkEventMotion *e);
00084                 
00085                 // pixbuf to draw
00086                 Glib::RefPtr<Gdk::Pixbuf> m_Pixbuf;
00087                 
00088                 // drawing gc
00089                 Glib::RefPtr<Gdk::GC> m_GC;
00090                 
00091                 // colors we use
00092                 Gdk::Color m_Red;
00093                 
00095                 bool m_MouseDown;
00096                 
00098                 Case::Hotspot m_Hotspot;
00099 };
00100 
00101 #endif

Generated on Fri Feb 22 22:34:17 2008 for Phoenix Wright Case Editor API by  doxygen 1.5.3