Ejemplo n.º 1
0
// ***************************************************************************
bool CDBGroupListSheet::handleEvent (const CEventDescriptor &event)
{
    if (event.getType() == CEventDescriptor::mouse)
    {
        const CEventDescriptorMouse &eventDesc = (const CEventDescriptorMouse &)event;
        if (isIn(eventDesc.getX(), eventDesc.getY()))
        {
            if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mousewheel)
            {
                if (_ScrollBar != NULL)
                {
                    // and scroll for 1+ item.
                    _ScrollBar->moveTargetY (-eventDesc.getWheel() * _HSlot);
                    return true;
                }
            }
            if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup)
            {
                CGroupContainer *pGC = getContainer();
                if (pGC != NULL) pGC->setHighLighted(false);
            }
        }
    }
    return CInterfaceGroup::handleEvent(event);
}
Ejemplo n.º 2
0
// ***************************************************************************
bool CCtrlBase::handleEvent(const CEventDescriptor &event)
{
	if (event.getType() == CEventDescriptor::system)
	{
		CEventDescriptorSystem &eds = (CEventDescriptorSystem&)event;
		if (eds.getEventTypeExtended() == CEventDescriptorSystem::activecalledonparent)
		{
			if (!((CEventDescriptorActiveCalledOnParent &) eds).getActive())
			{
				// the mouse capture should be lost when the ctrl is hidden
				CInterfaceManager *manager = CInterfaceManager::getInstance();
				if (manager->getCapturePointerLeft() == this)
				{
					manager->setCapturePointerLeft(NULL);
				}
				if (manager->getCapturePointerRight() == this)
				{
					manager->setCapturePointerRight(NULL);
				}
				// NB : don't call return here because derived class may be interested
				// in handling event more speciffically
			}
		}
	}
	return false;
}
Ejemplo n.º 3
0
// ***************************************************************************
bool CCtrlTabButton::handleEvent (const CEventDescriptor &event)
{
	if (event.getType() == CEventDescriptor::system)
	{
		const CEventDescriptorSystem &systemEvent = (const CEventDescriptorSystem &) event;
		if (systemEvent.getEventTypeExtended() == CEventDescriptorSystem::clocktick)
		if (_Blinking)
		{
			CInterfaceManager *pIM = CInterfaceManager::getInstance();
			uint dbclickDelay = pIM->getUserDblClickDelay();
			if ((T1 - _BlinkDate) > dbclickDelay)
			{
				if (_BlinkState)
				{
					setTextColorNormal(CRGBA::White);
					setTextModulateGlobalColorNormal(false);
				}
				else
				{
					setTextColorNormal(_TextColorNormalBlink);
					setTextModulateGlobalColorNormal(_TextModulateGlobalColorNormalBlink);
				}
				_BlinkState = !_BlinkState;
				_BlinkDate = T1;
			}
		}
	}
	return CCtrlTextButton::handleEvent(event);
}
Ejemplo n.º 4
0
	bool handleEvent (const CEventDescriptor &event)
	{
		CInterfaceManager	*im = CInterfaceManager::getInstance();
		if (_Parent)
		{
			if (event.getType() == CEventDescriptor::system)
			{
				const CEventDescriptorSystem &eds = (const CEventDescriptorSystem &) event;
				if (eds.getEventTypeExtended() == CEventDescriptorSystem::setfocus)
				{
					const CEventDescriptorSetFocus &edsf = (const CEventDescriptorSetFocus &) eds;
					if (edsf.hasFocus() == false)
					{
						release();
						return CCtrlBase::handleEvent(event);
					}
				}
			}
			if (event.getType() == CEventDescriptor::mouse)
			{
				const CEventDescriptorMouse &eventDesc = (const CEventDescriptorMouse &)event;
				if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown)
				{
					if (!this->isIn(eventDesc.getX(), eventDesc.getY())) return false;
					_TargetGroup = getTargetGroup();
					if (!_TargetGroup) return false;
					im->setCapturePointerLeft(this);
					_Moving = true;
					_OffsetX = _TargetGroup->getW() - eventDesc.getX();
					return true;
				}
				if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup)
				{
					release();
				}
				if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mousemove)
				{
					if (_Moving && im->getCapturePointerLeft() == this)
					{
						if (!_TargetGroup)
						{
							release();
							return false;
						}
						sint32 newW = eventDesc.getX() + _OffsetX;
						// compute width of all header entries but this one
						CGroupHeader *header = dynamic_cast<CGroupHeader *>(getParent()->getParent());
						if (header)
						{
							sint32 w = 0;
							for (uint k = 0; k < header->getNumChildren(); ++k)
							{
								if (header->getChild(k) != _TargetGroup)
								{
									w += header->getChild(k)->getW();
								}
							}
							sint32 excess = w + newW - header->getHeaderMaxSize();
							if (excess)
							{
								// try to diminish the size of all headers starting from the last
								for (sint k = header->getNumChildren() - 1; k >= 0 && excess > 0; --k)
								{
									if (header->getChild(k) == _TargetGroup) break;
									CGroupHeaderEntry *ghe = dynamic_cast<CGroupHeaderEntry *>(header->getChild(k));
									sint32 wGain = std::min(excess, std::max((sint32) 0, ghe->getW() - ghe->getMinSize()));
									if (wGain > 0)
									{
										ghe->setW(ghe->getW() - wGain);
										ghe->invalidateCoords();
										excess -= wGain;
									}
								}
							}
							newW -= std::max((sint32) 0, excess);
						}
						_TargetGroup->setW(std::max(_WMin, newW));
						_TargetGroup->invalidateCoords();
						CGroupHeaderEntry *ghe = dynamic_cast<CGroupHeaderEntry *>((CInterfaceGroup *) _TargetGroup);
						if (ghe)
						{
							ghe->setW(_TargetGroup->getW());
							ghe->invalidateCoords();
							im->runActionHandler(ghe->getAHOnResize(), ghe, ghe->getAHOnResizeParams());
						}
						return true;
					}
					_Moving = false;
				}
			}
		}
		return CCtrlBase::handleEvent(event);
	}