//////////////////////////////////////////// // 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_end_with_done(false) { m_done_btn = new CUIButton(UserString("DONE"), GG::X(400), GG::Y(440), GG::X(75)); m_license = new CUIButton(UserString("LICENSE"), GG::X(310), GG::Y(440), GG::X(75)); m_vision = new CUIButton(UserString("VISION"), GG::X(220), GG::Y(440), GG::X(75)); m_info = new CUIMultiEdit(GG::X(20), GG::Y(20), GG::X(550), GG::Y(400), UserString("FREEORION_VISION"), GG::MULTI_WORDBREAK | GG::MULTI_READ_ONLY, ClientUI::GetFont(), ClientUI::CtrlBorderColor(), ClientUI::TextColor(), ClientUI::CtrlColor(), GG::INTERACTIVE); GG::Layout* layout = new GG::Layout(GG::X0, GG::Y0, ClientWidth(), ClientHeight(), 2, 6, 5); layout->SetMinimumRowHeight(1, m_license->Height() + 5); layout->SetRowStretch(0, 1); layout->Add(m_info, 0, 0, 1, 6); layout->Add(m_vision, 1, 3); layout->Add(m_license, 1, 4); layout->Add(m_done_btn, 1, 5); AttachChild(layout); // 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(); Init(); }
platform_display_type insert<tab_group_t>(display_t& display, platform_display_type& parent, tab_group_t& element) { assert (!element.control_m); // This probably looks odd. The interface of tab groups in Eve is wildly // different from that of GG's TabWnd. The most expedient way to get all // the Wnds in the right styles and still match the Eve interface was to // replace the built-in TabBar inside of TabWnd with one created here. boost::shared_ptr<GG::StyleFactory> style = GG::GUI::GetGUI()->GetStyleFactory(); element.tab_bar_m = style->NewTabBar(GG::X0, GG::Y0, GG::X(100), style->DefaultFont(), element.color_m, element.text_color_m, element.style_m); element.tab_bar_m->SetMinSize(GG::Pt(element.tab_bar_m->MinSize().x, element.tab_bar_m->Height())); element.control_m = style->NewTabWnd(GG::X0, GG::Y0, GG::X(100), element.tab_bar_m->Height() + 20, style->DefaultFont(), element.color_m, element.text_color_m, element.style_m); GG::Layout* layout = element.control_m->DetachLayout(); delete layout; layout = new GG::Layout(GG::X0, GG::Y0, element.control_m->Width(), element.control_m->Height(), 2, 1); layout->SetRowStretch(1, 1.0); layout->Add(element.tab_bar_m, 0, 0); layout->Add(new Placeholder, 1, 0); element.control_m->SetLayout(layout); GG::Connect(element.tab_bar_m->TabChangedSignal, boost::bind(&tab_changed, boost::ref(element), _1)); for (tab_group_t::tab_set_t::iterator first(element.items_m.begin()), last(element.items_m.end()); first != last; ++first) { element.tab_bar_m->AddTab(first->name_m); } element.color_proxy_m.initialize( boost::bind(&GG::TabBar::SetColor, element.tab_bar_m, _1) ); element.text_color_proxy_m.initialize( boost::bind(&GG::TabBar::SetTextColor, element.tab_bar_m, _1) ); return display.insert(parent, element.control_m); }
ServerConnectWnd::ServerConnectWnd() : CUIWnd(UserString("SCONNECT_WINDOW_TITLE"), (GG::GUI::GetGUI()->AppWidth() - WINDOW_WIDTH) / 2, (GG::GUI::GetGUI()->AppHeight() - WINDOW_HEIGHT) / 2, WINDOW_WIDTH, WINDOW_HEIGHT, GG::INTERACTIVE | GG::MODAL), m_host_or_join_radio_group(0), m_LAN_game_label(0), m_servers_lb(0), m_find_LAN_servers_bn(0), m_internet_game_label(0), m_IP_address_edit(0), m_player_name_edit(0), m_ok_bn(0), m_cancel_bn(0) { Sound::TempUISoundDisabler sound_disabler; boost::shared_ptr<GG::Font> font = ClientUI::GetFont(); GG::TextControl* player_name_label = new GG::TextControl(GG::X0, GG::Y0, GG::X1, GG::Y1, UserString("PLAYER_NAME_LABEL"), font, ClientUI::TextColor(), GG::FORMAT_LEFT); m_player_name_edit = new CUIEdit(GG::X0, GG::Y0, GG::X1, GetOptionsDB().Get<std::string>("multiplayersetup.player-name")); m_host_or_join_radio_group = new GG::RadioButtonGroup(GG::X0, GG::Y0, GG::X1, GG::Y1, GG::VERTICAL); m_host_or_join_radio_group->AddButton(new CUIStateButton(UserString("HOST_GAME_BN"), GG::X0, GG::Y0, GG::X1, GG::Y1, GG::FORMAT_LEFT, GG::SBSTYLE_3D_RADIO)); m_host_or_join_radio_group->AddButton(new CUIStateButton(UserString("JOIN_GAME_BN"), GG::X0, GG::Y0, GG::X1, GG::Y1, GG::FORMAT_LEFT, GG::SBSTYLE_3D_RADIO)); m_LAN_game_label = new GG::TextControl(GG::X0, GG::Y0, UserString("LAN_GAME_LABEL"), font, ClientUI::TextColor(), GG::FORMAT_LEFT); m_servers_lb = new CUIListBox(GG::X0, GG::Y0, GG::X1, GG::Y1); m_servers_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_SINGLESEL); m_find_LAN_servers_bn = new CUIButton(UserString("REFRESH_LIST_BN")); m_internet_game_label = new GG::TextControl(GG::X0, GG::Y0, UserString("INTERNET_GAME_LABEL"), font, ClientUI::TextColor(), GG::FORMAT_LEFT); m_IP_address_edit = new CUIEdit(GG::X0, GG::Y0, GG::X1, GetOptionsDB().Get<std::string>("multiplayersetup.host-address")); m_ok_bn = new CUIButton(UserString("OK")); m_cancel_bn = new CUIButton(UserString("CANCEL")); const GG::X OK_CANCEL_BUTTON_WIDTH(80); const int CONTROL_MARGIN = 5; GG::Layout* layout = new GG::Layout(GG::X0, GG::Y0, GG::X1, GG::Y1, 8, 4, CONTROL_MARGIN); layout->SetMinimumColumnWidth(0, player_name_label->MinUsableSize().x + CONTROL_MARGIN); layout->SetColumnStretch(1, 1.0); layout->SetMinimumColumnWidth(2, OK_CANCEL_BUTTON_WIDTH + CONTROL_MARGIN); layout->SetMinimumColumnWidth(3, OK_CANCEL_BUTTON_WIDTH + CONTROL_MARGIN); layout->SetMinimumRowHeight(0, m_player_name_edit->Height() + CONTROL_MARGIN); layout->SetMinimumRowHeight(1, m_host_or_join_radio_group->MinUsableSize().y); layout->SetMinimumRowHeight(2, m_LAN_game_label->Height() + (2 * CONTROL_MARGIN)); layout->SetRowStretch(3, 1.0); layout->SetMinimumRowHeight(4, m_find_LAN_servers_bn->Height() + CONTROL_MARGIN); layout->SetMinimumRowHeight(5, m_internet_game_label->Height() + CONTROL_MARGIN); layout->SetMinimumRowHeight(6, m_IP_address_edit->Height() + CONTROL_MARGIN); layout->SetMinimumRowHeight(7, m_ok_bn->Height() + CONTROL_MARGIN); layout->Add(player_name_label, 0, 0, 1, 1, GG::ALIGN_VCENTER); layout->Add(m_player_name_edit, 0, 1, 1, 3, GG::ALIGN_VCENTER); layout->Add(m_host_or_join_radio_group, 1, 0, 1, 4); layout->Add(m_LAN_game_label, 2, 0, 1, 4, GG::ALIGN_BOTTOM); layout->Add(m_servers_lb, 3, 0, 1, 4); layout->Add(m_find_LAN_servers_bn, 4, 3); layout->Add(m_internet_game_label, 5, 0, 1, 4); layout->Add(m_IP_address_edit, 6, 0, 1, 4); layout->Add(m_ok_bn, 7, 2); layout->Add(m_cancel_bn, 7, 3); SetLayout(layout); m_LAN_servers = HumanClientApp::GetApp()->Networking().DiscoverLANServers(); Init(); }