Example #1
0
void
Popup::OnPropertyChanged (PropertyChangedEventArgs *args, MoonError *error)
{
	if (args->GetProperty ()->GetOwnerType() != Type::POPUP) {
		FrameworkElement::OnPropertyChanged (args, error);
		return;
	}
	
	if (args->GetId () == Popup::IsOpenProperty) {
		// we intentionally don't track whether we've added a tick
		// call (to make sure we only add it once) for this event
		// because multiple IsOpen changes cause multiple async events
		// in SL.
		if (args->GetNewValue () && args->GetNewValue ()->AsBool ()) {
			Show (GetChild ());
			
			EmitAsync (Popup::OpenedEvent);
		}
		else {
			Hide (GetChild ());
			
			EmitAsync (Popup::ClosedEvent);
		}
	} else if (args->GetId () == Popup::ChildProperty) {
		if (args->GetOldValue () && !args->GetOldValue ()->GetIsNull ()) {
			FrameworkElement *el = args->GetOldValue ()->AsFrameworkElement ();
			if (GetIsOpen ())
				Hide (el);

			el->SetLogicalParent (NULL, error);
			if (error->number)
				return;
		}
		if (args->GetNewValue () && !args->GetNewValue ()->GetIsNull ()) {
			FrameworkElement *el = args->GetNewValue ()->AsFrameworkElement ();
			el->SetLogicalParent (this, error);
			if (error->number) 
				return;
			
			if (GetIsOpen ())
				Show (el);
		}
	} else if (args->GetId () == Popup::HorizontalOffsetProperty
		   || args->GetId () == Popup::VerticalOffsetProperty) {
		UIElement * child = GetChild ();
		if (child)
			child->UpdateTransform ();
	}
	NotifyListenersOfPropertyChange (args, error);
}
Example #2
0
void
Popup::OnIsAttachedChanged (bool attached)
{
	FrameworkElement::OnIsAttachedChanged (attached);
	if (!attached && GetIsOpen ())
		SetIsOpen (false);
}
Example #3
0
bool UGUIWidget::CanReceiveInputKey() const
{
	return bAllowInputKey 
		&& GetIsEnabled() 
		&& GetIsOpen()
		&& GetVisibility() != ESlateVisibility::Hidden 
		&& GetVisibility() != ESlateVisibility::Collapsed;
}
Example #4
0
void
Popup::Dispose ()
{
	if (!shutting_down && GetIsOpen ())
		Hide (GetChild ());
	GetDeployment ()->RemoveHandler (Deployment::ShuttingDownEvent, ShuttingDownCallback, this);
	FrameworkElement::Dispose ();
}