Ejemplo n.º 1
0
void PauseMenu::OnMenuItemClicked(int index)
{
	Menu::OnMenuItemClicked(index);

	switch (state)
	{
	case PAUSE:
		switch (index)
		{
		case 0:    //返回游戏
			DoResume();
			break;
		case 1:   //返回标题菜单
		case 2:   //保存录像
		case 3:   //重新开始
			AskForConfirm();
			break;
		}
		break;
	case GAME_OVER:
		switch (index)
		{
		case 0:    //继续游戏
			break;
		case 1:   //返回标题菜单
		case 2:   //保存录像
		case 3:   //重新开始
			AskForConfirm();
			break;
		}
	}
}
Ejemplo n.º 2
0
void CPUThread::Resume()
{
	if(!IsPaused()) return;

	wxGetApp().SendDbgCommand(DID_RESUME_THREAD, this);

	m_status = Running;
	DoResume();
	Emu.CheckStatus();

	ThreadBase::Start();

	wxGetApp().SendDbgCommand(DID_RESUMED_THREAD, this);
}
Ejemplo n.º 3
0
bool PauseMenu::OnKeyDown(Ptr<EngineObject> sender, int key)
{
	bool ret = Menu::OnKeyDown(sender, key);

	switch (key)
	{
	case VK_ESCAPE:
		if (state != GAME_OVER)
		{
			DoResume();
			return true;
		}
		break;
	case 'R':
		if (state != REPLAY_OVER)
		{
			DoRestart();
			return true;
		}
		break;
	}

	return ret;
}
Ejemplo n.º 4
0
static VOID
MainWndCommand(PMAIN_WND_INFO Info,
               WORD CmdId,
               HWND hControl)
{
    UNREFERENCED_PARAMETER(hControl);

    switch (CmdId)
    {
        case ID_PROP:
        {
            if (Info->SelectedItem != NO_ITEM_SELECTED)
            {
                Info->bDlgOpen = TRUE;
                OpenPropSheet(Info);
                Info->bDlgOpen = FALSE;
                SetMenuAndButtonStates(Info);
            }
        }
        break;

        case ID_REFRESH:
        {
            RefreshServiceList(Info);
            Info->SelectedItem = NO_ITEM_SELECTED;

            /* disable menus and buttons */
            SetMenuAndButtonStates(Info);

            /* clear the service in the status bar */
            SendMessage(Info->hStatus,
                        SB_SETTEXT,
                        1,
                        _T('\0'));
        }
        break;

        case ID_EXPORT:
        {
            ExportFile(Info);
            SetFocus(Info->hListView);
        }
        break;

        case ID_CREATE:
        {
            INT ret;

            ret = DialogBoxParam(hInstance,
                                 MAKEINTRESOURCE(IDD_DLG_CREATE),
                                 Info->hMainWnd,
                                 CreateDialogProc,
                                 (LPARAM)Info);
            if (ret == IDOK)
                RefreshServiceList(Info);

            SetFocus(Info->hListView);
        }
        break;

        case ID_DELETE:
        {
            if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState != SERVICE_RUNNING)
            {
                DialogBoxParam(hInstance,
                               MAKEINTRESOURCE(IDD_DLG_DELETE),
                               Info->hMainWnd,
                               DeleteDialogProc,
                               (LPARAM)Info);
            }
            else
            {
                TCHAR Buf[60];
                LoadString(hInstance,
                           IDS_DELETE_STOP,
                           Buf,
                           sizeof(Buf) / sizeof(TCHAR));
                DisplayString(Buf);
            }

            SetFocus(Info->hListView);

        }
        break;

        case ID_START:
        {
            if (DoStart(Info, NULL))
            {
                UpdateServiceStatus(Info->pCurrentService);
                ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
                SetMenuAndButtonStates(Info);
                SetFocus(Info->hListView);
            }
        }
        break;

        case ID_STOP:
            if (DoStop(Info))
            {
                UpdateServiceStatus(Info->pCurrentService);
                ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
                SetMenuAndButtonStates(Info);
                SetFocus(Info->hListView);
            }
        break;

        case ID_PAUSE:
            DoPause(Info);
        break;

        case ID_RESUME:
            DoResume(Info);
        break;

        case ID_RESTART:
            if (DoStop(Info))
            {
                DoStart(Info, NULL);
                UpdateServiceStatus(Info->pCurrentService);
                ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
                SetMenuAndButtonStates(Info);
                SetFocus(Info->hListView);
            }
        break;

        case ID_HELP:
            MessageBox(NULL,
                       _T("Help is not yet implemented\n"),
                       _T("Note!"),
                       MB_OK | MB_ICONINFORMATION);
            SetFocus(Info->hListView);
        break;

        case ID_EXIT:
            PostMessage(Info->hMainWnd,
                        WM_CLOSE,
                        0,
                        0);
        break;

        case ID_VIEW_LARGE:
            SetListViewStyle(Info->hListView,
                             LVS_ICON);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_LARGE,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_SMALL:
            SetListViewStyle(Info->hListView,
                             LVS_SMALLICON);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_SMALL,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_LIST:
            SetListViewStyle(Info->hListView,
                             LVS_LIST);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_LIST,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_DETAILS:
            SetListViewStyle(Info->hListView,
                             LVS_REPORT);
            CheckMenuRadioItem(GetMenu(Info->hMainWnd),
                               ID_VIEW_LARGE,
                               ID_VIEW_DETAILS,
                               ID_VIEW_DETAILS,
                               MF_BYCOMMAND);
        break;

        case ID_VIEW_CUST:
        break;

        case ID_ABOUT:
            DialogBox(hInstance,
                      MAKEINTRESOURCE(IDD_ABOUTBOX),
                      Info->hMainWnd,
                      AboutDialogProc);
            SetFocus(Info->hListView);
        break;

    }
}
Ejemplo n.º 5
0
// Handling of user interface and other events
void MainWindow::MessageReceived(BMessage *message)
{
	switch(message->what){
		case SELECTION_CHANGED:
			BRow *row;
			row = teamView->RowAt(message->FindInt32("index"));

			if(row != NULL && message->FindInt32("buttons") == B_SECONDARY_MOUSE_BUTTON){
				BPoint point;
				uint32 state;
				teamView->GetMouse(&point,&state);

				BPoint p2 = teamView->ConvertToScreen(point);
				p2.x -= 5.0;
				p2.y -= 5.0;
				//if(fItemMenu->FindMarked())
				//	fItemMenu->FindMarked()->SetMarked(false);

				teamView->SelectionMessage()->ReplaceInt32("buttons",0);
				teamView->ActionMenu()->Go(p2, true, true, true);
				//fItemMenu->Go(p2, true, true, true);
			}
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_KILL:
		case IE_MAINWINDOW_MAINKILL:
			DoKill();
		 	UpdateTeams();
		 	SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_SUSPEND:
		case IE_MAINWINDOW_MAINSUSPEND:
			DoSuspend();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINMENU_ACTION_RESUME:
		case IE_MAINWINDOW_MAINRESUME:
			DoResume();
			UpdateTeams();
			SetButtonState();
			break;
		case SET_PRIORITY: {
			int32 priority = message->FindInt32("priority");
			DoPriority(priority);
			UpdateTeams();
			SetButtonState();
			break;
		}
		case IE_MAINWINDOW_MAINPRIORITYVALUE:
			// takes priority from text field
			DoPriority();
			UpdateTeams();
			SetButtonState();
			break;
		case IE_MAINWINDOW_MAINUPDATE:
			UpdateTeams();
			SetButtonState();
			break;
		case B_ABOUT_REQUESTED:    // "About…" is selected from menu…
		{
			BAboutWindow* fAboutWin = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("Slayer"), slayer_signature);
			fAboutWin->AddDescription(B_TRANSLATE("A thread manager for Haiku"));
			fAboutWin->SetVersion(SLAYER_VERSION);
			fAboutWin->AddCopyright(1999, "Arto Jalkanen");
			const char* authors[] = {
				"Arto Jalkanen ([email protected])",
				NULL
			};
			fAboutWin->AddAuthors(authors);
			fAboutWin->Show();
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_DOCS__:
		{
			BMessage message(B_REFS_RECEIVED);
			message.AddString("url", ProjectWebsite);
			be_roster->Launch("text/html", &message);
		}
			break;
		case IE_MAINWINDOW_MAINMENU_FILE_QUIT:    // "Quit" is selected from menu…
			be_app->PostMessage(B_QUIT_REQUESTED);
			break;
		case IE_MAINWINDOW_MAINMENU_WINDOWS_SETTINGS:
		{
			const char* windowSettingsTitle = B_TRANSLATE("Settings");
			BWindow *settings = slayer->FindWindow(windowSettingsTitle);
			if (!settings)
				new SettingsWindow(windowSettingsTitle);
			else if (settings->Lock()) {
				settings->Activate(true);
				settings->Unlock();
			}
		}
			break;
		default:
			BWindow::MessageReceived(message);
			break;
	}

}