添加新的窗口SWindow

先自定義一個窗口

TSharedRef<SWindow> Window = SNew(SWindow)
		.Title(LOCTEXT("WindowTitle", "Alembic Cache Import Options"))
		.SizingRule(ESizingRule::FixedSize)
		.ClientSize(FVector2D(1000.f, 700.f))
		.AutoCenter(EAutoCenter::PreferredWorkArea)
		.ScreenPosition(FVector2D(0,0))
		.IsEnabled(true)
		.SupportsMinimize(true)
		.SupportsMaximize(true);

	Window->SetContent
	(
		SNew(SImage)
	);

在這裏通過FSlateApplication::Get()添加該窗口,AddModalWindow或者AddWindow方法都可以。

	/*TSharedPtr<SWindow> ParentWindow;
	if (FModuleManager::Get().IsModuleLoaded("MainFrame"))
	{
		IMainFrameModule& MainFrame = FModuleManager::LoadModuleChecked<IMainFrameModule>("MainFrame");
		ParentWindow = MainFrame.GetParentWindow();
		FSlateApplication::Get().AddModalWindow(Window, ParentWindow, false);
	}*/

	FSlateApplication::Get().AddWindow(Window);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章