Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

Sig::SignalProxy< Slot > Class Template Reference

Callback, event handler connect policy. More...

#include <sig_proxies.h>


Public Member Functions

 SignalProxy (Signal< Slot > *sig)
virtual ConnectionProxy connect (Slot const &what)
 Connect slot to the signal.

virtual ~SignalProxy ()


Detailed Description

template<class Slot>
class Sig::SignalProxy< Slot >

Callback, event handler connect policy.

SignalProxy and friends are signal system for photonmm

Extending C- callbacks

SignalProxy can be used with C- widget without modifying the code as follows

  1. decide which arguments will be passed to C++ handler

            typedef SigC::Slot2<long int, PhEvent_t*> CustomSlot;
    
            ...
    

  2. create C- callback handler function.
            static int ev_my_callback (PtWidget_t*, void* data, PtCallbackInfo_t* cbinfo)
            {
                    // this part is mandatory
    
                    CustomSlot* slot = (CustomSlot*) data;
    
                    // extract actual arguments for the c++ handler form cbinfo.. on own..
    
                    // call C++ handler..
    
                    (void) (*slot) (cbinfo->reason, cbinfo->event);
          
                    ...
            }
    

  3. use Sig::Callback for user callbacks resources of the widget

            // derivation from SigC::Object is mandatory 
    
            class C : public SigC::Object {
                    public:
    
                            void fun (long int, PhEvent_t*) 
                            {
                                    ...
    
                            }
            }
    
            ...
    
            PtWidget_t* widget;
            C o;
    
            ...
    
            Sig::SignalProxy<CustomSlot> sig (new Sig::Callback<CustomSlot> (&ev_my_callback, widget, Cw_CB_MYCUSTOM_CALLBACK));
    
            sig.connect (SigC::slot (&o, &C::fun));
    
    
            ...
    


Constructor & Destructor Documentation

template<class Slot>
Sig::SignalProxy< Slot >::SignalProxy Signal< Slot > *  sig  )  [inline]
 

template<class Slot>
virtual Sig::SignalProxy< Slot >::~SignalProxy  )  [inline, virtual]
 


Member Function Documentation

template<class Slot>
virtual ConnectionProxy Sig::SignalProxy< Slot >::connect Slot const &  what  )  [inline, virtual]
 

Connect slot to the signal.


The documentation for this class was generated from the following file:

SourceForge.net Logo

Documentation for photonmm by Yakov <iakovz@gmail.com>.