2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "FriendsAndChatPrivatePCH.h"
|
|
|
|
|
|
|
|
|
|
const FName FFriendsAndChatStyle::TypeName( TEXT("FFriendsAndChatStyle") );
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetNormalFriendsFontStyle(const FFriendsFontStyle& FontStyle)
|
2014-10-20 08:14:45 -04:00
|
|
|
{
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendsNormalFontStyle = FontStyle;
|
2014-10-20 08:14:45 -04:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetFriendsListStyle(const FFriendsListStyle& InFriendsListStyle)
|
2014-11-06 15:17:11 -05:00
|
|
|
{
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendsListStyle = InFriendsListStyle;
|
2014-11-06 15:17:11 -05:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetFriendsComboStyle(const FFriendsComboStyle& InFriendsComboStyle)
|
2014-11-17 09:12:20 -05:00
|
|
|
{
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendsComboStyle = InFriendsComboStyle;
|
2014-11-17 09:12:20 -05:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetFriendsChatStyle(const FFriendsChatStyle& InFriendsChatStyle)
|
2015-01-12 06:27:24 -05:00
|
|
|
{
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendsChatStyle = InFriendsChatStyle;
|
2015-01-12 06:27:24 -05:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetFriendsChatChromeStyle(const FFriendsChatChromeStyle& InFriendsChatChromeStyle)
|
2015-01-12 06:27:24 -05:00
|
|
|
{
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendsChatChromeStyle = InFriendsChatChromeStyle;
|
2014-03-14 14:13:41 -04:00
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-02 11:25:26 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetFriendsMarkupStyle(const FFriendsMarkupStyle& InFriendsMarkupStyle)
|
|
|
|
|
{
|
|
|
|
|
FriendsMarkupStyle = InFriendsMarkupStyle;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-13 08:26:18 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetWindowEdgingBrush(const FSlateBrush& Value)
|
|
|
|
|
{
|
|
|
|
|
WindowEdgingBrush = Value;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-28 12:16:38 -05:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetBorderPadding(const FMargin& Padding)
|
|
|
|
|
{
|
|
|
|
|
BorderPadding = Padding;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-05 15:54:57 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetChatFooterMinDesiredHeight(const float InChatFooterMinDesiredHeight)
|
|
|
|
|
{
|
|
|
|
|
ChatFooterMinDesiredHeight = InChatFooterMinDesiredHeight;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetChatFooterPadding(const FMargin& InChatFooterPadding)
|
|
|
|
|
{
|
|
|
|
|
ChatFooterPadding = InChatFooterPadding;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-10 13:14:16 -05:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetScrollbarStyle(const FScrollBarStyle& InScrollBarStyle)
|
|
|
|
|
{
|
|
|
|
|
ScrollBarStyle = InScrollBarStyle;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetWindowStyle(const FWindowStyle& InStyle)
|
|
|
|
|
{
|
|
|
|
|
WindowStyle = InStyle;
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
FFriendsAndChatStyle& FFriendsAndChatStyle::SetActionButtonStyle(const FButtonStyle& ButtonStyle)
|
2015-02-04 00:28:16 -05:00
|
|
|
{
|
2015-06-09 16:41:53 -04:00
|
|
|
ActionButtonStyle = ButtonStyle;
|
2015-04-02 11:07:03 -04:00
|
|
|
return *this;
|
|
|
|
|
}
|
2015-02-04 00:28:16 -05:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
const FFriendsAndChatStyle& FFriendsAndChatStyle::GetDefault()
|
|
|
|
|
{
|
|
|
|
|
static FFriendsAndChatStyle Default;
|
|
|
|
|
return Default;
|
|
|
|
|
}
|
2014-11-25 05:39:51 -05:00
|
|
|
|
2014-12-02 09:42:28 -05:00
|
|
|
/**
|
|
|
|
|
Module style set
|
|
|
|
|
*/
|
|
|
|
|
TSharedPtr< FSlateStyleSet > FFriendsAndChatModuleStyle::FriendsAndChatModuleStyleInstance = NULL;
|
|
|
|
|
|
|
|
|
|
void FFriendsAndChatModuleStyle::Initialize(FFriendsAndChatStyle FriendStyle)
|
|
|
|
|
{
|
|
|
|
|
if ( !FriendsAndChatModuleStyleInstance.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
FriendsAndChatModuleStyleInstance = Create(FriendStyle);
|
|
|
|
|
FSlateStyleRegistry::RegisterSlateStyle( *FriendsAndChatModuleStyleInstance );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FFriendsAndChatModuleStyle::Shutdown()
|
|
|
|
|
{
|
2015-09-07 14:26:24 -04:00
|
|
|
if ( FriendsAndChatModuleStyleInstance.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
FSlateStyleRegistry::UnRegisterSlateStyle( *FriendsAndChatModuleStyleInstance );
|
|
|
|
|
ensure( FriendsAndChatModuleStyleInstance.IsUnique() );
|
|
|
|
|
FriendsAndChatModuleStyleInstance.Reset();
|
|
|
|
|
}
|
2014-12-02 09:42:28 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FName FFriendsAndChatModuleStyle::GetStyleSetName()
|
|
|
|
|
{
|
|
|
|
|
static FName StyleSetName(TEXT("FriendsAndChat"));
|
|
|
|
|
return StyleSetName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSharedRef< FSlateStyleSet > FFriendsAndChatModuleStyle::Create(FFriendsAndChatStyle FriendStyle)
|
|
|
|
|
{
|
|
|
|
|
TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("FriendsAndChatStyle"));
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
const FTextBlockStyle DefaultText = FTextBlockStyle(FriendStyle.FriendsChatStyle.TextStyle)
|
|
|
|
|
.SetFont(FriendStyle.FriendsNormalFontStyle.FriendsFontSmall);
|
2014-12-02 09:42:28 -05:00
|
|
|
|
|
|
|
|
// Name Style
|
|
|
|
|
const FTextBlockStyle GlobalChatFont = FTextBlockStyle(DefaultText)
|
2015-08-31 22:22:58 -04:00
|
|
|
.SetFont(FriendStyle.FriendsChatStyle.TextStyle.Font)
|
2015-09-01 12:28:00 -04:00
|
|
|
.SetColorAndOpacity(FriendStyle.FriendsChatStyle.GlobalHyperlinkChatColor);
|
2014-12-02 09:42:28 -05:00
|
|
|
|
2015-04-29 19:14:38 -04:00
|
|
|
const FTextBlockStyle GameChatFont = FTextBlockStyle(DefaultText)
|
2015-08-31 22:22:58 -04:00
|
|
|
.SetFont(FriendStyle.FriendsChatStyle.TextStyle.Font)
|
2015-09-01 12:28:00 -04:00
|
|
|
.SetColorAndOpacity(FriendStyle.FriendsChatStyle.GameHyperlinkChatColor);
|
2014-12-02 09:42:28 -05:00
|
|
|
|
2015-06-02 11:44:27 -04:00
|
|
|
const FTextBlockStyle PartyChatFont = FTextBlockStyle(DefaultText)
|
2015-08-31 22:22:58 -04:00
|
|
|
.SetFont(FriendStyle.FriendsChatStyle.TextStyle.Font)
|
2015-09-01 12:28:00 -04:00
|
|
|
.SetColorAndOpacity(FriendStyle.FriendsChatStyle.PartyHyperlinkChatColor);
|
2015-06-02 11:44:27 -04:00
|
|
|
|
2014-12-02 09:42:28 -05:00
|
|
|
const FTextBlockStyle WhisperChatFont = FTextBlockStyle(DefaultText)
|
2015-08-31 22:22:58 -04:00
|
|
|
.SetFont(FriendStyle.FriendsChatStyle.TextStyle.Font)
|
2015-09-01 12:28:00 -04:00
|
|
|
.SetColorAndOpacity(FriendStyle.FriendsChatStyle.WhisperHyperlinkChatColor);
|
2014-12-02 09:42:28 -05:00
|
|
|
|
|
|
|
|
const FButtonStyle UserNameButton = FButtonStyle()
|
|
|
|
|
.SetNormal(FSlateNoResource())
|
|
|
|
|
.SetPressed(FSlateNoResource())
|
|
|
|
|
.SetHovered(FSlateNoResource());
|
|
|
|
|
|
|
|
|
|
const FHyperlinkStyle GlobalChatHyperlink = FHyperlinkStyle()
|
|
|
|
|
.SetUnderlineStyle(UserNameButton)
|
|
|
|
|
.SetTextStyle(GlobalChatFont)
|
|
|
|
|
.SetPadding(FMargin(0.0f));
|
|
|
|
|
|
2015-04-29 19:14:38 -04:00
|
|
|
const FHyperlinkStyle GameChatHyperlink = FHyperlinkStyle()
|
2014-12-02 09:42:28 -05:00
|
|
|
.SetUnderlineStyle(UserNameButton)
|
2015-04-29 19:14:38 -04:00
|
|
|
.SetTextStyle(GameChatFont)
|
2014-12-02 09:42:28 -05:00
|
|
|
.SetPadding(FMargin(0.0f));
|
|
|
|
|
|
2015-06-02 11:44:27 -04:00
|
|
|
const FHyperlinkStyle PartyChatHyperlink = FHyperlinkStyle()
|
|
|
|
|
.SetUnderlineStyle(UserNameButton)
|
|
|
|
|
.SetTextStyle(PartyChatFont)
|
|
|
|
|
.SetPadding(FMargin(0.0f));
|
|
|
|
|
|
2014-12-02 09:42:28 -05:00
|
|
|
const FHyperlinkStyle WhisperChatHyperlink = FHyperlinkStyle()
|
|
|
|
|
.SetUnderlineStyle(UserNameButton)
|
|
|
|
|
.SetTextStyle(WhisperChatFont)
|
|
|
|
|
.SetPadding(FMargin(0.0f));
|
|
|
|
|
|
2015-03-13 08:26:18 -04:00
|
|
|
const FHyperlinkStyle DefaultChatHyperlink = FHyperlinkStyle()
|
|
|
|
|
.SetUnderlineStyle(UserNameButton)
|
|
|
|
|
.SetTextStyle(DefaultText)
|
|
|
|
|
.SetPadding(FMargin(0.0f));
|
|
|
|
|
|
|
|
|
|
Style->Set("UserNameTextStyle.Default", DefaultText);
|
|
|
|
|
|
2014-12-02 09:42:28 -05:00
|
|
|
Style->Set("UserNameTextStyle.GlobalHyperlink", GlobalChatHyperlink);
|
2015-04-29 19:14:38 -04:00
|
|
|
Style->Set("UserNameTextStyle.GameHyperlink", GameChatHyperlink);
|
2015-08-07 16:15:57 -04:00
|
|
|
Style->Set("UserNameTextStyle.PartyHyperlink", PartyChatHyperlink);
|
2014-12-02 09:42:28 -05:00
|
|
|
Style->Set("UserNameTextStyle.Whisperlink", WhisperChatHyperlink);
|
2015-03-13 08:26:18 -04:00
|
|
|
Style->Set("UserNameTextStyle.DefaultHyperlink", DefaultChatHyperlink);
|
2014-12-02 09:42:28 -05:00
|
|
|
Style->Set("UserNameTextStyle.GlobalTextStyle", GlobalChatFont);
|
2015-04-29 19:14:38 -04:00
|
|
|
Style->Set("UserNameTextStyle.GameTextStyle", GameChatFont);
|
2015-06-02 11:44:27 -04:00
|
|
|
Style->Set("UserNameTextStyle.PartyTextStyle", PartyChatFont);
|
2014-12-02 09:42:28 -05:00
|
|
|
Style->Set("UserNameTextStyle.WhisperTextStyle", WhisperChatFont);
|
|
|
|
|
|
2015-03-13 08:26:18 -04:00
|
|
|
Style->Set("MessageBreak", FTextBlockStyle(DefaultText)
|
|
|
|
|
.SetFont(FSlateFontInfo(
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendStyle.FriendsNormalFontStyle.FriendsFontSmall.FontObject,
|
2015-03-13 08:26:18 -04:00
|
|
|
6,
|
2015-06-09 16:41:53 -04:00
|
|
|
FriendStyle.FriendsNormalFontStyle.FriendsFontSmall.TypefaceFontName
|
2015-03-13 08:26:18 -04:00
|
|
|
)));
|
|
|
|
|
|
2015-06-09 16:41:53 -04:00
|
|
|
Style->Set("GlobalChatIcon", FInlineTextImageStyle()
|
|
|
|
|
.SetImage(FriendStyle.FriendsChatStyle.ChatGlobalBrush)
|
|
|
|
|
.SetBaseline(0));
|
|
|
|
|
|
|
|
|
|
Style->Set("WhisperChatIcon", FInlineTextImageStyle()
|
|
|
|
|
.SetImage(FriendStyle.FriendsChatStyle.ChatWhisperBrush)
|
|
|
|
|
.SetBaseline(0));
|
|
|
|
|
|
|
|
|
|
Style->Set("PartyChatIcon", FInlineTextImageStyle()
|
|
|
|
|
.SetImage(FriendStyle.FriendsChatStyle.ChatGameBrush)
|
|
|
|
|
.SetBaseline(0));
|
|
|
|
|
|
2014-12-02 09:42:28 -05:00
|
|
|
return Style;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FFriendsAndChatModuleStyle::ReloadTextures()
|
|
|
|
|
{
|
|
|
|
|
FSlateApplication::Get().GetRenderer()->ReloadTextureResources();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const ISlateStyle& FFriendsAndChatModuleStyle::Get()
|
|
|
|
|
{
|
|
|
|
|
return *FriendsAndChatModuleStyleInstance;
|
|
|
|
|
}
|