Making Gtk::Button receive spin events (as per Gtk::SpinButton)



Hi.

I am trying to re-implement Gtk::SpinButton using a container to start with.  As part of the
re-implementation, I need to emulate the scrolling (a.k.a. spinning) functionality of the spin
entry.  Is there any way I can make a Gtk::Button receive these special spin events?  I
have this trivial piece of code below, but it doesn't do what I need.  Anybody can please
point me in the right direction?  (I suspect I'm doing something utterly silly here).

class SpinButton : public Gtk::Button {
public:
  SpinButton() { add_events(Gdk::SCROLL_MASK); }
  SpinButton(const std::string& lbl) : Gtk::Button(lbl) { add_events(Gdk::SCROLL_MASK); }
protected:
  virtual bool on_scroll_event (GdkEventScroll* e)
  { std::cout << "This is never called" << std::endl; return Gtk::Button::on_scroll_event(e); }
};


Regards,

Nickolai


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