void AKUIInterface::SetFocus( UKUIInterfaceContainer* ctNewFocus ) { if ( ctFocused.Get() == ctNewFocus ) return; UKUIInterfaceContainer* const ctOldFocus = ctFocused.Get(); if ( ctOldFocus != NULL ) { FKUIInterfaceEvent stEventInfo( EKUIInterfaceContainerEventList::E_Blur ); ctOldFocus->SendEvent( stEventInfo ); } this->ctFocused = ctNewFocus; if ( ctNewFocus != NULL ) { FKUIInterfaceEvent stEventInfo( EKUIInterfaceContainerEventList::E_Focus ); ctNewFocus->SendEvent( stEventInfo ); } FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_FocusChange, ctNewFocus ); BroadcastEvent( stEventInfo ); if ( !IsTemplate() ) OnFocusChangeBP( ctOldFocus, ctNewFocus ); }
void UKUIInterfaceElement::SetAlignLocation( const FVector2D& v2AlignLocation ) { this->v2AlignLocation = v2AlignLocation; bValidAlignLocation = true; FKUIInterfaceEvent stEventInfo( EKUIInterfaceElementEventList::E_AlignLocationCalculated ); SendEvent( stEventInfo ); }
void AKUIInterface::Tick( float fDeltaTime ) { FKUIInterfaceContainerTickEvent stEventInfo( EKUIInterfaceContainerEventList::E_Tick, fDeltaTime ); BroadcastEvent( stEventInfo ); if ( !IsTemplate() ) OnTickBP( fDeltaTime ); }
void UKUIInterfaceElement::InvalidateAlignLocation() { bValidAlignLocation = false; for ( int32 i = 0; i < arAlignedToThis.Num(); ++i ) if ( arAlignedToThis[ i ].IsValid() ) arAlignedToThis[ i ]->InvalidateAlignLocation(); FKUIInterfaceEvent stEventInfo( EKUIInterfaceElementEventList::E_AlignLocationInvalidated ); SendEvent( stEventInfo ); }
void UKUIInterfaceElement::SetSize( float fWidth, float fHeight ) { for ( int32 i = 0; i < arAlignedToThis.Num(); ++i ) if ( arAlignedToThis[ i ].IsValid() ) arAlignedToThis[ i ]->InvalidateAlignLocation(); if ( GetContainer() != NULL ) { FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_ChildSizeChange, this ); GetContainer()->SendEvent( stEventInfo ); } InvalidateRenderCache(); }
void UKUIInterfaceElement::SetVerticalAlignment( TEnumAsByte<EKUIInterfaceVAlign::Type> eVAlign ) { if ( this->eVAlign == eVAlign ) return; this->eVAlign = eVAlign; InvalidateAlignLocation(); if ( GetContainer() != NULL ) { FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_ChildLocationChange, this ); GetContainer()->SendEvent( stEventInfo ); } }
bool AKUIInterface::OnKeyChar( TCHAR chChar ) { if ( !IsConsumingInputEvents() ) return false; FKUIInterfaceContainerCharEvent stEventInfo( EKUIInterfaceContainerEventList::E_KeyChar, false, chChar ); ctFocused->SendEvent( stEventInfo ); if ( stEventInfo.bHandled ) return true; BroadcastEvent( stEventInfo, true ); if ( !IsTemplate() ) OnKeyCharBP( FString::Chr( chChar ) ); return stEventInfo.bHandled; }
bool AKUIInterface::OnKeyRepeat( FKey eKey ) { FKUIInterfaceContainerKeyEvent stEventInfo( EKUIInterfaceContainerEventList::E_KeyRepeat, false, eKey ); if ( IsConsumingInputEvents() ) { ctFocused->SendEvent( stEventInfo ); if ( stEventInfo.bHandled ) return true; } BroadcastEvent( stEventInfo, true ); if ( !IsTemplate() ) OnKeyRepeatBP( eKey ); return stEventInfo.bHandled; }
bool AKUIInterface::OnMouseButtonUp( EMouseButtons::Type eButton, const FVector2D& v2Location ) { FKUIInterfaceContainerMouseButtonEvent stEventInfo( EKUIInterfaceContainerEventList::E_MouseButtonUp, false, eButton, v2Location ); if ( IsConsumingInputEvents() ) { ctFocused->SendEvent( stEventInfo ); if ( stEventInfo.bHandled ) return true; } BroadcastEvent( stEventInfo, true ); if ( !IsTemplate() ) OnMouseButtonUpBP( eButton, v2Location ); return stEventInfo.bHandled; }
void UKUIInterfaceElement::SetAlignedTo( UKUIInterfaceElement* oAlignedTo ) { if ( this->oAlignedTo.Get() == oAlignedTo ) return; if ( this->oAlignedTo.IsValid() ) this->oAlignedTo->RemoveAlignedToThis( this ); this->oAlignedTo = oAlignedTo; if ( this->oAlignedTo.IsValid() ) this->oAlignedTo->AddAlignedToThis( this ); InvalidateAlignLocation(); if ( GetContainer() != NULL ) { FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_ChildLocationChange, this ); GetContainer()->SendEvent( stEventInfo ); } }
void UKUIInterfaceElement::SetMargin( float fLeft, float fTop, float fRight, float fBottom ) { if ( v4Margin.X == fLeft && v4Margin.Y == fTop && v4Margin.Z == fRight && v4Margin.W == fBottom ) return; v4Margin.X = fLeft; v4Margin.Y = fTop; v4Margin.Z = fRight; v4Margin.W = fBottom; if ( GetContainer() != NULL ) { FKUIInterfaceContainerElementEvent stEventInfo( EKUIInterfaceContainerEventList::E_ChildLocationChange, this ); GetContainer()->SendEvent( stEventInfo ); } for ( int32 i = 0; i < arAlignedToThis.Num(); ++i ) if ( arAlignedToThis[ i ].IsValid() ) arAlignedToThis[ i ]->InvalidateAlignLocation(); // Moves the child... possibly. InvalidateContainerRenderCache(); }
void UKUIInterfaceElement::SetLocation( float fX, float fY ) { if ( v2Location.X == fX && v2Location.Y == fY ) return; FKUIInterfaceContainerLocationChangeEvent stEventInfo( EKUIInterfaceElementEventList::E_LocationChange, GetLocation(), FVector2D( fX, fY ) ); SendEvent( stEventInfo ); v2Location.X = fX; v2Location.Y = fY; if ( GetContainer() != NULL ) { FKUIInterfaceContainerElementEvent stContainerEventInfo( EKUIInterfaceContainerEventList::E_ChildLocationChange, this ); GetContainer()->SendEvent( stContainerEventInfo ); } for ( int32 i = 0; i < arAlignedToThis.Num(); ++i ) if ( arAlignedToThis[ i ].IsValid() ) arAlignedToThis[ i ]->InvalidateAlignLocation(); InvalidateContainerRenderCache(); }