void TreasureSupervisor::Update() {
	_action_window.Update();
	_list_window.Update();
	_action_options.Update();
	_list_options.Update();
	_detail_textbox.Update();

	// Allow the user to go to menu mode at any time when the treasure menu is open
	if (InputManager->MenuPress()) {
		MenuMode *MM = new MenuMode(MapMode::CurrentInstance()->GetMapHudName(),
                                    MapMode::CurrentInstance()->GetMapImage().GetFilename());
		ModeManager->Push(MM);
		return;
	}

	// Update the menu according to which sub-window is currently selected
	if (_selection == ACTION_SELECTED)
		_UpdateAction();
	else if (_selection == LIST_SELECTED)
		_UpdateList();
	else if (_selection == DETAIL_SELECTED)
		_UpdateDetail();
	else
		IF_PRINT_WARNING(MAP_DEBUG) << "unknown selection state: " << _selection << std::endl;
}
Exemple #2
0
void
TeamMonitorWindow::Enable()
{
	if (Lock()) {
		if (IsHidden()) {
			BMessage message(kMsgUpdate);
			fUpdateRunner = new BMessageRunner(this, &message, 1000000LL);

			_UpdateList();
			Show();
		}
		Unlock();
	}
}
Exemple #3
0
void
TeamMonitorWindow::Enable()
{
	if (Lock()) {
		if (IsHidden()) {
			BMessage message(kMsgUpdate);
			fUpdateRunner = new BMessageRunner(this, &message, 1000000LL);

			_UpdateList();
			Show();
		}
		Unlock();
	}

	// Not sure why this is needed, but without it the layout isn't correct
	// when the window is first shown and the buttons at the bottom aren't
	// visible.
	InvalidateLayout();
}
Exemple #4
0
void
TeamMonitorWindow::MessageReceived(BMessage* msg)
{
	switch (msg->what) {
		case SYSTEM_SHUTTING_DOWN:
			fQuitting = true;
			break;

		case kMsgUpdate:
			_UpdateList();
			break;

		case kMsgCtrlAltDelPressed:
			bool keyDown;
			if (msg->FindBool("key down", &keyDown) != B_OK)
				break;

			fDescriptionView->CtrlAltDelPressed(keyDown);
			break;

		case kMsgDeselectAll:
			fListView->DeselectAll();
			break;

		case kMsgLaunchTerminal:
			be_roster->Launch("application/x-vnd.Haiku-Terminal");
			break;

		case TM_FORCE_REBOOT:
			_kern_shutdown(true);
			break;
			
		case TM_KILL_APPLICATION:
		{
			TeamListItem* item = dynamic_cast<TeamListItem*>(fListView->ItemAt(
				fListView->CurrentSelection()));
			if (item != NULL) {
				kill_team(item->GetInfo()->team);
				_UpdateList();
			}
			break;
		}
		case TM_QUIT_APPLICATION:
		{
			TeamListItem* item = dynamic_cast<TeamListItem*>(fListView->ItemAt(
				fListView->CurrentSelection()));
			if (item != NULL) {
				QuitTeam(item);
			}
			break;
		}
		case kMsgQuitFailed:
			MarkUnquittableTeam(msg);
			break;

		case TM_RESTART_DESKTOP:
		{
			if (!be_roster->IsRunning(kTrackerSignature))
				be_roster->Launch(kTrackerSignature);
			if (!be_roster->IsRunning(kDeskbarSignature))
				be_roster->Launch(kDeskbarSignature);
			fRestartButton->Hide();
			SetDefaultButton(fCancelButton);
			break;
		}
		case TM_SELECTED_TEAM:
		{
			fKillButton->SetEnabled(fListView->CurrentSelection() >= 0);
			TeamListItem* item = dynamic_cast<TeamListItem*>(fListView->ItemAt(
				fListView->CurrentSelection()));
			fDescriptionView->SetItem(item);
			fQuitButton->SetEnabled(item != NULL && item->IsApplication());
			break;
		}
		case TM_CANCEL:
			PostMessage(B_QUIT_REQUESTED);
			break;

		default:
			BWindow::MessageReceived(msg);
			break;
	}
}