Code

229d153a8b709c05f31ed5947321f6c86d421f1a
[inkscape.git] / src / ui / widget / imagetoggler.h
1 #ifndef __UI_DIALOG_IMAGETOGGLER_H__
2 #define __UI_DIALOG_IMAGETOGGLER_H__
3 /*
4  * Authors:
5  *   Jon A. Cruz
6  *   Johan B. C. Engelen
7  *
8  * Copyright (C) 2006-2008 Authors
9  *
10  * Released under GNU GPL, read the file 'COPYING' for more information
11  */
13 #include <gtkmm/cellrendererpixbuf.h>
14 #include <gtkmm/widget.h>
16 namespace Inkscape {
17 namespace UI {
18 namespace Widget {
20 class ImageToggler : public Gtk::CellRendererPixbuf {
21 public:
22     ImageToggler( char const *on, char const *off);
23     virtual ~ImageToggler() {};
25     sigc::signal<void, const Glib::ustring&> signal_toggled() { return _signal_toggled;}
26     sigc::signal<void, GdkEvent const *> signal_pre_toggle()  { return _signal_pre_toggle; }
28     Glib::PropertyProxy<bool> property_active() { return _property_active.get_proxy(); }
29     Glib::PropertyProxy<bool> property_activatable() { return _property_activatable.get_proxy(); }
30     Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf_on();
31     Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf_off();
33 protected:
35     virtual void get_size_vfunc( Gtk::Widget &widget,
36                                  Gdk::Rectangle const *cell_area,
37                                  int *x_offset, int *y_offset, int *width, int *height ) const;
40     virtual void render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
41                                Gtk::Widget& widget,
42                                const Gdk::Rectangle& background_area,
43                                const Gdk::Rectangle& cell_area,
44                                const Gdk::Rectangle& expose_area,
45                                Gtk::CellRendererState flags );
47     virtual bool activate_vfunc(GdkEvent *event,
48                                 Gtk::Widget &widget,
49                                 const Glib::ustring &path,
50                                 const Gdk::Rectangle &background_area,
51                                 const Gdk::Rectangle &cell_area,
52                                 Gtk::CellRendererState flags);
55 private:
56     Glib::ustring _pixOnName;
57     Glib::ustring _pixOffName;
59     Glib::Property<bool> _property_active;
60     Glib::Property<bool> _property_activatable;
61     Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_on;
62     Glib::Property< Glib::RefPtr<Gdk::Pixbuf> > _property_pixbuf_off;
64     sigc::signal<void, const Glib::ustring&> _signal_toggled;
65     sigc::signal<void, GdkEvent const *> _signal_pre_toggle;
66 };
70 } // namespace Widget
71 } // namespace UI
72 } // namespace Inkscape
75 #endif /* __UI_DIALOG_IMAGETOGGLER_H__ */
77 /*
78   Local Variables:
79   mode:c++
80   c-file-style:"stroustrup"
81   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
82   indent-tabs-mode:nil
83   fill-column:99
84   End:
85 */
86 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :