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


C++ MainWin::Show方法代码示例

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


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

示例1: NewWindow

void
MainApp::ReadyToRun()
{
	// make sure we have at least one window open
	if (fPlayerCount == 0) {
		MainWin* window = NewWindow();
		if (window == NULL) {
			PostMessage(B_QUIT_REQUESTED);
			return;
		}
		BMessage lastPlaylistArchive;
		if (_RestoreCurrentPlaylist(&lastPlaylistArchive) == B_OK) {
			lastPlaylistArchive.what = M_OPEN_PREVIOUS_PLAYLIST;
			window->PostMessage(&lastPlaylistArchive);
		} else
			window->Show();
	}

	// setup the settings window now, we need to have it
	fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520));
	fSettingsWindow->Hide();
	fSettingsWindow->Show();

	_InstallPlaylistMimeType();
}
开发者ID:DonCN,项目名称:haiku,代码行数:25,代码来源:MainApp.cpp

示例2: _tWinMain

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	int ret = FALSE;
	WSADATA wsad;

	ret = WSAStartup(MAKEWORD(2, 2), &wsad);
	if (ret != 0) {
		OutputDebugString(_T("WSAStartup failed!\n"));
		return FALSE;
	}

	GdiplusStartupInput	gdiplusStartupInput;
	ULONG_PTR			gdiplusToken;
	GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

	MWinMgr::Init(hInstance);
	MWinMgr* mgr = MWinMgr::GetInstance();

	MainWin* mainWin = new MainWin();
	if (mainWin->Create(NULL)) {
		mainWin->Show(nCmdShow);
		mainWin->Update();

		mgr->LoadAccelerators(IDC_NBKSHELL);
		ret = mgr->MainLoop();
	}

	delete mainWin;
	mgr->Quit();

	GdiplusShutdown(gdiplusToken);
	WSACleanup();

	return ret;
}
开发者ID:github188,项目名称:homebrew,代码行数:41,代码来源:AppMain.cpp

示例3: broadcast

void
MainApp::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case M_NEW_PLAYER:
		{
			MainWin* window = NewWindow();
			if (window != NULL)
				window->Show();
			break;
		}
		case M_PLAYER_QUIT:
		{
			// store the window settings of this instance
			MainWin* window = NULL;
			bool audioOnly = false;
			BRect windowFrame;
			bigtime_t creationTime;
			if (message->FindPointer("instance", (void**)&window) == B_OK
				&& message->FindBool("audio only", &audioOnly) == B_OK
				&& message->FindRect("window frame", &windowFrame) == B_OK
				&& message->FindInt64("creation time", &creationTime) == B_OK) {
				if (audioOnly && (!fAudioWindowFrameSaved
						|| creationTime < fLastSavedAudioWindowCreationTime)) {
					fAudioWindowFrameSaved = true;
					fLastSavedAudioWindowCreationTime = creationTime;

					Settings::Default()->SetAudioPlayerWindowFrame(windowFrame);
				}
			}

			// Store the playlist if there is one. Since the app is doing
			// this, it is "atomic". If the user has multiple instances
			// playing audio at the same time, the last instance which is
			// quit wins.
			BMessage playlistArchive;
			if (message->FindMessage("playlist", &playlistArchive) == B_OK)
				_StoreCurrentPlaylist(&playlistArchive);

			// quit if this was the last player window
			fPlayerCount--;
			if (fPlayerCount == 0)
				PostMessage(B_QUIT_REQUESTED);
			break;
		}

		case B_SOME_APP_LAUNCHED:
		case B_SOME_APP_QUIT:
		{
			const char* mimeSig;
			if (message->FindString("be:signature", &mimeSig) < B_OK)
				break;

			bool isMediaServer = strcmp(mimeSig, kMediaServerSig) == 0;
			bool isAddonServer = strcmp(mimeSig, kMediaServerAddOnSig) == 0;
			if (!isMediaServer && !isAddonServer)
				break;

			bool running = (message->what == B_SOME_APP_LAUNCHED);
			if (isMediaServer)
				fMediaServerRunning = running;
			if (isAddonServer)
				fMediaAddOnServerRunning = running;

			if (!fMediaServerRunning && !fMediaAddOnServerRunning) {
				fprintf(stderr, "media server has quit.\n");
				// trigger closing of media nodes
				BMessage broadcast(M_MEDIA_SERVER_QUIT);
				_BroadcastMessage(broadcast);
			} else if (fMediaServerRunning && fMediaAddOnServerRunning) {
				fprintf(stderr, "media server has launched.\n");
				// HACK!
				// quit our now invalid instance of the media roster
				// so that before new nodes are created,
				// we get a new roster (it is a normal looper)
				// TODO: This functionality could become part of
				// BMediaRoster. It could detect the start/quit of
				// the servers like it is done here, and either quit
				// itself, or re-establish the connection, and send some
				// notification to the app... something along those lines.
				BMediaRoster* roster = BMediaRoster::CurrentRoster();
				if (roster) {
					roster->Lock();
					roster->Quit();
				}
				// give the servers some time to init...
				snooze(3000000);
				// trigger re-init of media nodes
				BMessage broadcast(M_MEDIA_SERVER_STARTED);
				_BroadcastMessage(broadcast);
			}
			break;
		}
		case M_SETTINGS:
			_ShowSettingsWindow();
			break;

		case M_SHOW_OPEN_PANEL:
			_ShowOpenFilePanel(message);
			break;
//.........这里部分代码省略.........
开发者ID:DonCN,项目名称:haiku,代码行数:101,代码来源:MainApp.cpp


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