Canola  0.8.D001
canola/retro_button.h
Go to the documentation of this file.
00001 //
00002 // canola - canon canola 1614p emulator
00003 // Copyright (C) 2011 Peter Miller
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, version 3, as
00007 // published by the Free Software Foundation.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License along
00015 // with this program. If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef CANOLA_RETRO_BUTTON_H
00019 #define CANOLA_RETRO_BUTTON_H
00020 
00021 #include <lib/config.h>
00022 #include <gtkmm.h>
00023 
00028 class retro_button:
00029     public Gtk::EventBox
00030 {
00031 public:
00035     virtual ~retro_button();
00036 
00050     retro_button(const char *caption, const char *color,
00051         const Gdk::RGBA &text_fg, bool toggle = false);
00052 
00057     sigc::signal<void> signal_clicked(void) { return signal_clicked_sender; }
00058 
00063     sigc::signal<void> signal_released(void) { return signal_released_sender; }
00064 
00065 private:
00070     Glib::RefPtr<Gdk::Pixbuf> normal_image;
00071 
00076     Glib::RefPtr<Gdk::Pixbuf> active_image;
00077 
00082     Glib::RefPtr<Gdk::Pixbuf> disabled_image;
00083 
00089     Gtk::Image appearance;
00090 
00095     Gtk::Label text;
00096 
00102     Gtk::Alignment text_aligner;
00103 
00110     Gtk::Fixed layout;
00111 
00116     sigc::signal<void> signal_clicked_sender;
00117 
00122     sigc::signal<void> signal_released_sender;
00123 
00128     bool inside;
00129 
00134     bool pressed;
00135 
00140     bool toggle;
00141 
00147     bool pressed_callback(const _GdkEventButton *event);
00148 
00154     bool released_callback(const _GdkEventButton *event);
00155 
00161     bool enter_callback(const _GdkEventCrossing *event);
00162 
00168     bool leave_callback(const _GdkEventCrossing *event);
00169 
00174     void up(void);
00175 
00181     void down(void);
00182 
00187     bool active;
00188 
00192     retro_button();
00193 
00200     retro_button(const retro_button &rhs);
00201 
00208     retro_button &operator=(const retro_button &rhs);
00209 };
00210 
00211 #endif // CANOLA_RETRO_BUTTON_H