当前位置: 首页>>代码示例>>C++>>正文


C++ MainWindow::CenterOnScreen方法代码示例

本文整理汇总了C++中MainWindow::CenterOnScreen方法的典型用法代码示例。如果您正苦于以下问题:C++ MainWindow::CenterOnScreen方法的具体用法?C++ MainWindow::CenterOnScreen怎么用?C++ MainWindow::CenterOnScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainWindow的用法示例。


在下文中一共展示了MainWindow::CenterOnScreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnInit


//.........这里部分代码省略.........
		wxLogError(_("Failed to initialize settings."));
		return false;
	}

	SetAppName(_("MultiMC"));
	InstallLangFiles();
	localeHelper.UpdateLangList();

	// Load language.
	long langID = wxLANGUAGE_UNKNOWN;
	if (settings->GetUseSystemLang())
		langID = wxLocale::GetSystemLanguage();
	else
		langID = settings->GetLanguageID();
	langID = localeHelper.FindClosestMatch(langID);

	// If no matching language is found, use English.
	if (langID == wxLANGUAGE_UNKNOWN)
	{
		langID = wxLANGUAGE_ENGLISH_US;
	}

	if (!localeHelper.SetLanguage((wxLanguage)langID))
	{
		localeHelper.SetLanguage(wxLANGUAGE_ENGLISH_US);
		wxLogError(_("Failed to set language. Language set to English."));
	}
	
	wxString cwd = wxGetCwd();
	if(cwd.Contains("!"))
	{
		wxLogError(_("MultiMC has been started from a path that contains '!':\n%s\nThis would break Minecraft. Please move it to a different place."), cwd.c_str());
		return false;
	}

	wxInitAllImageHandlers();
	wxSocketBase::Initialize();
	
	wxMemoryInputStream iconInput16(multimc16, sizeof(multimc16));
	wxMemoryInputStream iconInput32(multimc32, sizeof(multimc32));
	wxMemoryInputStream iconInput64(multimc64, sizeof(multimc64));
	wxMemoryInputStream iconInput128(multimc128, sizeof(multimc128));
	wxIcon icon16,icon32,icon64,icon128;
	icon16.CopyFromBitmap(wxBitmap(wxImage(iconInput16)));
	icon32.CopyFromBitmap(wxBitmap(wxImage(iconInput32)));
	icon64.CopyFromBitmap(wxBitmap(wxImage(iconInput64)));
	icon128.CopyFromBitmap(wxBitmap(wxImage(iconInput128)));
	AppIcons.AddIcon(icon16);
	AppIcons.AddIcon(icon32);
	AppIcons.AddIcon(icon64);
	AppIcons.AddIcon(icon128);
	
	wxFileSystem::AddHandler(new wxArchiveFSHandler);
	// 	wxFileSystem::AddHandler(new wxMemoryFSHandler);
	
	if (!settings->GetInstDir().DirExists())
		settings->GetInstDir().Mkdir();
	if (!settings->GetModsDir().DirExists())
		settings->GetModsDir().Mkdir();
	if (!settings->GetLwjglDir().DirExists())
		settings->GetLwjglDir().Mkdir();
	
	switch (startMode)
	{
	case START_NORMAL:
		{
			MainWindow *mainWin = new MainWindow();
			mainWin->SetName(wxT("MainWindow"));
			if (!wxPersistenceManager::Get().RegisterAndRestore(mainWin))
			{
				mainWin->CenterOnScreen();
			}
			SetTopWindow(mainWin);
			mainWin->Show();
			mainWin->OnStartup();
			return true;
		}

	case START_LAUNCH_INSTANCE:
		{
			MainWindow *mainWin = new MainWindow();
			mainWin->SetName(wxT("MainWindow"));
			if (!wxPersistenceManager::Get().RegisterAndRestore(mainWin))
			{
				mainWin->CenterOnScreen();
			}
			SetTopWindow(mainWin);
			mainWin->launchInstance = launchInstance;
			mainWin->OnStartup();
			mainWin->Hide();
			return true;
		}

	case START_INSTALL_UPDATE:
		InstallUpdate();
		return false;
	}

	return false;
}
开发者ID:Drakonas,项目名称:MultiMC4,代码行数:101,代码来源:multimc.cpp


注:本文中的MainWindow::CenterOnScreen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。