[gnomemm] Overriding the draw_background signal from Gnome::Canvas::Canvas



Hi,

I've got a Gnome::Canvas::canvas, queried from libglademm.
I'm now trying to override the draw_background signal by doing this:

pCanvas->signal_draw_background().connect( bind(slot(pCanvas, &MainWindow::on_draw_background), pCanvas) );

where pCanvas is a the Gnome::Canvas::canvas and MainWindow a Gtk::Window.

The definition for the overriding on_draw_background method is done like the following, exactly like shown in the docs:

void MainWindow::on_draw_background(const Glib::RefPtr<Gdk::Drawable>& drawable, int x, int y, int width, int height);

When I'm trying to compile this stuff I'm getting the following errors:

-- BEGIN --
no matching function for call to `Glib::SignalProxy5<void, const
Glib::RefPtr<Gdk::Drawable>&, int, int, int, int>::connect(SigC::Slot4<void,
  const Glib::RefPtr<Gdk::Drawable>&, int, int, int>)'
/usr/include/gtkmm-2.0/glibmm/signalproxy.h:228: candidates are:
  SigC::Connection Glib::SignalProxy5<R, P1, P2, P3, P4, P5>::connect(const
SigC::Slot5<R, P1, P2, P3, P4, P5>&, bool = true) [with R = void, P1 = const
  Glib::RefPtr<Gdk::Drawable>&, P2 = int, P3 = int, P4 = int, P5 = int]
/usr/include/sigc++-1.2/sigc++/bind.h: In function `SigC::Slot4<R, P1, P2, P3,
  C1> SigC::bind(const SigC::Slot5<R, P1, P2, P3, P4, C1>&, A1) [with A1 =
Gnome::Canvas::Canvas*, R = void, P1 = const Glib::RefPtr<Gdk::Drawable>&,
  P2 = int, P3 = int, P4 = int, C1 = int]':
MainWnd.cc:64:   instantiated from here
/usr/include/sigc++-1.2/sigc++/bind.h:287: invalid conversion from `
  Gnome::Canvas::Canvas*' to `int'
/usr/include/sigc++-1.2/sigc++/bind.h:287:   initializing argument 4 of `
  SigC::AdaptorBindData1_<C1>::AdaptorBindData1_(void (*)(void*), const
  SigC::Node&, void (*)(void*), C1) [with C1 = int]'
/usr/include/sigc++-1.2/sigc++/object_slot.h: In constructor
`SigC::ObjectSlotNode::ObjectSlotNode(void (*)(void*), T*, void*, T2) [with
  T = Gnome::Canvas::Canvas*, T2 = void (MainWindow::*)(const
  Glib::RefPtr<Gdk::Drawable>&, int, int, int, int)]':

etc, etc.
-- END --

As one can see, a Slot4 is being used instead of a Slot5, which is also the reason why the compiler is trying to cast the last argument from the passed Canvas to an integer.

I really can't see what I'm doing wrong here.. does someone know more about this and how to make it use a Slot5 instead?

The overriding method is in MainWnd (MainWnd::on_draw_background(..)) but I don't think that's the problem.

I would like just to override the method by using an inherited class (from Gnome::Canvas::Canvas) but since I'm using libglademm that's not really possible. (well, yes.. I could remove the canvas from the glade file and hardcode it.. but would that really be the only solution?)

Thanks,
Rich


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus




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