Exemplo n.º 1
0
void ElementExpanderImpl::OnAllAnimationsEnded()
{
	/* Remove all the elements except the active when going into edit mode.
	 * This should probably be in ChangeState, but it's here because StartAnimation loops across all
	 * the elements calling eoi->StartAnimation on each, which (down the line) eventually advances
	 * state, but before finishing the StartAnimation loop, so the elements can't be removed before
	 * the loop ends.
	 * FIXME: hackish, maybe use a callback?
	 */

	if (state != EE_EDITMODE)
		return;

	ElementOfInterest* activated_eoi = GetActiveElement();
	if (activated_eoi)
	{
		ElementOfInterest *element = First(), *suc;
		while (element)
		{
			suc = element->Suc();
			if (element != activated_eoi)
			{
				element->Out();
				OP_DELETE(element);
			}
			element = suc;
		}
	}
}
Exemplo n.º 2
0
/// Returns active input focus element, if any. Based on the GetActiveElement but performs additional checks.
UIElement * UserInterface::ActiveInputFocusElement()
{
	UIElement * e = GetActiveElement();
	if (!e)
		return NULL;
	if (e->demandInputFocus)
		return e;
	return NULL;
}
CXTPMarkupObject* CXTPMarkupKeyboardNavigation::GetNextTab(CXTPMarkupObject* e, CXTPMarkupObject* pContainer, BOOL goDownOnly)
{
	XTPMarkupKeyboardNavigationMode keyNavigationMode = GetKeyNavigationMode(pContainer);
	if (e == NULL)
	{
		if (IsTabStop(pContainer))
		{
			return pContainer;
		}
		CXTPMarkupObject* pActiveElement = GetActiveElement(pContainer);
		if (pActiveElement)
		{
			return GetNextTab(NULL, pActiveElement, TRUE);
		}
	}
	else if (((keyNavigationMode == xtpMarkupKeyboardNavigationOnce) || (keyNavigationMode == xtpMarkupKeyboardNavigationNone)) && (pContainer != e))
	{
		if (goDownOnly)
		{
			return NULL;
		}
		CXTPMarkupObject* groupParent = GetGroupParent(pContainer);
		return GetNextTab(pContainer, groupParent, goDownOnly);
	}
	CXTPMarkupObject* obj4 = NULL;
	CXTPMarkupObject* obj5 = e;
	XTPMarkupKeyboardNavigationMode tabbingType = keyNavigationMode;
	while ((obj5 = GetNextTabInGroup(obj5, pContainer, tabbingType)) != NULL)
	{
		if (obj4 == obj5)
		{
			break;
		}
		if (obj4 == NULL)
		{
			obj4 = obj5;
		}
		CXTPMarkupObject* obj6 = GetNextTab(NULL, obj5, TRUE);
		if (obj6 != NULL)
		{
			return obj6;
		}
		if (tabbingType == xtpMarkupKeyboardNavigationOnce)
		{
			tabbingType = xtpMarkupKeyboardNavigationContained;
		}
	}
	if ((!goDownOnly && (tabbingType != xtpMarkupKeyboardNavigationContained)) && (GetParent(pContainer) != NULL))
	{
		return GetNextTab(pContainer, GetGroupParent(pContainer), FALSE);
	}
	return NULL;
}
Exemplo n.º 4
0
void ElementExpanderImpl::ChangeState(ElementExpanderState s)
{
	WindowCommander* wic = document->GetWindow()->GetWindowCommander();
	OpFingertouchListener* listener = wic->GetFingertouchListener();

	CheckLegalTransitions(state, s);
	OP_ASSERT(s != state); // No NOT call this twice with the same state.
	state = s;

	timer.Stop();

	switch(state)
	{
	case EE_EXPANDING:
		listener->OnElementsExpanding(wic);
		break;
	case EE_EXPANDED:
		ExtendTimeOut();
		listener->OnElementsExpanded(wic);
		break;
	case EE_EXPANDING_TO_EDIT_MODE:
		break;
	case EE_EDITMODE:
		// Focus the clone widget, if activated.
		if (ElementOfInterest* activated_eoi = GetActiveElement())
			activated_eoi->GetActivatedWidget()->SetFocus(FOCUS_REASON_MOUSE);
		break;
	case EE_HIDING_SLASH_ACTIVATING:
		listener->OnElementsHiding(wic);
		document->GetVisualDevice()->SetFocus(FOCUS_REASON_MOUSE);
		break;
	case EE_HIDDEN:
		// There is no way back from this state.
		listener->OnElementsHidden(wic);
		overlay_window->Show(FALSE);
		break;
	default:
		OP_ASSERT(!"Unknown state");
	}
}