//-----------------------------------------------------------------------------
// Removes all instances of a callable from the CListenerManager vector.
//-----------------------------------------------------------------------------
void CListenerManager::UnregisterListener(PyObject* pCallable)
{
	// Get the object instance of the callable
	object oCallable = object(handle<>(borrowed(pCallable)));

	int index = FindCallback(oCallable); //m_vecCallables.Find(oCallable);

	if (index == -1) {
		BOOST_RAISE_EXCEPTION(PyExc_ValueError, "Callback not registered.")
	}
	else {
		m_vecCallables.Remove(index);
	}
}
Beispiel #2
0
void BaseSignal::OnDisconnect( CallbackBase* callback )
{
  DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Disconnect()" );

  int index = FindCallback( callback );

  if( index > INVALID_CALLBACK_INDEX )
  {
    DeleteConnection( index );
  }

  // call back is a temporary created to find which slot should be disconnected.
  delete callback;
}
Beispiel #3
0
void BaseSignal::OnConnect( CallbackBase* callback )
{
  DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Connect()" );

  int index = FindCallback( callback );

  // Don't double-connect the same callback
  if( INVALID_CALLBACK_INDEX == index )
  {
    // create a new signal connection object, to allow the signal to track the connection.
    SignalConnection* connection = new SignalConnection( callback );

    mSignalConnections.push_back( connection );
  }
  else
  {
    // clean-up required
    delete callback;
  }
}
Beispiel #4
0
void BaseSignal::OnDisconnect( ConnectionTrackerInterface* tracker, CallbackBase* callback )
{
  DALI_ASSERT_ALWAYS( NULL != tracker  && "Invalid ConnectionTrackerInterface pointer passed to Disconnect()" );
  DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Disconnect()" );

  int index = FindCallback( callback );

  if( index > INVALID_CALLBACK_INDEX )
  {
    // temporary pointer to disconnected callback
    CallbackBase* disconnectedCallback = mSignalConnections[index]->GetCallback();

    // close the signal side connection first.
    DeleteConnection( index );

    // close the slot side connection
    tracker->SignalDisconnected( this, disconnectedCallback );
  }

  // call back is a temporary created to find which slot should be disconnected.
  delete callback;
}
Beispiel #5
0
void BaseSignal::OnConnect( ConnectionTrackerInterface* tracker, CallbackBase* callback )
{
  DALI_ASSERT_ALWAYS( NULL != tracker  && "Invalid ConnectionTrackerInterface pointer passed to Connect()" );
  DALI_ASSERT_ALWAYS( NULL != callback && "Invalid member function pointer passed to Connect()" );

  int index = FindCallback( callback );

  // Don't double-connect the same callback
  if( INVALID_CALLBACK_INDEX == index )
  {
    // create a new signal connection object, to allow the signal to track the connection.
    SignalConnection* connection = new SignalConnection( tracker, callback );

    mSignalConnections.push_back( connection );

    // Let the connection tracker know that a connection between a signal and a slot has been made.
    tracker->SignalConnected( this, callback );
  }
  else
  {
    // clean-up required
    delete callback;
  }
}
//-----------------------------------------------------------------------------
// Return whether or not the given callback is registered.
//-----------------------------------------------------------------------------
bool CListenerManager::IsRegistered(object oCallback)
{
	return FindCallback(oCallback) != -1;
	//return m_vecCallables.HasElement(oCallback);
}