Re: Gnome::Canvas::Canvas resize, backcolor, etc



Bart Verstraete <bartverstraete telenet be> writes:

> what signal is raised if the canvas is resized? I dont find it, not
> in container or widget?

I think it's Widget::on_size_request().

> And how do you change its backgroundcolor? Don't say fill it up
> with a Gnome::Canvas::Rect ;-)

There is a member function inherited from widget, modify_bg(). I have
the following somewhere in my Hardware Monitor code:

void CanvasView::do_set_background(unsigned int color)
{
  Gdk::Color c;
  c.set_rgb(((color >> 24) & 0xff) * 256,
            ((color >> 16) & 0xff) * 256,
            ((color >>  8) & 0xff) * 256);

  canvas->modify_bg(Gtk::STATE_NORMAL, c);
  canvas->modify_bg(Gtk::STATE_ACTIVE, c);
  canvas->modify_bg(Gtk::STATE_PRELIGHT, c);
  canvas->modify_bg(Gtk::STATE_SELECTED, c);
  canvas->modify_bg(Gtk::STATE_INSENSITIVE, c);
}

> And how do you make on Gnome::Canvas::Rect round corners?

Hm, you probably have to code it yourself. Four lines with rounded
edges.

-- 
Ole Laursen
http://www.cs.aau.dk/~olau/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]