コード例 #1
0
//-----------------------------------------------------------------------------
// 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);
	}
}
コード例 #2
0
ファイル: base-signal.cpp プロジェクト: Tarnyko/dali-core
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;
}
コード例 #3
0
ファイル: base-signal.cpp プロジェクト: Tarnyko/dali-core
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;
  }
}
コード例 #4
0
ファイル: base-signal.cpp プロジェクト: Tarnyko/dali-core
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;
}
コード例 #5
0
ファイル: base-signal.cpp プロジェクト: Tarnyko/dali-core
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;
  }
}
コード例 #6
0
//-----------------------------------------------------------------------------
// Return whether or not the given callback is registered.
//-----------------------------------------------------------------------------
bool CListenerManager::IsRegistered(object oCallback)
{
	return FindCallback(oCallback) != -1;
	//return m_vecCallables.HasElement(oCallback);
}