Re: [gtkmm] Variable maps and spin buttons



On Tue, 2004-08-31 at 15:25, Martin Schulze wrote:
> Am 27.08.2004 23:44:38 schrieb(en) Alberto Paro:
> > Robert Zeh Wrote:
> > > Has anyone thought of extending the Glade::VariablesMap class to
> > handle
> > > associations between integers and GtkSpinButtons?
> > >
> > Today I've extended Glade::VariablesMap, now it handles:
> > * Entry,
> > * ComboTextEntry,
> > * SpinButton,
> > * *Scale,
> > * Calendar
> > * CheckBox
> > 
> > Tomorrow I'll post the patch on bugzilla.
> > 
> > -----------------
> > Now I'm managing to connect slot to a widget.
> > 
> > for example:
> > 
> >   /** This connect a glade button to a slot
> >    *
> >    * For instance:
> >    * @code
> >    * refXml->connect_button("button", sigc::mem_fun(*this,
> > &ExampleWindow::on_button_clicked) );
> >    * @endcode
> >    *
> >    * @param name The name of the widget.
> >    * @param pslot The slot to connect to.
> >    */
> >   void connect_button(const Glib::ustring& name, const
> > sigc::slot<void,const Gtk::Widget>& slot_);
> > 
> > 
> > But I'm studying sigc because I have not understand how to pass a
> > mem_fun to a function.
> 
> You will want to use 'const sigc::slot<[signature]>&' as argument type. 
> The problem is that '[signature]' is not known i.e. 'connect_button'  
> must be a template function. Also, the function needs eight overloads  
> to cover 0 to 7 template arguments. Note that you won't be able to  
> create a type-safe implementation, i.e. passing a wrong slot type won't  
> result in an error at compile time but the executable will probably  
> segfault.

I think his connect_button code is correct.  The sigc::slot is for
connection to a button signal, and that's well defined by the widget. 
So template args don't matter, there's only the slot signature that he
defines as valid.  Any other parameters must be SigC::bind'ed at connect
time.

Right?




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