Re: code explanation and a question about signals
- From: Sergio Perticone <g4ll0ws gmail com>
- To: Tralfas D <tralfas gmail com>
- Cc: list gtkmm <gtkmm-list gnome org>
- Subject: Re: code explanation and a question about signals
- Date: Wed, 17 Oct 2007 06:45:20 +0200
On Tue, 2007-10-16 at 23:50 -0400, Tralfas D wrote:
> i was reading over the source for the range widget example and i was
> wonder why this was there
>
> #ifndef GTKMM_DISABLE_DEPRECATED
> Gtk::OptionMenu m_OptionMenu;
> #endif //GTKMM_DISABLE_DEPRECATED
>
> why is it in ifndef? i looked up some stuff about it im guessing it
> means it is showing newer code for option menus and disabling old
> obselete code.
Gtk::OptionMenu is deprecated. If you need a similar widget you should
use Gtk::ComboBox
> and then another random thought i had was about signals. i wanted to
> make two buttons do different things when clicked but i dont know how
> to connect them to a on_button_clicked. can there be multiple
> on_button_clicked signals or only one and then you have to use a new
> signal.
>
on_button_clicked is just a callback, you can create different callbacks
for different widgets, i.e.:
button1.signal_clicked().connect(sigc::mem_fun(*this, &Something::foo));
button2.signal_clicked().connect(sigc::mem_fun(*this, &Something::bar));
//...
void Something::foo() { std::cout << "button 1 clicked\n"; }
void Something::bar() { std::cout << "button 2 clicked\n"; }
To learn more about signals, you could read sigc++ tutorial:
http://libsigc.sourceforge.net/libsigc2/docs/manual/html/index.html
Regards,
s.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]