Example #1
0
void Button::paintOverChildren (Graphics& g)
{
#if 1
  getFacade().paintOverChildren (g);
#else
  getFacade().paintOverChildren (g, getLocalBounds());
#endif
}
Example #2
0
void Button::enablementChanged ()
{
  if (isEnabled ())
    getFacade().setAlpha (1.f);
  else
    getFacade().setAlpha (.5f);

  updateView ();
}
Example #3
0
void Button::paintButton (Graphics& g,
                          bool isMouseOverButton,
                          bool isButtonDown)
{
  getFacade().setEnabled (Button::isEnabled());
  getFacade().setButtonState (isMouseOverButton, isButtonDown);
  
#if 1
  getFacade().paintFacade (g);
#else
  getFacade().paint (g, getLocalBounds());
#endif
}
Example #4
0
void Button::updateView ()
{
#if 0
  setEnabled (getModel().isEnabled ());
  bool enabled = Button::isEnabled ();
  if (getFacade().isEnabled () != enabled)
    getFacade().setEnabled (enabled);

  // make the button look pressed when the model changes without user action
  //setState (getModel().isActive() ? buttonDown :
  //  (isMouseOver() ? buttonOver : buttonNormal));

  repaint();
#endif
}
//-----------------------------------------------------------------------
void BackKeyCommand::go(const Notification& notification)
{
    ContextProxy* pProxy = dynamic_cast<ContextProxy*>(ProxyManager::getSingletonPtr()->retrieveObjectByName(ON_Proxy_Context));
    if (pProxy == nullptr)
    {
        return;
    }

    ContextProxy::ContextQueueVectorIterator it = pProxy->getContextQueueIterator();
    while (it.hasMoreElements())
    {
        ContextQueue* pQueue = it.getNext();
        if (pQueue == nullptr)
        {
            continue;
        }
        u2::Context* pContext = pQueue->top();
        if (pContext == nullptr)
        {
            continue;
        }

        if (_dispatchBack(pContext))
        {
            cocos2d::Value data(pContext->getName());
            getFacade().sendNotification(NTF_Predefined_DestroyContext, &data);
            break;
        }
    }
}
Example #6
0
void LoginCommand::execute(Notification& noti)
{
	const string& name=noti.m_strNotiName;	
	void* data=noti.m_pData;
	if(StringHelper::isEqual(name,LoginFacade::COMMAND_EXIT))
	{
		sendNotification(LoginFacade::NOTIFICATION_CLOSE);
	}
	else if(StringHelper::isEqual(name,LoginFacade::COMMAND_LOGIN))
	{
		LoginVO vo=*((LoginVO*)data);
		IProxy* proxy=getFacade()->getProxy(LoginFacade::PROXY_LOGIN);
		LoginProxy* lp=dynamic_cast<LoginProxy*>(proxy);
		if(lp)
		{
			bool ret=lp->checkLogin(vo);
			if(ret)
			{
				//±¾µØ¼ì²é
				sendNotification(LoginFacade::NOTIFICATION_LOGIN_SUCESS);
			}
			else
			{
				sendNotification(LoginFacade::NOTIFICATION_LOGIN_FAIL);
			}

		}
	}
}
//-----------------------------------------------------------------------
void DestoryContextCommand::_destroyContext(u2::Context* context)
{
    if (context == nullptr)
    {
        return;
    }

    // destroy children
    u2::Context::ContextMapIterator it = context->getChildIterator();
    while (it.hasMoreElements())
    {
        _destroyContext(it.getNext());
    }


    // destroy view component
    ViewComponent* pViewComp = ViewComponentManager::getSingletonPtr()->retrieveObjectByName(context->getViewCompName());
    if (pViewComp != nullptr)
    {
        //pViewComp->end();
        Facade* pFacade = FacadeManager::getSingletonPtr()->retrieveObjectByName(context->getFacadeName());
        if (pFacade != nullptr)
        {
            pFacade->removeViewComp(context->getViewCompName());
        }
        ViewComponentManager::getSingletonPtr()->destoryObject(pViewComp);
    }

    // destroy context
    u2::Context* pParent = context->getParent();
    if (pParent == nullptr)
    {
        pParent->removeChild(context);
    }
    ContextProxy* pContextProxy = getFacade().retrieveProxy<ContextProxy>(ON_Proxy_Context);
    pContextProxy->erase(context);
    ContextManager::getSingletonPtr()->destoryObject(context);
}