void SPropertyEditorCombo::SendToObjects( const FString& NewValue ) { const TSharedRef< FPropertyNode > PropertyNode = PropertyEditor->GetPropertyNode(); UProperty* Property = PropertyNode->GetProperty(); FString Value; if ( bUsesAlternateDisplayValues && !Property->IsA(UStrProperty::StaticClass())) { // currently only enum properties can use alternate display values; this // might change, so assert here so that if support is expanded to other // property types without updating this block of code, we'll catch it quickly UEnum* Enum = CastChecked<UByteProperty>(Property)->Enum; check(Enum != nullptr); const int32 Index = FindEnumValueIndex(Enum, NewValue); check( Index != INDEX_NONE ); Value = Enum->GetEnumName(Index); FText ToolTipValue = Enum->GetToolTipText(Index); FText ToolTipText = Property->GetToolTipText(); if (!ToolTipValue.IsEmpty()) { ToolTipText = FText::Format(FText::FromString(TEXT("{0}\n\n{1}")), ToolTipText, ToolTipValue); } SetToolTipText(ToolTipText); } else { Value = NewValue; } const TSharedRef< IPropertyHandle > PropertyHandle = PropertyEditor->GetPropertyHandle(); PropertyHandle->SetValueFromFormattedString( Value ); }
void SPropertyComboBox::Construct( const FArguments& InArgs ) { ComboItemList = InArgs._ComboItemList.Get(); RestrictedList = InArgs._RestrictedList.Get(); ToolTipList = InArgs._ToolTipList; OnSelectionChanged = InArgs._OnSelectionChanged; Font = InArgs._Font; // find the initially selected item, if any const FString VisibleText = InArgs._VisibleText.Get(); TSharedPtr<FString> InitiallySelectedItem = NULL; for(int32 ItemIndex = 0; ItemIndex < ComboItemList.Num(); ++ItemIndex) { if(*ComboItemList[ItemIndex].Get() == VisibleText) { SetToolTipText(*ToolTipList[ItemIndex]); InitiallySelectedItem = ComboItemList[ItemIndex]; break; } } SComboBox< TSharedPtr<FString> >::Construct(SComboBox< TSharedPtr<FString> >::FArguments() .Content() [ SNew( STextBlock ) .Text( InArgs._VisibleText ) .Font( Font ) ] .OptionsSource(&ComboItemList) .OnGenerateWidget(this, &SPropertyComboBox::OnGenerateComboWidget) .OnSelectionChanged(this, &SPropertyComboBox::OnSelectionChangedInternal) .InitiallySelectedItem(InitiallySelectedItem) ); }
// Set the tooltip with a string resource void CAudioLevelIndicator::SetToolTipText(UINT nId, BOOL bActivate) { // load string resource m_csToolText.LoadString(nId); // If string resource is not empty if (m_csToolText.IsEmpty() == FALSE) SetToolTipText(m_csToolText); }
// Set the tooltip with a string resource void CHoverButton::SetToolTipText(int nId, BOOL bActivate) { CString sText; // load string resource sText.LoadString(nId); // If string resource is not empty if (sText.IsEmpty() == FALSE) SetToolTipText(&sText, bActivate); }
ClassInfoMemberWithSignatureDescTreeItem(const QString tooltipTitle, const T &cMemberDesc, TreeItemBase *parent = nullptr) : ClassInfoTreeItemBase<MemberDesc>(cMemberDesc, parent), m_sSignature(QtStringAdapter::PLToQt(cMemberDesc.GetSignature())) { SetToolTipText(QObject::tr("<table>" "<tr><td bgcolor=#00ff00 colspan=\"2\">%1 Information</td></tr>" "<tr><td>Name: </td><td>%2</td></tr>" "<tr><td>Description: </td><td>%3</td></tr>" "<tr><td>Signature: </td><td>%4</td></tr>" "</table>").arg(tooltipTitle, m_sName, m_sDescription, m_sSignature)); }
//============================================================================= // Set the tooltip with a string resource //============================================================================= void StyleButton::SetToolTipText(UINT nId, BOOL bActivate) { // load string resource m_tooltext.LoadString(nId); // If string resource is not empty if (m_tooltext.IsEmpty() == FALSE) { SetToolTipText(m_tooltext, bActivate); } }
//设置提示消息 void CPngButton::SetToolTipText(UINT nId, BOOL bActivate) { //加载字符串资源 m_tooltext.LoadString(nId); //判断字符串资源是否为空 if (m_tooltext.IsEmpty() == FALSE) { SetToolTipText(m_tooltext, bActivate); } }
void SPropertyEditorCombo::SendToObjects( const FString& NewValue ) { const TSharedRef< FPropertyNode > PropertyNode = PropertyEditor->GetPropertyNode(); UProperty* Property = PropertyNode->GetProperty(); FString Value; FString ToolTipValue; if ( bUsesAlternateDisplayValues && !Property->IsA(UStrProperty::StaticClass())) { // currently only enum properties can use alternate display values; this might change, so assert here so that if support is expanded to other property types // without updating this block of code, we'll catch it quickly UEnum* Enum = CastChecked<UByteProperty>(Property)->Enum; check(Enum); int32 Index = INDEX_NONE; for( int32 ItemIndex = 0; ItemIndex < Enum->NumEnums(); ++ItemIndex ) { const FString EnumName = Enum->GetEnumName(ItemIndex); const FString DisplayName = Enum->GetDisplayNameText(ItemIndex ).ToString(); if( DisplayName.Len() > 0 ) { if ( DisplayName == NewValue ) { Index = ItemIndex; break; } } else if (EnumName == NewValue) { Index = ItemIndex; break; } } check( Index != INDEX_NONE ); Value = Enum->GetEnumName(Index); ToolTipValue = Enum->GetMetaData( TEXT("ToolTip"), Index ); FString ToolTipText = Property->GetToolTipText().ToString(); if (ToolTipValue.Len() > 0) { ToolTipText = FString::Printf(TEXT("%s\n\n%s"), *ToolTipText, *ToolTipValue); } SetToolTipText(ToolTipText); } else { Value = NewValue; } const TSharedRef< IPropertyHandle > PropertyHandle = PropertyEditor->GetPropertyHandle(); PropertyHandle->SetValueFromFormattedString( Value ); }
/** * Construct this widget. Called by the SNew() Slate macro. * * @param InArgs Declaration used by the SNew() macro to construct this widget * @param Factory The factory this menu entry represents */ void Construct( const FArguments& InArgs, UFactory* Factory ) { // Since we are only displaying classes, we need no thumbnail pool. Thumbnail = MakeShareable( new FAssetThumbnail( Factory->GetSupportedClass(), InArgs._Width, InArgs._Height, TSharedPtr<FAssetThumbnailPool>() ) ); FName ClassThumbnailBrushOverride = Factory->GetNewAssetThumbnailOverride(); TSharedPtr<SWidget> ThumbnailWidget; if ( ClassThumbnailBrushOverride != NAME_None ) { const bool bAllowFadeIn = false; const bool bForceGenericThumbnail = true; const bool bAllowHintText = false; ThumbnailWidget = Thumbnail->MakeThumbnailWidget(bAllowFadeIn, bForceGenericThumbnail, EThumbnailLabel::AssetName, FText(), FLinearColor(0,0,0,0), bAllowHintText, ClassThumbnailBrushOverride); } else { ThumbnailWidget = Thumbnail->MakeThumbnailWidget(); } ChildSlot [ SNew( SHorizontalBox ) +SHorizontalBox::Slot() .Padding( 4, 0, 0, 0 ) .VAlign(VAlign_Center) .AutoWidth() [ SNew( SBox ) .WidthOverride( Thumbnail->GetSize().X + 4 ) .HeightOverride( Thumbnail->GetSize().Y + 4 ) [ ThumbnailWidget.ToSharedRef() ] ] +SHorizontalBox::Slot() .VAlign(VAlign_Center) .Padding(4, 0, 4, 0) [ SNew( SVerticalBox ) +SVerticalBox::Slot() .Padding(0, 0, 0, 1) .AutoHeight() [ SNew(STextBlock) .Font( FEditorStyle::GetFontStyle("LevelViewportContextMenu.AssetLabel.Text.Font") ) .Text( Factory->GetDisplayName() ) ] ] ]; SetToolTipText( Factory->GetToolTip() ); }
ClassInfoAttributeTreeItem(const VarDesc &cVarDesc, TreeItemBase *parent = nullptr) : ClassInfoTreeItemBase<VarDesc>(cVarDesc, parent), m_sType(QtStringAdapter::PLToQt(cVarDesc.GetTypeName())), m_sDefault(QtStringAdapter::PLToQt(cVarDesc.GetDefault())) { SetToolTipText(QObject::tr("<table>" "<tr><td bgcolor=#00ff00 colspan=\"2\">Attribute Information</td></tr>" "<tr><td>Name: </td><td>%1</td></tr>" "<tr><td>Type: </td><td>%2</td></tr>" "<tr><td>Default: </td><td>%3</td></tr>" "<tr><td>Description: </td><td>%4</td></tr>" "</table>").arg(m_sName, m_sType, m_sDefault, m_sDescription)); }
void SPropertyComboBox::SetSelectedItem( const FString& InSelectedItem ) { // Look for the item, due to drag and dropping of Blueprints that may not be in this list. for(int32 ItemIndex = 0; ItemIndex < ComboItemList.Num(); ++ItemIndex) { if(*ComboItemList[ItemIndex].Get() == InSelectedItem) { SetToolTipText(ToolTipList[ItemIndex]); SComboBox< TSharedPtr<FString> >::SetSelectedItem(ComboItemList[ItemIndex]); return; } } }
LRESULT CSkinButton2::OnMouseHover(WPARAM wParam, LPARAM lParam) { m_bMouseOnButton = TRUE; this->Invalidate(); DeleteToolTip(); SetToolTipText(m_tooltext); if (m_pToolTip != NULL) { if (::IsWindow(m_pToolTip->m_hWnd)) { m_pToolTip->Update(); } } return 1; }
LRESULT CAudioLevelIndicator::OnMouseHover(WPARAM wparam, LPARAM lparam) { // TODO: Add your message handler code here and/or call default /* This line corrects a problem with the tooltips not displaying when the mouse passes over them, if the parent window has not been clicked yet. Normally this isn't an issue, but when developing multi-windowed apps, this bug would appear. Setting the ActiveWindow to the parent is a solution to that. */ ::SetActiveWindow(GetParent()->GetSafeHwnd()); // Invalidate(); DeleteToolTip(); // Create a new Tooltip with new Button Size and Location SetToolTipText(m_csToolText); if (m_ToolTip != NULL) if (::IsWindow(m_ToolTip->m_hWnd)) //Display ToolTip m_ToolTip->Update(); return 0; }
//============================================================================= LRESULT CButtonBT::OnMouseHover(WPARAM wparam, LPARAM lparam) //============================================================================= { m_bIsHovering = TRUE; Invalidate(); DeleteToolTip(); // Create a new Tooltip with new Button Size and Location SetToolTipText(m_tooltext); if (m_pToolTip != NULL) { if (::IsWindow(m_pToolTip->m_hWnd)) { //Display ToolTip m_pToolTip->Update(); } } return 0; }
//鼠标盘旋 LRESULT CPngButton::OnMouseHover(WPARAM wparam, LPARAM lparam) { m_bIsHovering = TRUE; Invalidate(); DeleteToolTip(); // 在当前按钮位置上创建一个新的提示控件 SetToolTipText(m_tooltext); if (m_pToolTip.m_hWnd!=NULL) { if (::IsWindow(m_pToolTip.m_hWnd)) { //显示提示 m_pToolTip.Update(); } } return 0; }
void SGraphPin::Construct(const FArguments& InArgs, UEdGraphPin* InPin) { bUsePinColorForText = InArgs._UsePinColorForText; this->SetCursor(EMouseCursor::Default); Visibility = TAttribute<EVisibility>(this, &SGraphPin::GetPinVisiblity); GraphPinObj = InPin; check(GraphPinObj != NULL); const UEdGraphSchema* Schema = GraphPinObj->GetSchema(); check(Schema); const bool bCanConnectToPin = !GraphPinObj->bNotConnectable; const bool bIsInput = (GetDirection() == EGPD_Input); // Create the pin icon widget TSharedRef<SWidget> ActualPinWidget = SAssignNew(PinImage, SImage) .Image(this, &SGraphPin::GetPinIcon) .IsEnabled(bCanConnectToPin) .ColorAndOpacity(this, &SGraphPin::GetPinColor) .OnMouseButtonDown(this, &SGraphPin::OnPinMouseDown) .Cursor(this, &SGraphPin::GetPinCursor); // Create the pin indicator widget (used for watched values) static const FName NAME_NoBorder("NoBorder"); TSharedRef<SWidget> PinStatusIndicator = SNew(SButton) .ButtonStyle(FEditorStyle::Get(), NAME_NoBorder) .Visibility(this, &SGraphPin::GetPinStatusIconVisibility) .ContentPadding(0) .OnClicked(this, &SGraphPin::ClickedOnPinStatusIcon) [ SNew(SImage) .Image(this, &SGraphPin::GetPinStatusIcon) ]; TSharedRef<SWidget> LabelWidget = SNew(STextBlock) .Text(this, &SGraphPin::GetPinLabel) .TextStyle(FEditorStyle::Get(), InArgs._PinLabelStyle) .Visibility(this, &SGraphPin::GetPinLabelVisibility) .ColorAndOpacity(this, &SGraphPin::GetPinTextColor); // Create the widget used for the pin body (status indicator, label, and value) TSharedRef<SWrapBox> LabelAndValue = SNew(SWrapBox) .PreferredWidth(150.f); if (!bIsInput) { LabelAndValue->AddSlot() .VAlign(VAlign_Center) [ PinStatusIndicator ]; LabelAndValue->AddSlot() .VAlign(VAlign_Center) [ LabelWidget ]; } else { LabelAndValue->AddSlot() .VAlign(VAlign_Center) [ LabelWidget ]; TSharedRef<SWidget> ValueWidget = GetDefaultValueWidget(); if (ValueWidget != SNullWidget::NullWidget) { LabelAndValue->AddSlot() .Padding(bIsInput ? FMargin(InArgs._SideToSideMargin, 0, 0, 0) : FMargin(0, 0, InArgs._SideToSideMargin, 0)) .VAlign(VAlign_Center) [ SNew(SBox) .Padding(0.0f) .IsEnabled(this, &SGraphPin::IsEditingEnabled) [ ValueWidget ] ]; } LabelAndValue->AddSlot() .VAlign(VAlign_Center) [ PinStatusIndicator ]; } TSharedPtr<SWidget> PinContent; if (bIsInput) { // Input pin PinContent = SNew(SHorizontalBox) +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) .Padding(0, 0, InArgs._SideToSideMargin, 0) [ ActualPinWidget ] +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) [ LabelAndValue ]; } else { // Output pin PinContent = SNew(SHorizontalBox) +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) [ LabelAndValue ] +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) .Padding(InArgs._SideToSideMargin, 0, 0, 0) [ ActualPinWidget ]; } // Set up a hover for pins that is tinted the color of the pin. SBorder::Construct(SBorder::FArguments() .BorderImage(this, &SGraphPin::GetPinBorder) .BorderBackgroundColor(this, &SGraphPin::GetPinColor) .OnMouseButtonDown(this, &SGraphPin::OnPinNameMouseDown) [ SNew(SLevelOfDetailBranchNode) .UseLowDetailSlot(this, &SGraphPin::UseLowDetailPinNames) .LowDetail() [ //@TODO: Try creating a pin-colored line replacement that doesn't measure text / call delegates but still renders ActualPinWidget ] .HighDetail() [ PinContent.ToSharedRef() ] ] ); TAttribute<FText> ToolTipAttribute = TAttribute<FText>::Create(TAttribute<FText>::FGetter::CreateSP(this, &SGraphPin::GetTooltipText)); SetToolTipText(ToolTipAttribute); }
// コントロールとツールチップのメッセージを設定する。 void CButtonCx::SetToolTipWindowText(LPCTSTR pText) { SetToolTipText(pText); SetWindowText(pText); }