void Button::keyTyped(KeyEventDetails* const e)
{
    if(e->getKey() == KeyEventDetails::KEY_ENTER)
    {
        produceActionPerformed();
    }
    Inherited::keyTyped(e);
}
void MenuItem::handleAcceleratorTyped(KeyEventDetails* const e)
{
    //Set TopLevelMenu
    MenuRefPtr TopMenu(getTopLevelMenu());
    if(TopMenu != NULL)
    {
        TopMenu->setDrawAsThoughSelected(true);

        _FlashElps = 0.0;
        _FlashUpdateConnection = getParentWindow()->getParentDrawingSurface()->getEventProducer()->connectUpdate(boost::bind(&MenuItem::handleFlashUpdate, this, _1));
    }
    produceActionPerformed();
}
void Button::mouseReleased(MouseEventDetails* const e)
{	
    if(getEnabled())
    {
        if(e->getButton() == MouseEventDetails::BUTTON1 && _Armed)
        {
            this->setActive(false);

            produceActionPerformed();
            _Armed = false;

            //Consume the event
            e->consume();
            return;
        }
    }
    Component::mouseReleased(e);
}
void MenuItem::mouseReleased(MouseEventDetails* const e)
{
    if(getSelected() && getEnabled())
    {
	   produceActionPerformed();
       getParentWindow()->destroyPopupMenu();
          setSelected(false);
    }
    
	if(getEnabled())
	{
		if(e->getButton() == MouseEventDetails::BUTTON1 && _Armed)
		{
			this->setActive(false);
			_Armed = false;
		}
	}
	Component::mouseReleased(e);
}
void TextField::keyTyped(KeyEventDetails* const e)
{
	if(getEnabled())
	{
		switch(e->getKey())
        {
        case KeyEventDetails::KEY_ENTER:
			produceActionPerformed();
        case KeyEventDetails::KEY_TAB:
	        Component::keyTyped(e); //Tab should not be inserted in a TextField
            break;
        default:
	        Inherited::keyTyped(e);
            break;
        }
	}
    else
    {
	    Inherited::keyTyped(e);
    }
}
void MenuItem::activate(void)
{
    produceActionPerformed();
}