Re: [gtkmm] Variable maps and spin buttons



Am 31.08.2004 21:25:57 schrieb(en) Martin Schulze:
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've seen your patch. It looks fine! As long as the 'connect' method is not extended to signals that provide parameters you don't need to worry about the problems I've mentioned above!

Regards,

 Martin



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