void CUICellItem::init() { CUIXml uiXml; uiXml.Load( CONFIG_PATH, UI_PATH, "actor_menu_item.xml" ); m_text = xr_new<CUIStatic>(); m_text->SetAutoDelete ( true ); AttachChild ( m_text ); CUIXmlInit::InitStatic ( uiXml, "cell_item_text", 0, m_text ); m_text->Show ( false ); /* m_mark = xr_new<CUIStatic>(); m_mark->SetAutoDelete ( true ); AttachChild ( m_mark ); CUIXmlInit::InitStatic ( uiXml, "cell_item_mark", 0, m_mark ); m_mark->Show ( false );*/ m_upgrade = xr_new<CUIStatic>(); m_upgrade->SetAutoDelete( true ); AttachChild ( m_upgrade ); CUIXmlInit::InitStatic ( uiXml, "cell_item_upgrade", 0, m_upgrade ); m_upgrade_pos = m_upgrade->GetWndPos(); m_upgrade->Show ( false ); m_pConditionState = xr_new<CUIProgressBar>(); m_pConditionState->SetAutoDelete(true); AttachChild(m_pConditionState); CUIXmlInit::InitProgressBar(uiXml, "condition_progess_bar", 0, m_pConditionState); m_pConditionState->Show(true); }
CUICustomSpin::CUICustomSpin() { m_pFrameLine = xr_new<CUIFrameLineWnd>(); m_pBtnUp = xr_new<CUI3tButton>(); m_pBtnDown = xr_new<CUI3tButton>(); m_pLines = xr_new<CUILines>(); m_pFrameLine->SetAutoDelete (true); m_pBtnUp->SetAutoDelete (true); m_pBtnDown->SetAutoDelete (true); AttachChild (m_pFrameLine); AttachChild (m_pBtnUp); AttachChild (m_pBtnDown); m_pLines->SetTextAlignment (CGameFont::alLeft); m_pLines->SetVTextAlignment (valCenter); m_pLines->SetFont (UI().Font().pFontLetterica16Russian); m_pLines->SetTextColor (color_argb(255,235,219,185)); m_time_begin = 0; m_p_delay = 500; m_u_delay = 0; m_textColor[0] = color_argb(255,235,219,185); m_textColor[1] = color_argb(255,100,100,100); }
//////////////////////////////////////////// // About //////////////////////////////////////////// About::About(): CUIWnd(UserString("ABOUT_WINDOW_TITLE"), GG::X(80), GG::Y(130), GG::X(600), GG::Y(500), GG::INTERACTIVE | GG::DRAGABLE | GG::MODAL) { m_done_btn = new CUIButton(UserString("DONE")); m_license = new CUIButton(UserString("LICENSE")); m_vision = new CUIButton(UserString("VISION")); m_info = new CUIMultiEdit(GG::X0, GG::Y0, GG::X1, GG::Y1, UserString("FREEORION_VISION"), GG::MULTI_WORDBREAK | GG::MULTI_READ_ONLY); AttachChild(m_info); AttachChild(m_vision); AttachChild(m_license); AttachChild(m_done_btn); DoLayout(); // Read in the copyright info from a file boost::filesystem::ifstream fin(GetRootDataDir() / "default" / "COPYING"); // this is not GetResourceDir() / "COPYING" because if a mod or scenario is loaded that changes the settings directory, the copyright notice should be unchanged if (!fin.is_open()) return; std::string temp_str; while (!fin.eof()) { std::getline(fin, temp_str, '\n'); m_license_str.append(temp_str); m_license_str.append("\n"); // To ensure new lines are read } fin.close(); GG::Connect(m_done_btn->LeftClickedSignal, &About::OnDone, this); GG::Connect(m_license->LeftClickedSignal, &About::OnLicense, this); GG::Connect(m_vision->LeftClickedSignal, &About::OnVision, this); }
////////////////////////////////////////////////// // ResearchWnd // ////////////////////////////////////////////////// ResearchWnd::ResearchWnd(GG::X w, GG::Y h) : GG::Wnd(GG::X0, GG::Y0, w, h, GG::INTERACTIVE | GG::ONTOP), m_research_info_panel(0), m_queue_lb(0), m_tech_tree_wnd(0), m_enabled(false) { m_research_info_panel = new ProductionInfoPanel(RESEARCH_INFO_AND_QUEUE_WIDTH, GG::Y(200), UserString("RESEARCH_INFO_PANEL_TITLE"), UserString("RESEARCH_INFO_RP"), OUTER_LINE_THICKNESS, ClientUI::KnownTechFillColor(), ClientUI::KnownTechTextAndBorderColor()); m_queue_lb = new QueueListBox(GG::X(2), m_research_info_panel->LowerRight().y, m_research_info_panel->Width() - 4, ClientSize().y - 4 - m_research_info_panel->Height(), "RESEARCH_QUEUE_ROW"); GG::Connect(m_queue_lb->QueueItemMoved, &ResearchWnd::QueueItemMoved, this); m_queue_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_NOSEL | GG::LIST_USERDELETE); GG::Pt tech_tree_wnd_size = ClientSize() - GG::Pt(m_research_info_panel->Width(), GG::Y0); m_tech_tree_wnd = new TechTreeWnd(tech_tree_wnd_size.x, tech_tree_wnd_size.y); m_tech_tree_wnd->MoveTo(GG::Pt(m_research_info_panel->Width(), GG::Y0)); GG::Connect(m_tech_tree_wnd->AddTechToQueueSignal, &ResearchWnd::AddTechToQueueSlot, this); GG::Connect(m_tech_tree_wnd->AddMultipleTechsToQueueSignal, &ResearchWnd::AddMultipleTechsToQueueSlot, this); GG::Connect(m_queue_lb->ErasedSignal, &ResearchWnd::QueueItemDeletedSlot, this); GG::Connect(m_queue_lb->LeftClickedSignal, &ResearchWnd::QueueItemClickedSlot, this); GG::Connect(m_queue_lb->DoubleClickedSignal, &ResearchWnd::QueueItemDoubleClickedSlot, this); AttachChild(m_research_info_panel); AttachChild(m_queue_lb); AttachChild(m_tech_tree_wnd); SetChildClippingMode(ClipToClient); }
void About::CompleteConstruction() { CUIWnd::CompleteConstruction(); m_done = Wnd::Create<CUIButton>(UserString("DONE")); m_license = Wnd::Create<CUIButton>(UserString("LICENSE")); m_vision = Wnd::Create<CUIButton>(UserString("VISION")); m_info = GG::Wnd::Create<CUIMultiEdit>(UserString("FREEORION_VISION"), GG::MULTI_WORDBREAK | GG::MULTI_READ_ONLY); AttachChild(m_info); AttachChild(m_vision); AttachChild(m_license); AttachChild(m_done); DoLayout(); // Read in the copyright info from a file // this is not GetResourceDir() / "COPYING" because if a mod or scenario is loaded // that changes the settings directory, the copyright notice should be unchanged m_license_str = ReadFile(GetRootDataDir() / "default" / "COPYING").value_or(""); m_done->LeftClickedSignal.connect( boost::bind(&GG::Wnd::EndRun, this)); m_license->LeftClickedSignal.connect( boost::bind(&About::ShowLicense, this)); m_vision->LeftClickedSignal.connect( boost::bind(&About::ShowVision, this)); }
CUIQuestionItem::CUIQuestionItem(CUIXml* xml_doc, LPCSTR path) { m_text = xr_new<CUI3tButton>(); m_text->SetAutoDelete (true); AttachChild (m_text); string512 str; CUIXmlInit xml_init; xr_strcpy (str,path); xml_init.InitWindow (*xml_doc, str, 0, this); m_min_height = xml_doc->ReadAttribFlt(path,0,"min_height",15.0f); strconcat (sizeof(str),str,path,":content_text"); xml_init.Init3tButton (*xml_doc, str, 0, m_text); Register (m_text); AddCallback (m_text,BUTTON_CLICKED,CUIWndCallback::void_function(this, &CUIQuestionItem::OnTextClicked)); m_num_text = xr_new<CUITextWnd>(); m_num_text->SetAutoDelete (true); AttachChild (m_num_text); strconcat (sizeof(str),str,path,":num_text"); xml_init.InitTextWnd (*xml_doc, str, 0, m_num_text); }
InGameMenu::InGameMenu(): CUIWnd(UserString("GAME_MENU_WINDOW_TITLE"), (GG::GUI::GetGUI()->AppWidth() - IN_GAME_OPTIONS_WIDTH) / 2, (GG::GUI::GetGUI()->AppHeight() - IN_GAME_OPTIONS_HEIGHT) / 2, IN_GAME_OPTIONS_WIDTH, IN_GAME_OPTIONS_HEIGHT, GG::INTERACTIVE | GG::MODAL) { m_save_btn = new CUIButton(UserString("GAME_MENU_SAVE")); m_load_btn = new CUIButton(UserString("GAME_MENU_LOAD")); m_options_btn = new CUIButton(UserString("INTRO_BTN_OPTIONS")); m_exit_btn = new CUIButton(UserString("GAME_MENU_RESIGN")); m_done_btn = new CUIButton(UserString("DONE")); AttachChild(m_save_btn); AttachChild(m_load_btn); AttachChild(m_options_btn); AttachChild(m_exit_btn); AttachChild(m_done_btn); GG::Connect(m_save_btn->LeftClickedSignal, &InGameMenu::Save, this); GG::Connect(m_load_btn->LeftClickedSignal, &InGameMenu::Load, this); GG::Connect(m_options_btn->LeftClickedSignal, &InGameMenu::Options, this); GG::Connect(m_exit_btn->LeftClickedSignal, &InGameMenu::Exit, this); GG::Connect(m_done_btn->LeftClickedSignal, &InGameMenu::Done, this); if (!HumanClientApp::GetApp()->SinglePlayerGame()) { // need lobby to load a multiplayer game; menu load of a file is insufficient m_load_btn->Disable(); } if (!HumanClientApp::GetApp()->CanSaveNow()) { m_save_btn->Disable(); } DoLayout(); }
void CUIMessagesWindow::Init(float x, float y, float width, float height){ CUIXml xml; u32 color; CGameFont* pFont; xml.Init(CONFIG_PATH, UI_PATH, "messages_window.xml"); m_pGameLog = xr_new<CUIGameLog>();m_pGameLog->SetAutoDelete(true); m_pGameLog->Show(true); AttachChild(m_pGameLog); if ( IsGameTypeSingle() ) { CUIXmlInit::InitScrollView(xml, "sp_log_list", 0, m_pGameLog); } else { m_pChatLog = xr_new<CUIGameLog>(); m_pChatLog->SetAutoDelete(true); m_pChatLog->Show (true); AttachChild (m_pChatLog); m_pChatWnd = xr_new<CUIChatWnd>(m_pChatLog); m_pChatWnd->SetAutoDelete(true); AttachChild (m_pChatWnd); CUIXmlInit::InitScrollView(xml, "mp_log_list", 0, m_pGameLog); CUIXmlInit::InitFont(xml, "mp_log_list:font", 0, color, pFont); m_pGameLog->SetTextAtrib(pFont, color); CUIXmlInit::InitScrollView(xml, "chat_log_list", 0, m_pChatLog); CUIXmlInit::InitFont(xml, "chat_log_list:font", 0, color, pFont); m_pChatLog->SetTextAtrib(pFont, color); m_pChatWnd->Init (xml); } }
////////////////////////////////////////////////// // ResearchWnd // ////////////////////////////////////////////////// ResearchWnd::ResearchWnd(GG::X w, GG::Y h) : GG::Wnd(GG::X0, GG::Y0, w, h, GG::INTERACTIVE | GG::ONTOP), m_research_info_panel(0), m_queue_lb(0), m_tech_tree_wnd(0), m_enabled(false) { GG::X queue_width(GetOptionsDB().Get<int>("UI.queue-width")); m_research_info_panel = new ProductionInfoPanel(UserString("RESEARCH_INFO_PANEL_TITLE"), UserString("RESEARCH_INFO_RP"), GG::X0, GG::Y0, GG::X(queue_width), GG::Y(100), "research.InfoPanel"); m_queue_lb = new QueueListBox("RESEARCH_QUEUE_ROW", UserString("RESEARCH_QUEUE_PROMPT")); m_queue_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_NOSEL | GG::LIST_USERDELETE); GG::Connect(m_queue_lb->QueueItemMovedSignal, &ResearchWnd::QueueItemMoved, this); GG::Connect(m_queue_lb->QueueItemDeletedSignal, &ResearchWnd::DeleteQueueItem, this); GG::Connect(m_queue_lb->LeftClickedSignal, &ResearchWnd::QueueItemClickedSlot, this); GG::Connect(m_queue_lb->DoubleClickedSignal, &ResearchWnd::QueueItemDoubleClickedSlot, this); GG::Pt tech_tree_wnd_size = ClientSize() - GG::Pt(GG::X(GetOptionsDB().Get<int>("UI.queue-width")), GG::Y0); m_tech_tree_wnd = new TechTreeWnd(tech_tree_wnd_size.x, tech_tree_wnd_size.y); GG::Connect(m_tech_tree_wnd->AddTechsToQueueSignal, &ResearchWnd::AddTechsToQueueSlot, this); AttachChild(m_research_info_panel); AttachChild(m_queue_lb); AttachChild(m_tech_tree_wnd); SetChildClippingMode(ClipToClient); DoLayout(); }
void CUIStalkerRankingInfoItem::Init (CUIXml* xml, LPCSTR path, int idx) { XML_NODE* _stored_root = xml->GetLocalRoot(); CUIXmlInit xml_init; xml_init.InitWindow (*xml, path, idx, this); xml->SetLocalRoot (xml->NavigateToNode(path,idx)); m_text1 = xr_new<CUIStatic>(); m_text1->SetAutoDelete(true); AttachChild (m_text1); xml_init.InitStatic (*xml, "text_1", 0, m_text1); m_text2 = xr_new<CUIStatic>(); m_text2->SetAutoDelete(true); AttachChild (m_text2); xml_init.InitStatic (*xml, "text_2", 0, m_text2); m_text3 = xr_new<CUIStatic>(); m_text3->SetAutoDelete(true); AttachChild (m_text3); xml_init.InitStatic (*xml, "text_3", 0, m_text3); xml_init.InitAutoStaticGroup (*xml, "auto", 0, this); m_stored_alpha = color_get_A(m_text2->GetTextColor()); xml->SetLocalRoot (_stored_root); }
CUITrackBar::CUITrackBar() : m_f_min(0), m_f_max(1), m_f_val(0), m_f_back_up(0), m_f_step(0.01f), m_b_is_float(true), m_b_invert(false) { m_pFrameLine = xr_new<CUIFrameLineWnd>(); AttachChild (m_pFrameLine); m_pFrameLine->SetAutoDelete (true); m_pFrameLine_d = xr_new<CUIFrameLineWnd>(); m_pFrameLine_d->SetVisible (false); AttachChild (m_pFrameLine_d); m_pFrameLine_d->SetAutoDelete (true); m_pSlider = xr_new<CUI3tButton>(); AttachChild (m_pSlider); m_pSlider->SetAutoDelete (true); // Start.Real Wolf.06.11.14. m_pSlider->m_bSetStateAfterFocusLost = false; m_bState = false; // Finish.Real Wolf.06.11.14. //. m_pSlider->SetOwner (this); }
void CUIEventsWnd::Init () { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "pda_events.xml"); R_ASSERT3 (xml_result, "xml file not found", "pda_events.xml"); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main_wnd", 0, this); m_UILeftFrame = xr_new<CUIFrameWindow>(); m_UILeftFrame->SetAutoDelete(true); AttachChild (m_UILeftFrame); xml_init.InitFrameWindow (uiXml, "main_wnd:left_frame", 0, m_UILeftFrame); m_UILeftHeader = xr_new<CUIFrameLineWnd>(); m_UILeftHeader->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_UILeftHeader); xml_init.InitFrameLine (uiXml, "main_wnd:left_frame:left_frame_header", 0, m_UILeftHeader); //. xml_init.InitAutoStaticGroup (uiXml, "main_wnd:left_frame",m_UILeftFrame); m_UIAnimation = xr_new<CUIAnimatedStatic>(); m_UIAnimation->SetAutoDelete(true); xml_init.InitAnimatedStatic (uiXml, "main_wnd:left_frame:left_frame_header:anim_static", 0, m_UIAnimation); m_UILeftHeader->AttachChild (m_UIAnimation); m_UIRightWnd = xr_new<CUIWindow>(); m_UIRightWnd->SetAutoDelete(true); AttachChild (m_UIRightWnd); xml_init.InitWindow (uiXml, "main_wnd:right_frame", 0, m_UIRightWnd); m_UIMapWnd = xr_new<CUIMapWnd>(); m_UIMapWnd->SetAutoDelete(false); m_UIMapWnd->Init ("pda_events.xml","main_wnd:right_frame:map_wnd"); m_UITaskInfoWnd = xr_new<CUITaskDescrWnd>(); m_UITaskInfoWnd->SetAutoDelete(false); m_UITaskInfoWnd->Init (&uiXml,"main_wnd:right_frame:task_descr_view"); m_ListWnd = xr_new<CUIScrollView>(); m_ListWnd->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_ListWnd); xml_init.InitScrollView (uiXml, "main_wnd:left_frame:list", 0, m_ListWnd); m_TaskFilter = xr_new<CUITabControl>(); m_TaskFilter->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_TaskFilter); xml_init.InitTabControl (uiXml, "main_wnd:left_frame:filter_tab", 0, m_TaskFilter); m_TaskFilter->SetWindowName ("filter_tab"); Register (m_TaskFilter); AddCallback ("filter_tab",TAB_CHANGED,CUIWndCallback::void_function(this,&CUIEventsWnd::OnFilterChanged)); /* m_primary_or_all_filter_btn = xr_new<CUI3tButton>(); m_primary_or_all_filter_btn->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_primary_or_all_filter_btn); xml_init.Init3tButton (uiXml, "main_wnd:left_frame:primary_or_all", 0, m_primary_or_all_filter_btn); Register (m_primary_or_all_filter_btn); m_primary_or_all_filter_btn-> SetWindowName("btn_primary_or_all"); AddCallback ("btn_primary_or_all",BUTTON_CLICKED,boost::bind(&CUIEventsWnd::OnFilterChanged,this,_1,_2)); */ m_currFilter = eActiveTask; SetDescriptionMode (true); m_ui_task_item_xml.Init (CONFIG_PATH, UI_PATH, "job_item.xml"); }
BuildingIndicator::BuildingIndicator(GG::X w, const std::string& building_type, double turns_completed, double total_turns) : GG::Wnd(GG::X0, GG::Y0, w, GG::Y(Value(w)), GG::INTERACTIVE), m_graphic(0), m_scrap_indicator(0), m_progress_bar(0), m_building_id(INVALID_OBJECT_ID), m_order_issuing_enabled(true) { boost::shared_ptr<GG::Texture> texture = ClientUI::BuildingIcon(building_type); const BuildingType* type = GetBuildingType(building_type); const std::string& desc = type ? type->Description() : ""; SetBrowseInfoWnd(boost::shared_ptr<GG::BrowseInfoWnd>( new IconTextBrowseWnd(texture, UserString(building_type), UserString(desc)))); m_graphic = new GG::StaticGraphic(texture, GG::GRAPHIC_FITGRAPHIC | GG::GRAPHIC_PROPSCALE); AttachChild(m_graphic); m_progress_bar = new MultiTurnProgressBar(total_turns, turns_completed, GG::LightColor(ClientUI::TechWndProgressBarBackgroundColor()), ClientUI::TechWndProgressBarColor(), GG::LightColor(ClientUI::ResearchableTechFillColor())); AttachChild(m_progress_bar); Refresh(); }
void CUIFrags2::Init(CUIXml& xml_doc, LPCSTR path, LPCSTR backgrnd_path){ InitBackground(xml_doc, backgrnd_path); CUIWindow* pTeam1 = NULL; CUIWindow* pTeam2 = NULL; Fvector2 pos; pTeam1 = m_pStats->InitStats(xml_doc, path, 1); AttachChild(pTeam1); pTeam2 = m_pStats2->InitStats(xml_doc, path, 2); AttachChild(pTeam2); // team 2 list float x = xml_doc.ReadAttribFlt(path, 0, "x2"); R_ASSERT(x); pos = m_pStats2->GetWndPos(); pos.x = x; // pos.y += 3; m_pStats2->SetWndPos(pos); // team2 statas pos = pTeam2->GetWndPos(); pos.x += m_pStats2->GetWndPos().x; pTeam2->SetWndPos(pos); // team 1 list pos = m_pStats->GetWndPos(); pos.y += 3; m_pStats->SetWndPos(pos); pos = pTeam1->GetWndPos(); pos.x += m_pStats->GetWndPos().x; pTeam1->SetWndPos(pos); }
CUIVotingCategory::CUIVotingCategory() { xml_doc = NULL; kick = NULL; change_weather = NULL; change_map = NULL; text_vote = NULL; bkgrnd = xr_new<CUIStatic>(); bkgrnd->SetAutoDelete(true); AttachChild(bkgrnd); header = xr_new<CUIStatic>(); header->SetAutoDelete(true); AttachChild(header); btn_cancel = xr_new<CUI3tButton>();btn_cancel->SetAutoDelete(true); AttachChild(btn_cancel); for (int i = 0; i<7; i++) { btn[i] = xr_new<CUI3tButton>(); btn[i]->SetAutoDelete(true); AttachChild(btn[i]); txt[i] = xr_new<CUIStatic>(); txt[i]->SetAutoDelete(true); AttachChild(txt[i]); } Init(); }
SideBar(const CombatSummary& combat_summary, const BarSizer& sizer): GG::Wnd(GG::X0, GG::Y0, GG::X1, GG::Y1, GG::INTERACTIVE), m_side_summary(combat_summary), m_x_axis_label(0), m_sizer(sizer){ GG::Clr axis_label_color = combat_summary.SideColor(); m_x_axis_label = new CUILabel( (boost::format( UserString("COMBAT_FLEET_HEALTH_AXIS_LABEL") ) % combat_summary.SideName() % static_cast<int>(combat_summary.total_current_health) % static_cast<int>(combat_summary.total_max_health)).str(), GG::FORMAT_LEFT); m_x_axis_label->SetColor(axis_label_color); AttachChild(m_x_axis_label); m_y_axis_label = new CUILabel(UserString("COMBAT_UNIT_HEALTH_AXIS_LABEL")); m_y_axis_label->SetColor(axis_label_color); AttachChild(m_y_axis_label); m_dead_label = new CUILabel( (boost::format(UserString("COMBAT_DESTROYED_LABEL")) % m_side_summary.DestroyedUnits() ).str(), GG::FORMAT_RIGHT); m_dead_label->SetColor(axis_label_color); AttachChild(m_dead_label); MakeBars(); }
SitRepPanel::SitRepPanel(GG::X x, GG::Y y, GG::X w, GG::Y h) : CUIWnd(UserString("SITREP_PANEL_TITLE"), x, y, w, h, GG::ONTOP | GG::INTERACTIVE | GG::DRAGABLE | GG::RESIZABLE | CLOSABLE | PINABLE ), m_sitreps_lb(0), m_prev_turn_button(0), m_next_turn_button(0), m_last_turn_button(0), m_showing_turn(INVALID_GAME_TURN) { Sound::TempUISoundDisabler sound_disabler; SetChildClippingMode(DontClip); m_sitreps_lb = new CUIListBox(); m_sitreps_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_NOSEL); m_sitreps_lb->SetVScrollWheelIncrement(ClientUI::Pts()*4.5); AttachChild(m_sitreps_lb); m_prev_turn_button = new CUIButton(UserString("BACK")); AttachChild(m_prev_turn_button); m_next_turn_button = new CUIButton(UserString("NEXT")); AttachChild(m_next_turn_button); m_last_turn_button = new CUIButton(UserString("LAST")); AttachChild(m_last_turn_button); m_filter_button = new CUIButton(UserString("FILTERS")); AttachChild(m_filter_button); GG::Connect(m_prev_turn_button->LeftClickedSignal, &SitRepPanel::PrevClicked, this); GG::Connect(m_next_turn_button->LeftClickedSignal, &SitRepPanel::NextClicked, this); GG::Connect(m_last_turn_button->LeftClickedSignal, &SitRepPanel::LastClicked, this); GG::Connect(m_filter_button->LeftClickedSignal, &SitRepPanel::FilterClicked, this); DoLayout(); Hide(); }
//////////////////// // MessageWnd // //////////////////// MessageWnd::MessageWnd(GG::X x, GG::Y y, GG::X w, GG::Y h) : CUIWnd(UserString("MESSAGES_PANEL_TITLE"), x, y, w, h, GG::INTERACTIVE | GG::DRAGABLE | GG::ONTOP | GG::RESIZABLE | CLOSABLE), m_display(0), m_edit(0), m_display_show_time(0), m_history(), m_history_position() { m_display = new CUIMultiEdit( GG::X0, GG::Y0, ClientWidth(), ClientHeight(), "", GG::MULTI_WORDBREAK | GG::MULTI_READ_ONLY | GG::MULTI_TERMINAL_STYLE | GG::MULTI_INTEGRAL_HEIGHT); AttachChild(m_display); m_display->SetMaxLinesOfHistory(100); // executing this line seems to cause crashes in MultiEdit when adding more lines to the control than the history limit m_edit = new MessageWndEdit(GG::X0, GG::Y0, ClientWidth()); AttachChild(m_edit); GG::Connect(m_edit->TextEnteredSignal, &MessageWnd::MessageEntered, this); GG::Connect(m_edit->UpPressedSignal, &MessageWnd::MessageHistoryUpRequested, this); GG::Connect(m_edit->DownPressedSignal, &MessageWnd::MessageHistoryDownRequested, this); GG::Connect(m_edit->GainingFocusSignal, TypingSignal); GG::Connect(m_edit->LosingFocusSignal, DoneTypingSignal); m_history.push_front(""); DoLayout(); }
CUIChangeWeather::CUIChangeWeather(){ bkgrnd = xr_new<CUIStatic>(); bkgrnd->SetAutoDelete(true); AttachChild(bkgrnd); header = xr_new<CUITextWnd>(); header->SetAutoDelete(true); AttachChild(header); btn_cancel = xr_new<CUI3tButton>(); btn_cancel->SetAutoDelete(true); AttachChild(btn_cancel); for (int i = 0; i<4; i++) { btn[i] = xr_new<CUI3tButton>(); btn[i]->SetAutoDelete(true); AttachChild(btn[i]); m_data[i].m_text = xr_new<CUITextWnd>(); m_data[i].m_text->SetAutoDelete(true); AttachChild(m_data[i].m_text); } weather_counter = 0; }
//////////////////// // MessageWnd // //////////////////// MessageWnd::MessageWnd(const std::string& config_name) : CUIWnd(UserString("MESSAGES_PANEL_TITLE"), GG::INTERACTIVE | GG::DRAGABLE | GG::ONTOP | GG::RESIZABLE | CLOSABLE | PINABLE, config_name), m_display(nullptr), m_edit(nullptr), m_display_show_time(0), m_history(), m_history_position() { m_display = new CUIMultiEdit("", GG::MULTI_WORDBREAK | GG::MULTI_READ_ONLY | GG::MULTI_TERMINAL_STYLE | GG::MULTI_INTEGRAL_HEIGHT); AttachChild(m_display); m_display->SetMaxLinesOfHistory(100); // executing this line seems to cause crashes in MultiEdit when adding more lines to the control than the history limit m_edit = new MessageWndEdit(); AttachChild(m_edit); m_edit->TextEnteredSignal.connect( boost::bind(&MessageWnd::MessageEntered, this)); m_edit->UpPressedSignal.connect( boost::bind(&MessageWnd::MessageHistoryUpRequested, this)); m_edit->DownPressedSignal.connect( boost::bind(&MessageWnd::MessageHistoryDownRequested, this)); m_edit->GainingFocusSignal.connect( TypingSignal); m_edit->LosingFocusSignal.connect( DoneTypingSignal); m_history.push_front(""); DoLayout(); }
void GraphicalSummaryWnd::GenerateGraph() { DeleteSideBars(); m_sizer.reset(new BarSizer(m_summaries, ClientSize())); for (std::map<int, CombatSummary>::iterator it = m_summaries.begin(); it != m_summaries.end(); ++it) { if (it->second.total_max_health > EPSILON) { it->second.Sort(); SideBar* box = new SideBar(it->second, *m_sizer); m_side_boxes.push_back(box); AttachChild(box); } } if (m_options_bar) { DebugLogger() << "GraphicalSummaryWnd::GenerateGraph(): m_options_bar " "already exists, calling DeleteChild(m_options_bar) " "before creating a new one."; DeleteChild(m_options_bar); } m_options_bar = new OptionsBar(m_sizer); AttachChild(m_options_bar); GG::Connect(m_options_bar->ChangedSignal, &GraphicalSummaryWnd::HandleButtonChanged, this); MinSizeChangedSignal(); DoLayout(); }
void ModeratorActionsWnd::CreatePlanetClicked() { m_selected_action = MAS_CreatePlanet; CreatePlanetActionSelectedSignal(SelectedPlanetType()); DetachChild(m_star_type_drop); AttachChild(m_planet_type_drop); AttachChild(m_planet_size_drop); DetachChild(m_empire_drop); }
CUIMoneyIndicator::CUIMoneyIndicator(){ AttachChild(&m_back); AttachChild(&m_money_amount); AttachChild(&m_money_change); m_pBonusMoney = new CUIGameLog(); AttachChild(m_pBonusMoney); m_pAnimChange = new CUIColorAnimatorWrapper("ui_mp_chat"); m_pAnimChange->Cyclic(false); m_pAnimChange->SetDone(true); }
void CUILogsWnd::Init() { m_uiXml.Load( CONFIG_PATH, UI_PATH, PDA_LOGS_XML ); CUIXmlInit::InitWindow( m_uiXml, "main_wnd", 0, this ); m_background = UIHelper::CreateFrameLine( m_uiXml, "background", this ); m_actor_ch_info = new CUICharacterInfo(); m_actor_ch_info->SetAutoDelete( true ); AttachChild( m_actor_ch_info ); m_actor_ch_info->InitCharacterInfo( &m_uiXml, "actor_ch_info" ); m_center_background = UIHelper::CreateStatic( m_uiXml, "center_background", this ); m_center_caption = UIHelper::CreateStatic( m_uiXml, "center_caption", this ); string256 buf; strcpy_s( buf, sizeof(buf), m_center_caption->GetText() ); strcat_s( buf, sizeof(buf), CStringTable().translate("ui_logs_center_caption").c_str() ); m_center_caption->SetText( buf ); m_list = new CUIScrollView(); m_list->SetAutoDelete( true ); AttachChild( m_list ); CUIXmlInit::InitScrollView( m_uiXml, "logs_list", 0, m_list ); // m_list->SetWindowName("---logs_list"); // m_logs_list->m_sort_function = fastdelegate::MakeDelegate( this, &CUIRankingWnd::SortingLessFunction ); m_filter_news = UIHelper::CreateCheck( m_uiXml, "filter_news", this ); m_filter_talk = UIHelper::CreateCheck( m_uiXml, "filter_talk", this ); m_filter_news->SetCheck( true ); m_filter_talk->SetCheck( true ); m_date_caption = UIHelper::CreateStatic( m_uiXml, "date_caption", this ); m_date = UIHelper::CreateStatic( m_uiXml, "date", this ); m_period_caption = UIHelper::CreateStatic( m_uiXml, "period_caption", this ); m_period = UIHelper::CreateStatic( m_uiXml, "period", this ); m_prev_period = UIHelper::Create3tButtonEx( m_uiXml, "btn_prev_period", this ); m_next_period = UIHelper::Create3tButtonEx( m_uiXml, "btn_next_period", this ); Register( m_filter_news ); Register( m_filter_talk ); Register( m_prev_period ); Register( m_next_period ); AddCallback( m_filter_news->WindowName(), BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::UpdateChecks ) ); AddCallback( m_filter_talk->WindowName(), BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::UpdateChecks ) ); AddCallback( m_prev_period->WindowName(), BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::PrevPeriod ) ); AddCallback( m_next_period->WindowName(), BUTTON_CLICKED, CUIWndCallback::void_function( this, &CUILogsWnd::NextPeriod ) ); m_start_game_time = Level().GetStartGameTime(); m_start_game_time = GetShiftPeriod( m_start_game_time, 0 ); }
CUIChangeMap::CUIChangeMap() { m_prev_upd_time = 0; bkgrnd = xr_new<CUIStatic>(); bkgrnd->SetAutoDelete(true); AttachChild(bkgrnd); header = xr_new<CUIStatic>(); header->SetAutoDelete(true); AttachChild(header); map_pic = xr_new<CUIStatic>(); map_pic->SetAutoDelete(true); AttachChild(map_pic); map_frame = xr_new<CUIStatic>(); map_frame->SetAutoDelete(true); AttachChild(map_frame); frame = xr_new<CUIFrameWindow>(); frame->SetAutoDelete(true); AttachChild(frame); lst_back = xr_new<CUIFrameWindow>(); lst_back->SetAutoDelete(true); AttachChild(lst_back); lst = xr_new<CUIListBox>(); lst->SetAutoDelete(true); AttachChild(lst); btn_ok = xr_new<CUI3tButton>(); btn_ok->SetAutoDelete(true); AttachChild(btn_ok); btn_cancel = xr_new<CUI3tButton>(); btn_cancel->SetAutoDelete(true); AttachChild(btn_cancel); selected_item = u32(-1); }
void CUIMessagesWindow::Init(float x, float y, float width, float height) { CUIXml xml; xml.Load (CONFIG_PATH, UI_PATH, "messages_window.xml"); m_pGameLog = xr_new<CUIGameLog>(); m_pGameLog->SetAutoDelete (true); m_pGameLog->Show (true); AttachChild (m_pGameLog); if ( IsGameTypeSingle() ) { CUIXmlInit::InitScrollView (xml, "sp_log_list", 0, m_pGameLog); } else { u32 color; CGameFont* pFont; m_pChatLog = xr_new<CUIGameLog>(); m_pChatLog->SetAutoDelete (true); m_pChatLog->Show (true); AttachChild (m_pChatLog); m_pChatWnd = xr_new<CUIChatWnd>(); m_pChatWnd->SetAutoDelete (true); AttachChild (m_pChatWnd); CUIXmlInit::InitScrollView (xml, "mp_log_list", 0, m_pGameLog); CUIXmlInit::InitFont (xml, "mp_log_list:font", 0, color, pFont); m_pGameLog->SetTextAtrib (pFont, color); CUIXmlInit::InitScrollView (xml, "chat_log_list", 0, m_pChatLog); m_inprogress_chat_log_rect = m_pChatLog->GetWndRect(); m_in_pending_mode = false; XML_NODE* pending_chat_list = xml.NavigateToNode(CHAT_LOG_LIST_PENDING); if (pending_chat_list) { m_pending_chat_log_rect.x1 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "x"); m_pending_chat_log_rect.y1 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "y"); m_pending_chat_log_rect.x2 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "width"); m_pending_chat_log_rect.y2 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "height"); m_pending_chat_log_rect.rb.add (m_pending_chat_log_rect.lt); }else m_pending_chat_log_rect = m_inprogress_chat_log_rect; CUIXmlInit::InitFont (xml, "chat_log_list:font", 0, color, pFont); m_pChatLog->SetTextAtrib (pFont, color); m_pChatWnd->Init (xml); } }
void ResourcePanel::DoLayout() { AccordionPanel::DoLayout(); for (std::vector<std::pair<MeterType, StatisticIcon*> >::iterator it = m_meter_stats.begin(); it != m_meter_stats.end(); ++it) { DetachChild(it->second); } // detach / hide meter bars and large resource indicators DetachChild(m_multi_meter_status_bar); DetachChild(m_multi_icon_value_indicator); // update size of panel and position and visibility of widgets if (!s_expanded_map[m_rescenter_id]) { // position and reattach icons to be shown int n = 0; for (std::vector<std::pair<MeterType, StatisticIcon*> >::iterator it = m_meter_stats.begin(); it != m_meter_stats.end(); ++it) { GG::X x = MeterIconSize().x*n*7/2; if (x > Width() - m_expand_button->Width() - MeterIconSize().x*5/2) break; // ensure icon doesn't extend past right edge of panel StatisticIcon* icon = it->second; AttachChild(icon); GG::Pt icon_ul(x, GG::Y0); GG::Pt icon_lr = icon_ul + MeterIconSize(); icon->SizeMove(icon_ul, icon_lr); icon->Show(); n++; } Resize(GG::Pt(Width(), std::max(MeterIconSize().y, m_expand_button->Height()))); } else { // attach and show meter bars and large resource indicators GG::Y top = GG::Y0; AttachChild(m_multi_icon_value_indicator); m_multi_icon_value_indicator->MoveTo(GG::Pt(GG::X(EDGE_PAD), top)); m_multi_icon_value_indicator->Resize(GG::Pt(Width() - 2*EDGE_PAD, m_multi_icon_value_indicator->Height())); top += m_multi_icon_value_indicator->Height() + EDGE_PAD; AttachChild(m_multi_meter_status_bar); m_multi_meter_status_bar->MoveTo(GG::Pt(GG::X(EDGE_PAD), top)); m_multi_meter_status_bar->Resize(GG::Pt(Width() - 2*EDGE_PAD, m_multi_meter_status_bar->Height())); top += m_multi_icon_value_indicator->Height() + EDGE_PAD; MoveChildUp(m_expand_button); Resize(GG::Pt(Width(), top)); } m_expand_button->MoveTo(GG::Pt(Width() - m_expand_button->Width(), GG::Y0)); SetCollapsed(!s_expanded_map[m_rescenter_id]); }
void CUIPdaWnd::Init() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, PDA_XML); m_pActiveDialog = NULL; m_sActiveSection = ""; CUIXmlInit::InitWindow (uiXml, "main", 0, this); UIMainPdaFrame = UIHelper::CreateStatic( uiXml, "background_static", this ); m_caption = UIHelper::CreateStatic( uiXml, "caption_static", this ); m_caption_const._set ( m_caption->GetText() ); m_anim_static = new CUIAnimatedStatic(); AttachChild (m_anim_static); m_anim_static->SetAutoDelete(true); CUIXmlInit::InitAnimatedStatic(uiXml, "anim_static", 0, m_anim_static); m_btn_close = UIHelper::Create3tButtonEx( uiXml, "close_button", this ); m_hint_wnd = UIHelper::CreateHint( uiXml, "hint_wnd" ); // m_btn_close->set_hint_wnd( m_hint_wnd ); if ( IsGameTypeSingle() ) { pUITaskWnd = new CUITaskWnd(); pUITaskWnd->hint_wnd = m_hint_wnd; pUITaskWnd->Init (); pUIFactionWarWnd = new CUIFactionWarWnd(); pUIFactionWarWnd->hint_wnd = m_hint_wnd; pUIFactionWarWnd->Init (); pUIRankingWnd = new CUIRankingWnd(); pUIRankingWnd->Init (); pUILogsWnd = new CUILogsWnd(); pUILogsWnd->Init (); } UITabControl = new CUITabControl(); UITabControl->SetAutoDelete (true); AttachChild (UITabControl); CUIXmlInit::InitTabControl (uiXml, "tab", 0, UITabControl); UITabControl->SetMessageTarget (this); UINoice = new CUIStatic(); UINoice->SetAutoDelete ( true ); CUIXmlInit::InitStatic ( uiXml, "noice_static", 0, UINoice ); RearrangeTabButtons (UITabControl); }
ButtonListDialog::ButtonListDialog() { Background = xr_new<CUIStatic>(); Background->SetAutoDelete(true); AttachChild(Background); Header = xr_new<CUITextWnd>(); Header->SetAutoDelete(true); AttachChild(Header); CancelButton = xr_new<CUI3tButton>(); CancelButton->SetAutoDelete(true); AttachChild(CancelButton); }
void ResourcePanel::DoLayout() { AccordionPanel::DoLayout(); for (auto& meter_stat : m_meter_stats) { DetachChild(meter_stat.second); } // detach / hide meter bars and large resource indicators DetachChild(m_multi_meter_status_bar); DetachChild(m_multi_icon_value_indicator); // update size of panel and position and visibility of widgets if (!s_expanded_map[m_rescenter_id]) { // position and reattach icons to be shown int n = 0; GG::X stride = MeterIconSize().x * 7/2; for (auto& meter_stat : m_meter_stats) { GG::X x = n * stride; auto& icon = meter_stat.second; GG::Pt icon_ul(x, GG::Y0); GG::Pt icon_lr = icon_ul + MeterIconSize(); icon->SizeMove(icon_ul, icon_lr); if (x + icon->MinUsableSize().x >= ClientWidth()) break; AttachChild(icon); icon->Show(); n++; } Resize(GG::Pt(Width(), std::max(MeterIconSize().y, m_expand_button->Height()))); } else { // attach and show meter bars and large resource indicators GG::Y top = Top(); AttachChild(m_multi_icon_value_indicator); m_multi_icon_value_indicator->MoveTo(GG::Pt(GG::X(EDGE_PAD), GG::Y(EDGE_PAD))); m_multi_icon_value_indicator->Resize(GG::Pt(Width() - 2*EDGE_PAD, m_multi_icon_value_indicator->Height())); AttachChild(m_multi_meter_status_bar); m_multi_meter_status_bar->MoveTo(GG::Pt(GG::X(EDGE_PAD), m_multi_icon_value_indicator->Bottom() + EDGE_PAD - top)); m_multi_meter_status_bar->Resize(GG::Pt(Width() - 2*EDGE_PAD, m_multi_meter_status_bar->Height())); MoveChildUp(m_expand_button); Resize(GG::Pt(Width(), m_multi_meter_status_bar->Bottom() + EDGE_PAD - top)); } SetCollapsed(!s_expanded_map[m_rescenter_id]); }