Esempio n. 1
0
bool CUISpawnWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
{
	if (WINDOW_KEY_PRESSED != keyboard_action)
	{
		if (dik == DIK_TAB)
		{
			ShowChildren(true);
			game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
			game->OnKeyboardRelease(kSCORES);
			UI()->GetUICursor()->Show();
		}		
		return false;
	}

	if (dik == DIK_TAB)
	{
        ShowChildren(false);
		game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
		game->OnKeyboardPress(kSCORES);
		UI()->GetUICursor()->Hide();
		return false;
	}

	game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
	VERIFY(game);
	//game_cl_TeamDeathmatch * dm = smart_cast<game_cl_TeamDeathmatch *>(&(Game()));
	
	if (DIK_1 == dik || DIK_2 == dik)
	{
		game->StartStopMenu(this,true);
		
		if (DIK_1 == dik)
			game->OnTeamSelect(0);
		else
			game->OnTeamSelect(1);
		return true;
	}
	switch (dik)
	{
	case DIK_ESCAPE:
		game->StartStopMenu(this,true);
		game->OnTeamMenuBack();
		return true;
	case DIK_SPACE:
		game->StartStopMenu(this,true);
		game->OnTeamSelect(-1);
		return true;
	case DIK_RETURN:
		game->StartStopMenu(this,true);
		if (m_pImage1->GetSelectedState())
			game->OnTeamSelect(0);
		else if (m_pImage2->GetSelectedState())
			game->OnTeamSelect(1);
		else
			game->OnTeamSelect(-1);		
		return true;
	}

	return inherited::OnKeyboard(dik, keyboard_action);
}
void wxSRHierarchicalConteiner::RefreshComponent(wxSRComponent* parent,
		std::vector<wxSRComponent*> children) {

	wxSizer* parent_sizer = m_sizer_associations[parent];
	std::vector<wxSRComponent*> parent_children = m_checkbox_tree[parent];

	for (unsigned int i = 0; i < children.size(); i++) {

		wxSRComponent* tmp = children.at(i);

		if (!Find(tmp)) {

			wxSizer* tmp_sizer = new wxBoxSizer(wxVERTICAL);

			parent_sizer->Add(tmp, 0, wxALIGN_LEFT|wxALIGN_TOP, 5);
			parent_sizer->Add(tmp_sizer, 0, wxALIGN_LEFT|wxALIGN_TOP|wxLEFT, 30);

			m_sizer_associations[tmp] = tmp_sizer;
			m_checkbox_tree[tmp] = std::vector<wxSRComponent*>();

			parent_children.push_back(tmp);

		}

	}

	m_checkbox_tree[parent] = parent_children;

	ShowChildren(parent);

}
Esempio n. 3
0
	virtual void UpdateInfo() {
		const float YSEP = Gui::Screen::GetFontHeight() * 1.5f;
		DeleteAllChildren();
		Add(new Gui::Label(Lang::CARGO_INVENTORY), 40, 40);
		Add(new Gui::Label(Lang::JETTISON), 40, 40+YSEP*2);
		float ypos = 40 + 3*YSEP;
		for (int i=1; i<Equip::TYPE_MAX; i++) {
			if (Equip::types[i].slot != Equip::SLOT_CARGO) continue;
			const int gotNum = Pi::player->m_equipment.Count(Equip::SLOT_CARGO, static_cast<Equip::Type>(i));
			if (!gotNum) continue;
			Gui::Button *b = new Gui::SolidButton();
			b->onClick.connect(sigc::bind(sigc::mem_fun(this, &CargoPage::JettisonCargo), static_cast<Equip::Type>(i)));
			Add(b, 40, ypos);
			Add(new Gui::Label(Equip::types[i].name), 70, ypos);
			char buf[128];
			snprintf(buf, sizeof(buf), "%dt", gotNum*Equip::types[i].mass);
			Add(new Gui::Label(buf), 300, ypos);
			ypos += YSEP;
		}

		if (Pi::player->m_equipment.Count(Equip::SLOT_CARGO, Equip::WATER) > 0) {
			Gui::HBox *box = new Gui::HBox();
			box->SetSpacing(5.0f);
			Gui::Button *b = new Gui::SolidButton();
			b->onClick.connect(sigc::mem_fun(this, &CargoPage::Refuel));
			box->PackEnd(b);
			box->PackEnd(new Gui::Label(Lang::REFUEL));
			Add(box, 300, 40);
			box->ShowAll();
		}

		ShowChildren();
	}
void wxSRHierarchicalConteiner::OnClick(wxCommandEvent& event) {

	std::map<wxSRComponent*, std::vector<wxSRComponent*> >::iterator iter;
	for (iter = m_checkbox_tree.begin(); iter != m_checkbox_tree.end(); iter ++) {
		wxSRComponent* tmp = iter->first;
		ShowChildren(tmp);
	}

}
Esempio n. 5
0
AUI_ERRCODE aui_Region::Show( void )
{
	ShowThis();
	ShowChildren();

	if(m_showCallback)
		m_showCallback(this, m_showCallbackData);

	return AUI_ERRCODE_OK;
}
void wxsDrawingWindow::OnFetchSequence(cb_unused wxCommandEvent& event)
{
    if ( m_IsDestroyed ) return;

    ShowChildren();
    Refresh();
    Update();

    // Here we have requested to hide panel and show children
    // But since wxWidges does some updates on events, we
    // have to introduce some delay and allow wxWidgets to
    // do it's stuff before we can read bitmap directly from screen
    switch ( GetDelayType() )
    {
        case None:
            // We don't wait at all assuming that everything is
            // shown now
            FetchSequencePhase2();
            break;

        case Yield:
            // We call Yield() to let wxWidgets process all messages
            // This can be dangerous in some environments when calling
            // Yield() may internally destroy this class (happens on Linux)
            Manager::Yield();
            FetchSequencePhase2();
            break;

        case TimerNormal:
            // We start timer that will send event after some time.
            // We assume here that before timer event is processed,
            // all events used to udpate screen will be processed.
            m_RefreshTimer.Start(50,true);
            break;

        case TimerFast:
            // This version is simillar to TimerNormal, but with the difference is
            // that here's almost no gap between refresh request and refresh
            // execution. This may not be preffered on some platforms where
            // timer events have high priority and are called before processing
            // any pending events on queue. In such situation, it may lead to
            // some unprocessed events which should update screen's content
            // while fetching bitmap.
            m_RefreshTimer.Start(1,true);
            break;

        default:
            break;
    }

}
Esempio n. 7
0
	virtual void UpdateInfo() {
		Sint64 crime, fine;
		Polit::GetCrime(&crime, &fine);
		const float YSEP = Gui::Screen::GetFontHeight() * 1.5f;
		DeleteAllChildren();

		float ypos = 40.0f;
		Add((new Gui::Label(Lang::COMBAT_RATING))->Shadow(true), 40, ypos);
		Add(new Gui::Label(Pi::combatRating[ Pi::CombatRating(Pi::player->GetKillCount()) ]), 40, ypos+YSEP);

		ypos = 160.0f;
		Add((new Gui::Label(Lang::CRIMINAL_RECORD))->Shadow(true), 40, ypos);
		for (int i=0; i<64; i++) {
			if (!(crime & (Uint64(1)<<i))) continue;
			if (!Polit::crimeNames[i]) continue;
			ypos += YSEP;
			Add(new Gui::Label(Polit::crimeNames[i]), 40, ypos);
		}
		ShowChildren();
	}
Esempio n. 8
0
void ui_actor_state_wnd::Show( bool status )
{
	inherited::Show( status );
	ShowChildren( status );
}
Esempio n. 9
0
	virtual void UpdateInfo() {
		const float YSEP = Gui::Screen::GetFontHeight() * 1.5f;
		DeleteAllChildren();

		Gui::Label *l = new Gui::Label(Lang::MISSIONS);
		Add(l, 20, 20);

		l = new Gui::Label(Lang::TYPE);
		Add(l, 20, 20+YSEP*2);
		
		l = new Gui::Label(Lang::CLIENT);
		Add(l, 100, 20+YSEP*2);
		
		l = new Gui::Label(Lang::LOCATION);
		Add(l, 260, 20+YSEP*2);
		
		l = new Gui::Label(Lang::DUE);
		Add(l, 420, 20+YSEP*2);
		
		l = new Gui::Label(Lang::REWARD);
		Add(l, 580, 20+YSEP*2);

		l = new Gui::Label(Lang::STATUS);
		Add(l, 680, 20+YSEP*2);

		ShowChildren();

		Gui::VScrollBar *scroll = new Gui::VScrollBar();
		Gui::VScrollPortal *portal = new Gui::VScrollPortal(760);
		scroll->SetAdjustment(&portal->vscrollAdjust);

		const std::list<const Mission*> &missions = Pi::player->missions.GetAll();
		Gui::Fixed *innerbox = new Gui::Fixed(760, YSEP*3 * missions.size());

		float ypos = 0;
		for (std::list<const Mission*>::const_iterator i = missions.begin(); i != missions.end(); ++i) {
			SystemPath path = (*i)->location;
			StarSystem *s = StarSystem::GetCached(path);
			SBody *sbody = s->GetBodyByPath(&path);

			l = new Gui::Label((*i)->type);
			innerbox->Add(l, 0, ypos);
			
			l = new Gui::Label((*i)->client);
			innerbox->Add(l, 80, ypos);
			
			l = new Gui::Label(stringf("%0,\n%1 [%2{d},%3{d},%4{d}]", sbody->name.c_str(), s->GetName().c_str(), path.sectorX, path.sectorY, path.sectorZ));
			innerbox->Add(l, 240, ypos);
			
			l = new Gui::Label(format_date((*i)->due));
			innerbox->Add(l, 400, ypos);

			l = new Gui::Label(format_money((*i)->reward));
			innerbox->Add(l, 560, ypos);

			switch ((*i)->status) {
                case Mission::FAILED: l = new Gui::Label(std::string("#f00")+std::string(Lang::FAILED)); break;
                case Mission::COMPLETED: l = new Gui::Label(std::string("#ff0")+std::string(Lang::COMPLETED)); break;
				default:
                case Mission::ACTIVE: l = new Gui::Label(std::string("#0f0")+std::string(Lang::ACTIVE)); break;
			}
			innerbox->Add(l, 660, ypos);

			ypos += YSEP*3;
		}
		Add(portal, 20, 20 + YSEP*3);
		Add(scroll, 780, 20 + YSEP*3);
		scroll->ShowAll();
		portal->Add(innerbox);
		portal->ShowAll();
	}
Esempio n. 10
0
bool CUISkinSelectorWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
{
	if (WINDOW_KEY_PRESSED != keyboard_action)
	{
		if (dik == DIK_TAB)
		{
			ShowChildren(true);
			game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
			game->OnKeyboardRelease(kSCORES);
			UI()->GetUICursor()->Show();
		}
		
		return false;
	}

	if (dik == DIK_TAB)
	{
        ShowChildren(false);
		game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
		game->OnKeyboardPress(kSCORES);
		UI()->GetUICursor()->Hide();
		return false;
	}

	int right_border = (int)m_skins.size();
	if (right_border > 9)
		right_border = 9;

	if (dik >= DIK_1 && dik < (int)right_border + DIK_1)
	{
		int NewIndex = dik - DIK_1;
//		Msg("Selected %d", NewIndex);
//		for (u32 i=0; i<m_skinsEnabled.size(); i++)
//			Msg("Enabled - %d", m_skinsEnabled[i]);
		xr_vector<int>::iterator It = std::find(m_skinsEnabled.begin(), m_skinsEnabled.end(), NewIndex);
		if (It != m_skinsEnabled.end())
		{
			m_iActiveIndex = NewIndex;
			OnBtnOK();			
		}
		return true;		
	}

//	game_cl_Deathmatch * dm = smart_cast<game_cl_Deathmatch *>(&(Game()));

	switch (dik){
		case DIK_ESCAPE:
//			Game().StartStopMenu(this,true);
//			dm->OnSkinMenuBack();
			OnBtnCancel();
			return true;
		case DIK_SPACE: // do autoselect
			m_iActiveIndex = -1;
		case DIK_RETURN:	
			OnBtnOK();
			return true;
		case DIK_LEFT:
			OnKeyLeft();
			return true;
		case DIK_RIGHT:
			OnKeyRight();
			return true;
	}

	return false;
}