예제 #1
0
void CShaderProgram::Disable()
{
  if (OK())
  {
    glUseProgram(0);
    OnDisabled();
  }
}
예제 #2
0
	void Tool::SetEnabled(bool iEnabled)
	{
		mIsEnabled = iEnabled;

		if(mIsEnabled)
		{
			OnEnabled();
		}
		else
		{
			OnDisabled();
		}
	}
예제 #3
0
void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) {
  if (m_bEnabled != bEnable) {
    for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) {
      if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) {
        pChild->EnableWindow(bEnable);
      }
    }

    m_bEnabled = bEnable;

    if (bEnable)
      OnEnabled();
    else
      OnDisabled();
  }
}
void CSmartMine::HandleEvent( const SGameObjectEvent& gameObjectEvent )
{
	const uint32 eventId = gameObjectEvent.event;
	void* pParam = gameObjectEvent.param;
	if ((eventId == eGFE_ScriptEvent) && (pParam != NULL))
	{
		const char* eventName = static_cast<const char*>(pParam);
		if (strcmp(eventName, "enable") == 0)
		{
			OnEnabled();
		}
		else if (strcmp(eventName, "disable") == 0)
		{
			OnDisabled();
		}
		else if (strcmp(eventName, "detonate") == 0)
		{
			StateMachineHandleEventBehavior( SStateEvent(STATE_EVENT_SMARTMINE_TRIGGER_DETONATE) );
		}
	}
	else if ((eventId == eMineGameObjectEvent_RegisterListener) && (pParam != NULL))
	{
		const EntityId listenerEntity = *((EntityId*)(pParam));
		CRY_ASSERT(listenerEntity != 0);
		if (listenerEntity != 0)
		{
			stl::push_back_unique( m_mineEventListeners, listenerEntity );
			UpdateTacticalIcon();
		}
	}
	else if ((eventId == eMineGameObjectEvent_UnRegisterListener) && (pParam != NULL))
	{
		const EntityId listenerEntity = *((EntityId*)(pParam));
		CRY_ASSERT(listenerEntity != 0);
		if (listenerEntity != 0)
		{
			stl::find_and_erase( m_mineEventListeners, listenerEntity );
		}
	}
	else if (eventId == eMineGameObjectEvent_OnNotifyDestroy)
	{
		StateMachineHandleEventBehavior( SStateEvent(STATE_EVENT_SMARTMINE_TRIGGER_DETONATE) );
	}
}
ECode AppWidgetProvider::OnReceive(
    /* [in] */ IContext* context,
    /* [in] */ IIntent* intent)
{
    // Protect against rogue update broadcasts (not really a security issue,
    // just filter bad broacasts out so subclasses are less likely to crash).
    String action;
    intent->GetAction(&action);
    if (IAppWidgetManager::ACTION_APPWIDGET_UPDATE.Equals(action)) {
        AutoPtr<IBundle> extras;
        intent->GetExtras((IBundle**)&extras);
        if (extras != NULL) {
            AutoPtr< ArrayOf<Int32> > appWidgetIds;
            extras->GetInt32Array(
                    IAppWidgetManager::EXTRA_APPWIDGET_IDS, (ArrayOf<Int32>**)&appWidgetIds);
            if (appWidgetIds != NULL && appWidgetIds->GetLength() > 0) {
                AutoPtr<IAppWidgetManagerHelper> helper;
                CAppWidgetManagerHelper::AcquireSingleton((IAppWidgetManagerHelper**)&helper);
                AutoPtr<IAppWidgetManager> manager;
                helper->GetInstance(context, (IAppWidgetManager**)&manager);
                OnUpdate(context, manager, *appWidgetIds);
            }
        }
    }
    else if (IAppWidgetManager::ACTION_APPWIDGET_DELETED.Equals(action)) {
        AutoPtr<IBundle> extras;
        intent->GetExtras((IBundle**)&extras);
        Boolean result;
        if (extras != NULL && (extras->ContainsKey(IAppWidgetManager::EXTRA_APPWIDGET_ID, &result), result)) {
            Int32 appWidgetId;
            extras->GetInt32(IAppWidgetManager::EXTRA_APPWIDGET_ID, &appWidgetId);
            AutoPtr< ArrayOf<Int32> > idsArray = ArrayOf<Int32>::Alloc(1);
            (*idsArray)[0] = appWidgetId;
            OnDeleted(context, *idsArray);
        }
    }
    else if (IAppWidgetManager::ACTION_APPWIDGET_OPTIONS_CHANGED.Equals(action)) {
        AutoPtr<IBundle> extras;
        intent->GetExtras((IBundle**)&extras);
        Boolean result;
        if (extras != NULL && (extras->ContainsKey(IAppWidgetManager::EXTRA_APPWIDGET_ID, &result), result)
                && (extras->ContainsKey(IAppWidgetManager::EXTRA_APPWIDGET_OPTIONS, &result), result)) {
            Int32 appWidgetId;
            extras->GetInt32(IAppWidgetManager::EXTRA_APPWIDGET_ID, &appWidgetId);
            AutoPtr<IBundle> widgetExtras;
            extras->GetBundle(IAppWidgetManager::EXTRA_APPWIDGET_OPTIONS, (IBundle**)&widgetExtras);
            AutoPtr<IAppWidgetManagerHelper> helper;
            CAppWidgetManagerHelper::AcquireSingleton((IAppWidgetManagerHelper**)&helper);
            AutoPtr<IAppWidgetManager> manager;
            helper->GetInstance(context, (IAppWidgetManager**)&manager);
            OnAppWidgetOptionsChanged(context, manager, appWidgetId, widgetExtras);
        }
    }
    else if (IAppWidgetManager::ACTION_APPWIDGET_ENABLED.Equals(action)) {
        OnEnabled(context);
    }
    else if (IAppWidgetManager::ACTION_APPWIDGET_DISABLED.Equals(action)) {
        OnDisabled(context);
    }

    return NOERROR;
}