+ if (_pixbuf) {
+
+ double x,y;
+ x = (_width - _pixbuf->get_width())/2.0;
+ y = (_height - _pixbuf->get_height())/2.0;
+
+ cairo_rectangle (cr, x, y, _pixbuf->get_width(), _pixbuf->get_height());
+ gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y);
+ cairo_fill (cr);
+ }
+
/* text, if any */
int text_margin;
/* text, if any */
int text_margin;
/* a partially transparent gray layer to indicate insensitivity */
if ((visual_state() & Gtkmm2ext::Insensitive)) {
/* a partially transparent gray layer to indicate insensitivity */
if ((visual_state() & Gtkmm2ext::Insensitive)) {
- cairo_rectangle (cr, 0, 0, _width, _height);
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius);
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.5);
cairo_fill (cr);
}
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.5);
cairo_fill (cr);
}
+void
+ArdourButton::set_image (const RefPtr<Gdk::Pixbuf>& img)
+{
+ _pixbuf = img;
+ queue_draw ();
+}
Body = 0x2,
Text = 0x4,
Indicator = 0x8,
Body = 0x2,
Text = 0x4,
Indicator = 0x8,
};
static Element default_elements;
};
static Element default_elements;
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
bool on_button_press_event (GdkEventButton*);
bool on_button_release_event (GdkEventButton*);
+ void set_image (const Glib::RefPtr<Gdk::Pixbuf>&);
+
protected:
void render (cairo_t *);
void on_size_request (Gtk::Requisition* req);
protected:
void render (cairo_t *);
void on_size_request (Gtk::Requisition* req);
private:
Glib::RefPtr<Pango::Layout> _layout;
private:
Glib::RefPtr<Pango::Layout> _layout;
+ Glib::RefPtr<Gdk::Pixbuf> _pixbuf;
std::string _text;
Element _elements;
BindingProxy binding_proxy;
std::string _text;
Element _elements;
BindingProxy binding_proxy;