use -r argument with JACK if realtime is not requested in engine dialog (also applied...
[ArdourMidi.git] / libs / gtkmm2ext / cell_renderer_pixbuf_multi.cc
blobfeb445a108eb6b152b1411ee08f7a276c3c83297
1 /*
2 Copyright (C) 2009 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 $Id: cell_renderer_toggle_pixbuf.cc $
21 #include <iostream>
22 #include <gtkmm.h>
24 #include <gtkmm2ext/cell_renderer_pixbuf_multi.h>
26 using namespace std;
27 using namespace Gtk;
28 using namespace Gdk;
29 using namespace Glib;
30 using namespace Gtkmm2ext;
33 CellRendererPixbufMulti::CellRendererPixbufMulti() :
34 Glib::ObjectBase( typeid(CellRendererPixbufMulti) ),
35 Gtk::CellRenderer(),
36 property_state_(*this, "active", 0)
38 property_mode() = Gtk::CELL_RENDERER_MODE_ACTIVATABLE;
39 property_xpad() = 2;
40 property_ypad() = 2;
41 property_sensitive() = false;
44 Glib::PropertyProxy<uint32_t>
45 CellRendererPixbufMulti::property_state()
47 return property_state_.get_proxy();
50 // Overridden methods of the parent CellRenderer
51 Glib::PropertyProxy_Base
52 CellRendererPixbufMulti::_property_renderable()
54 return property_state();
57 bool
58 CellRendererPixbufMulti::activate_vfunc(GdkEvent*, Gtk::Widget&, const Glib::ustring& path, const Gdk::Rectangle&, const Gdk::Rectangle&, Gtk::CellRendererState)
60 signal_changed_(path);
61 return true;
64 void
65 CellRendererPixbufMulti::render_vfunc (const Glib::RefPtr<Gdk::Drawable>& window, Gtk::Widget& /*widget*/, const Gdk::Rectangle& /*background_area*/, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& /*expose_area*/, Gtk::CellRendererState /*flags*/)
67 int offset_width = 0;
68 int offset_height = 0;
69 Glib::RefPtr<Pixbuf> pb = _pixbufs[property_state()];
71 offset_width = cell_area.get_x() + (int)(cell_area.get_width() - pb->get_width())/2;
72 offset_height = cell_area.get_y() + (int)(cell_area.get_height() - pb->get_height())/2;
74 window->draw_pixbuf (RefPtr<GC>(), pb, 0, 0, offset_width, offset_height, -1, -1, Gdk::RGB_DITHER_NORMAL, 0, 0);
77 void
78 CellRendererPixbufMulti::get_size_vfunc (Gtk::Widget& /*widget*/, const Gdk::Rectangle* /*cell_area*/, int* /*x_offset*/, int* /*y_offset*/, int* /*width*/, int* /*height*/) const
82 void
83 CellRendererPixbufMulti::set_pixbuf(uint32_t which, Glib::RefPtr<Gdk::Pixbuf> pixbuf){
84 _pixbufs[which] = pixbuf;
87 CellRendererPixbufMulti::SignalChanged&
88 CellRendererPixbufMulti::signal_changed()
90 return signal_changed_;