Re: Subclassing widgets
- From: Simon Fuhrmann <simonfuhrmann gmx de>
- To: Jason Curole <jcurole gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Subclassing widgets
- Date: Wed, 25 Feb 2009 16:29:49 +0100
> How would one pass/send the filename chosen _out_ of the toolbar
> object and up to the main window object where the database object has access
> to it?
That is exactly what you have to do. Use have to write your own signal
like any other GTK widget is doing. Here is how to do that:
Create a private member in your toolbar:
public:
typedef sigc::signal<void, Glib::ustring> SignalFileSelected;
private:
SignalFileSelected sig_file_selected;
Create a public access method to access the signal:
SignalFileSelected& signal_file_selected (void)
{ return this->sig_file_selected; }
Don't forget the reference ("&")! Connect the signal from you main GUI,
this->toolbar.signal_file_selected().connect
(sigc::mem_fun(*this, &MainGui::on_file_selected));
Inside the Toolbar, emit the signal if you have the new filename:
this->sig_file_selected.emit(filename);
The method that takes the filename inside the main GUI is of type:
void on_file_selected (Glib::ustring filename);
Cheers,
Simon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]