本文整理汇总了C++中FKeyEvent类的典型用法代码示例。如果您正苦于以下问题:C++ FKeyEvent类的具体用法?C++ FKeyEvent怎么用?C++ FKeyEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FKeyEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnKeyDown
FReply SButton::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent )
{
FReply Reply = FReply::Unhandled();
if (IsEnabled() && (InKeyEvent.GetKey() == EKeys::Enter || InKeyEvent.GetKey() == EKeys::SpaceBar || InKeyEvent.GetKey() == EKeys::Gamepad_FaceButton_Bottom))
{
Press();
if (PressMethod == EButtonPressMethod::ButtonPress)
{
//execute our "OnClicked" delegate, and get the reply
Reply = OnClicked.IsBound() ? OnClicked.Execute() : FReply::Handled();
//You should ALWAYS handle the OnClicked event.
ensure(Reply.IsEventHandled() == true);
}
else
{
Reply = FReply::Handled();
}
}
else
{
Reply = SBorder::OnKeyDown(MyGeometry, InKeyEvent);
}
//return the constructed reply
return Reply;
}
示例2: OnKeyDown
FReply SAssetPicker::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
// Up and down move thru the filtered list
int32 SelectionDelta = 0;
if (InKeyEvent.GetKey() == EKeys::Up)
{
SelectionDelta = -1;
}
else if (InKeyEvent.GetKey() == EKeys::Down)
{
SelectionDelta = +1;
}
else if (InKeyEvent.GetKey() == EKeys::Enter)
{
TArray<FAssetData> SelectionSet = AssetViewPtr->GetSelectedAssets();
HandleAssetsActivated(SelectionSet, EAssetTypeActivationMethod::Opened);
return FReply::Handled();
}
if (SelectionDelta != 0)
{
AssetViewPtr->AdjustActiveSelection(SelectionDelta);
return FReply::Handled();
}
if (Commands->ProcessCommandBindings(InKeyEvent))
{
return FReply::Handled();
}
return FReply::Unhandled();
}
示例3: OnKeyDown
FReply SWidget::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent )
{
if (SupportsKeyboardFocus())
{
EUINavigation Direction = FSlateApplicationBase::Get().GetNavigationDirectionFromKey( InKeyEvent );
// It's the left stick return a navigation request of the correct direction
if ( Direction != EUINavigation::Invalid )
{
return FReply::Handled().SetNavigation( Direction );
}
else if ( InKeyEvent.GetKey() == EKeys::Tab )
{
//@TODO: Really these uses of input should be at a lower priority, only occurring if nothing else handled them
// For now this code prevents consuming them when some modifiers are held down, allowing some limited binding
const bool bAllowEatingKeyEvents = !InKeyEvent.IsControlDown() && !InKeyEvent.IsAltDown() && !InKeyEvent.IsCommandDown();
if (bAllowEatingKeyEvents)
{
EUINavigation MoveDirection = (InKeyEvent.IsShiftDown())
? EUINavigation::Previous
: EUINavigation::Next;
return FReply::Handled().SetNavigation(MoveDirection);
}
}
}
return FReply::Unhandled();
}
示例4: OnKeyDown
virtual FReply OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent) override
{
const FKey Key = InKeyEvent.GetKey();
if (Key == EKeys::Enter)
{
MenuOwner->HandleLoginUIClosed(TSharedPtr<const FUniqueNetId>(), 0);
}
else if (!MenuOwner->GetControlsLocked() && Key == EKeys::Gamepad_FaceButton_Bottom)
{
bool bSkipToMainMenu = true;
{
const auto OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
const auto IdentityInterface = OnlineSub->GetIdentityInterface();
if (IdentityInterface.IsValid())
{
TSharedPtr<GenericApplication> GenericApplication = FSlateApplication::Get().GetPlatformApplication();
const bool bIsLicensed = GenericApplication->ApplicationLicenseValid();
const auto LoginStatus = IdentityInterface->GetLoginStatus(InKeyEvent.GetUserIndex());
if (LoginStatus == ELoginStatus::NotLoggedIn || !bIsLicensed)
{
// Show the account picker.
const auto ExternalUI = OnlineSub->GetExternalUIInterface();
if (ExternalUI.IsValid())
{
ExternalUI->ShowLoginUI(InKeyEvent.GetUserIndex(), false, IOnlineExternalUI::FOnLoginUIClosedDelegate::CreateSP(MenuOwner, &FShooterWelcomeMenu::HandleLoginUIClosed));
bSkipToMainMenu = false;
}
}
}
}
}
if (bSkipToMainMenu)
{
const auto OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
const auto IdentityInterface = OnlineSub->GetIdentityInterface();
if (IdentityInterface.IsValid())
{
TSharedPtr<const FUniqueNetId> UserId = IdentityInterface->GetUniquePlayerId(InKeyEvent.GetUserIndex());
// If we couldn't show the external login UI for any reason, or if the user is
// already logged in, just advance to the main menu immediately.
MenuOwner->HandleLoginUIClosed(UserId, InKeyEvent.GetUserIndex());
}
}
}
return FReply::Handled();
}
return FReply::Unhandled();
}
示例5: OnKeyDown
FReply SSuperSearchBox::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& KeyEvent )
{
if(SuggestionBox->IsOpen() && Suggestions.Num())
{
if(KeyEvent.GetKey() == EKeys::Up || KeyEvent.GetKey() == EKeys::Down)
{
if(KeyEvent.GetKey() == EKeys::Up)
{
//if we're at the top swing around
if(SelectedSuggestion == 1)
{
SelectedSuggestion = Suggestions.Num() - 1;
}
else
{
// got one up
--SelectedSuggestion;
//make sure we're not selecting category
if (Suggestions[SelectedSuggestion]->bCategory)
{
//we know that category is never shown empty so above us will be fine
--SelectedSuggestion;
}
}
}
if(KeyEvent.GetKey() == EKeys::Down)
{
if(SelectedSuggestion < Suggestions.Num() - 1)
{
// go one down, possibly from edit control to top
++SelectedSuggestion;
//make sure we're not selecting category
if (Suggestions[SelectedSuggestion]->bCategory)
{
//we know that category is never shown empty so below us will be fine
++SelectedSuggestion;
}
}
else
{
// back to edit control
SelectedSuggestion = 1;
}
}
MarkActiveSuggestion();
return FReply::Handled();
}
}
return FReply::Unhandled();
}
示例6: OnKeyDown
FReply STableViewBase::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent )
{
if ( InKeyEvent.IsControlDown() && InKeyEvent.GetKey() == EKeys::End )
{
ScrollToBottom();
return FReply::Handled();
}
return FReply::Unhandled();
}
示例7: OnKeyDown
FReply SMultiBoxWidget::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& KeyEvent )
{
SCompoundWidget::OnKeyDown(MyGeometry, KeyEvent);
// allow use of up and down keys to transfer focus/hover state
if(KeyEvent.GetKey() == EKeys::Up || KeyEvent.GetKey() == EKeys::Down)
{
return FocusNextWidget(EUINavigation::Next);
}
return FReply::Unhandled();
}
示例8:
FValorActionInputBinding UInputBlueprintLibrary::K2_GetInputAction(const FKeyEvent& KeyEvent)
{
FValorActionInputBinding Binding;
Binding.Key = KeyEvent.GetKey();
Binding.KeyAsString = Binding.Key.GetDisplayName().ToString();
Binding.bAlt = KeyEvent.IsAltDown();
Binding.bCtrl = KeyEvent.IsControlDown();
Binding.bShift = KeyEvent.IsShiftDown();
Binding.bCmd = KeyEvent.IsCommandDown();
return Binding;
}
示例9: HandleKeyDown
FReply SAssetSearchBox::HandleKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent )
{
if ( SuggestionBox->IsOpen() && (InKeyEvent.GetKey() == EKeys::Up || InKeyEvent.GetKey() == EKeys::Down) )
{
const bool bSelectingUp = InKeyEvent.GetKey() == EKeys::Up;
TSharedPtr<FString> SelectedSuggestion = GetSelectedSuggestion();
if ( SelectedSuggestion.IsValid() )
{
// Find the selection index and select the previous or next one
int32 TargetIdx = INDEX_NONE;
for ( int32 SuggestionIdx = 0; SuggestionIdx < Suggestions.Num(); ++SuggestionIdx )
{
if ( Suggestions[SuggestionIdx] == SelectedSuggestion )
{
if ( bSelectingUp )
{
TargetIdx = SuggestionIdx - 1;
}
else
{
TargetIdx = SuggestionIdx + 1;
}
break;
}
}
if ( Suggestions.IsValidIndex(TargetIdx) )
{
SuggestionListView->SetSelection( Suggestions[TargetIdx] );
SuggestionListView->RequestScrollIntoView( Suggestions[TargetIdx] );
}
}
else if ( !bSelectingUp && Suggestions.Num() > 0 )
{
// Nothing selected and pressed down, select the first item
SuggestionListView->SetSelection( Suggestions[0] );
}
return FReply::Handled();
}
if (OnKeyDownHandler.IsBound())
{
return OnKeyDownHandler.Execute(MyGeometry, InKeyEvent);
}
return FReply::Unhandled();
}
示例10: OnKeyDown
FReply SVisualLoggerLogsList::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
if (InKeyEvent.GetKey() == EKeys::C && (InKeyEvent.IsLeftCommandDown() || InKeyEvent.IsLeftControlDown()))
{
FString ClipboardString;
for (const TSharedPtr<struct FLogEntryItem>& CurrentItem : LogsLinesWidget->GetSelectedItems())
{
ClipboardString += CurrentItem->Category + FString(TEXT(" (")) + FString(FOutputDevice::VerbosityToString(CurrentItem->Verbosity)) + FString(TEXT(") ")) + CurrentItem->Line;
ClipboardString += TEXT("\n");
}
FPlatformMisc::ClipboardCopy(*ClipboardString);
return FReply::Handled();
}
return FReply::Unhandled();
}
示例11: GetCefKeyboardModifiers
int32 FCEFWebBrowserWindow::GetCefKeyboardModifiers(const FKeyEvent& KeyEvent)
{
int32 Modifiers = GetCefInputModifiers(KeyEvent);
const FKey Key = KeyEvent.GetKey();
if (Key == EKeys::LeftAlt ||
Key == EKeys::LeftCommand ||
Key == EKeys::LeftControl ||
Key == EKeys::LeftShift)
{
Modifiers |= EVENTFLAG_IS_LEFT;
}
if (Key == EKeys::RightAlt ||
Key == EKeys::RightCommand ||
Key == EKeys::RightControl ||
Key == EKeys::RightShift)
{
Modifiers |= EVENTFLAG_IS_RIGHT;
}
if (Key == EKeys::NumPadZero ||
Key == EKeys::NumPadOne ||
Key == EKeys::NumPadTwo ||
Key == EKeys::NumPadThree ||
Key == EKeys::NumPadFour ||
Key == EKeys::NumPadFive ||
Key == EKeys::NumPadSix ||
Key == EKeys::NumPadSeven ||
Key == EKeys::NumPadEight ||
Key == EKeys::NumPadNine)
{
Modifiers |= EVENTFLAG_IS_KEY_PAD;
}
return Modifiers;
}
示例12: OnKeyDown
FReply FFaceFXComboChoiceWidget::OnKeyDown(const FGeometry& Geometry, const FKeyEvent& KeyboardEvent)
{
if(KeyboardEvent.GetKey() == EKeys::Escape)
{
return HandleButtonClicked(EAppReturnType::Cancel);
}
return FReply::Unhandled();
}
示例13: OnKeyDown
virtual FReply OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent ) override
{
if (OnKeyDownDelegate.IsBound())
{
return OnKeyDownDelegate.Execute(InKeyEvent.GetKey());
}
return FReply::Unhandled();
}
示例14: OnKeyDown
FReply SFlareKeyBind::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
if (bWaitingForKey)
{
SetKey(InKeyEvent.GetKey());
return FReply::Handled();
}
return FReply::Unhandled();
}
示例15: OnKeyDown
FReply SInlineEditableTextBlock::OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent )
{
if(InKeyEvent.GetKey() == EKeys::F2)
{
EnterEditingMode();
return FReply::Handled();
}
return FReply::Unhandled();
}