Emit a signal



Using Gtkmm - 2.22 on my Win7 with MinGW.

 

Now, what I would like to do is to emit a signal from 'class A' that would represent the signal sent from the Gtk::Entry widget; any program using 'class A', in this case 'class B', would be able to capture the signal and, if so wished, resend it. I don't have a clue how to accomplish this, so I thought of running it by you first, any ideas would be most appreciated.

Thanks in advance.

 

-------------------------------- example---------------

class A : virtual public Gtk::SomeWidget{

   Gtk::Entry* mEntry;

   A();

   virtual ~A();

   bool a_slot(GdkEventFocus* event);

   sigc::signal<void> signal_detected;

};

A::A(){

   mEntry = manage(new Gtk::Entry());

   mEntry ->signal_focus_out_event().connect(sigc::mem_fun(*this, &A::a_slot));

   }

bool::A::a_slot(GdkEventFocus* event){

//   emit a signal_focus_out_event

return false;

}

class B : virtual public Gtk::Window{

   …

   A* a;

   B();

  virtual  ~B();

   bool b_slot(GdkEventFocus* event);

   sigc::signal<void> signal_detected;

};

B:B(){

   a = manage(new A);

   a->signal_focus_out_event().connect(sigc::mem_fun(*this, &B::b_slot));

}

bool::A::a_slot(GdkEventFocus* event){

//   emit a signal_focus_out_event

return false;

}

int main(int argc, char *argv[]) {

    Gtk::Main kit(argc, argv);

    B app;

    Gtk::Main::run(app);

 

    return 0;

}

 

 

This e-mail is for the sole use of the intended recipient and may contain confidential or privileged information. Unauthorized use of its contents is prohibited. If you have received this e-mail in error, please notify sender immediately via return e-mail and then delete the original e-mail.

 



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