-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathTextAssetEditorStyle.h
More file actions
54 lines (42 loc) · 1.64 KB
/
TextAssetEditorStyle.h
File metadata and controls
54 lines (42 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Interfaces/IPluginManager.h"
#include "Brushes/SlateImageBrush.h"
#include "Styling/SlateStyle.h"
#include "Styling/SlateStyleRegistry.h"
#define IMAGE_BRUSH(RelativePath, ...) FSlateImageBrush(RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__)
#define BOX_BRUSH(RelativePath, ...) FSlateBoxBrush(RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__)
#define BORDER_BRUSH(RelativePath, ...) FSlateBorderBrush(RootToContentDir(RelativePath, TEXT(".png")), __VA_ARGS__)
#define TTF_FONT(RelativePath, ...) FSlateFontInfo(RootToContentDir(RelativePath, TEXT(".ttf")), __VA_ARGS__)
#define OTF_FONT(RelativePath, ...) FSlateFontInfo(RootToContentDir(RelativePath, TEXT(".otf")), __VA_ARGS__)
/**
* Implements the visual style of the text asset editor UI.
*/
class FTextAssetEditorStyle
: public FSlateStyleSet
{
public:
/** Default constructor. */
FTextAssetEditorStyle()
: FSlateStyleSet("TextAssetEditorStyle")
{
const FVector2D Icon16x16(16.0f, 16.0f);
const FVector2D Icon20x20(20.0f, 20.0f);
const FVector2D Icon40x40(40.0f, 40.0f);
const FString BaseDir = IPluginManager::Get().FindPlugin("TextAsset")->GetBaseDir();
SetContentRoot(BaseDir / TEXT("Content"));
// set new styles here, for example...
//Set("TextAssetEditor.FancyButton", new IMAGE_BRUSH("icon_forward_40x", Icon40x40));
FSlateStyleRegistry::RegisterSlateStyle(*this);
}
/** Destructor. */
~FTextAssetEditorStyle()
{
FSlateStyleRegistry::UnRegisterSlateStyle(*this);
}
};
#undef IMAGE_BRUSH
#undef BOX_BRUSH
#undef BORDER_BRUSH
#undef TTF_FONT
#undef OTF_FONT