//////////////////// // 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(); }
/** * 設定画面のコンストラクタ */ SettingDialog::SettingDialog(wxWindow* parent, int id, const wxString& title) :wxDialog(parent, id, title) { bottomPanel = new wxPanel(this, wxID_ANY); splitterWindow = new wxSplitterWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3D|wxSP_BORDER); // 左側のツリー部分 treePanel = new wxPanel(splitterWindow, wxID_ANY); settingTreeCtrl = new wxTreeCtrl(treePanel, ID_SettingPanelTree, wxDefaultPosition, wxDefaultSize, wxTR_HIDE_ROOT|wxTR_HAS_BUTTONS|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER); // 右側の設定画面部分 settingPanel = new wxPanel(splitterWindow, wxID_ANY); spacePanel = new wxPanel(bottomPanel, wxID_ANY); // OK,キャンセルボタン okButton = new wxButton(bottomPanel, ID_OnOkSetting, wxT("OK")); cancelButton = new wxButton(bottomPanel, ID_OnCancelSetting, wxT("キャンセル")); SetProperties(); DoLayout(); // 初回は通信パネルを開く #ifndef __WXMAC__ wxBoxSizer* vbox = new wxBoxSizer(wxVERTICAL); vbox->Add(new NetworkSettingPanel(settingPanel)); settingPanel->SetSizer(vbox); #else // メインスレッドに更新してもらう SendUIUpdateEvent(); #endif this->SetTitle(wxT("設定 - 通信")); }
//////////////////////////////////////////// // 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); }
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)); }
/** * @brief Set the whitespace around the content. * * @param pixels The number of pixels to reserve for empty space around the content. * @return void */ void SetPadding(int pixels) { if (m_padding != pixels) { m_padding = pixels; DoLayout(); } }
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(); }
//////////////////// // 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(); }
OptionsBar(boost::scoped_ptr<BarSizer>& sizer) : GG::Wnd(), m_sizer(sizer) { m_toggles.push_back(new ToggleData(UserString("COMBAT_SUMMARY_PARTICIPANT_RELATIVE"), UserString("COMBAT_SUMMARY_PARTICIPANT_EQUAL"), UserString("COMBAT_SUMMARY_PARTICIPANT_RELATIVE_TIP"), UserString("COMBAT_SUMMARY_PARTICIPANT_EQUAL_TIP"), TOGGLE_BAR_WIDTH_PROPORTIONAL, &m_sizer, this)); m_toggles.push_back(new ToggleData(UserString("COMBAT_SUMMARY_HEALTH_SMOOTH"), UserString("COMBAT_SUMMARY_HEALTH_BAR"), UserString("COMBAT_SUMMARY_HEALTH_SMOOTH_TIP"), UserString("COMBAT_SUMMARY_HEALTH_BAR_TIP"), TOGGLE_BAR_HEALTH_SMOOTH, &m_sizer, this)); m_toggles.push_back(new ToggleData(UserString("COMBAT_SUMMARY_BAR_HEIGHT_PROPORTIONAL"), UserString("COMBAT_SUMMARY_BAR_HEIGHT_EQUAL"), UserString("COMBAT_SUMMARY_BAR_HEIGHT_PROPORTIONAL_TIP"), UserString("COMBAT_SUMMARY_BAR_HEIGHT_EQUAL_TIP"), TOGGLE_BAR_HEIGHT_PROPORTIONAL, &m_sizer, this)); m_toggles.push_back(new ToggleData(UserString("COMBAT_SUMMARY_GRAPH_HEIGHT_PROPORTIONAL"), UserString("COMBAT_SUMMARY_GRAPH_HEIGHT_EQUAL"), UserString("COMBAT_SUMMARY_GRAPH_HEIGHT_PROPORTIONAL_TIP"), UserString("COMBAT_SUMMARY_GRAPH_HEIGHT_EQUAL_TIP"), TOGGLE_GRAPH_HEIGHT_PROPORTIONAL, &m_sizer, this)); DoLayout(); }
////////////////////////////////////////////////// // 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(); }
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(); }
OP_STATUS OpSpeedDialView::CreateThumbnail(const DesktopSpeedDial& entry, bool animate) { typedef QuickAnimatedWidget<SpeedDialThumbnail> QuickSpeedDialThumbnail; OpAutoPtr<QuickSpeedDialThumbnail> quick_thumbnail(OP_NEW(QuickSpeedDialThumbnail, ())); RETURN_OOM_IF_NULL(quick_thumbnail.get()); RETURN_IF_ERROR(quick_thumbnail->Init()); SpeedDialThumbnail* thumbnail = quick_thumbnail->GetOpWidget(); RETURN_IF_ERROR(thumbnail->SetEntry(&entry)); thumbnail->SetLocked(IsReadOnly()); const int pos = g_speeddial_manager->FindSpeedDial(&entry); if (pos < 0 || pos > (int)m_thumbnails.GetCount()) { OP_ASSERT(!"Out of sync with SpeedDialManager"); return OpStatus::ERR; } RETURN_IF_ERROR(m_thumbnails.Insert(pos, thumbnail)); quick_thumbnail->SetListener(m_thumbnail_flow); RETURN_IF_ERROR(m_thumbnail_flow->InsertWidget(quick_thumbnail.release(), pos)); SetCellSize(pos); if (animate) { DoLayout(); // must do the layout explicitly first, before we do the following animation m_thumbnails.Get(pos)->AnimateThumbnailIn(); } return OpStatus::OK; }
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 MCPrinter::LayoutCardSequence(MCStack *p_stack, uint32_t p_number_cards, const MCRectangle *p_src_rect) { Open(); if (m_loop_nesting > 0 && m_loop_status == STATUS_READY) { MCCard *t_current_card; t_current_card = p_stack -> getcurcard(); MCRectangle t_src_rect; if (p_src_rect == NULL) { t_src_rect = t_current_card -> getrect(); t_src_rect . y += MCdefaultstackptr -> getscroll(); t_src_rect . height -= MCdefaultstackptr -> getscroll(); } else t_src_rect = *p_src_rect; // Do the layout, passing false to layout all cards, not just marked ones. DoLayout(t_current_card, p_number_cards, t_src_rect, false); } // Close printing (sets the result). Close(); }
///////////////////// // PlayerListWnd // ///////////////////// PlayerListWnd::PlayerListWnd(const std::string& config_name) : CUIWnd(UserString("PLAYERS_LIST_PANEL_TITLE"), GG::INTERACTIVE | GG::DRAGABLE | GG::ONTOP | GG::RESIZABLE | CLOSABLE | PINABLE, config_name), m_player_list(nullptr) { m_player_list = new PlayerListBox(); m_player_list->SetHiliteColor(GG::CLR_ZERO); m_player_list->SetStyle(GG::LIST_NOSORT); m_player_list->SelRowsChangedSignal.connect( boost::bind(&PlayerListWnd::PlayerSelectionChanged, this, _1)); m_player_list->DoubleClickedRowSignal.connect( boost::bind(&PlayerListWnd::PlayerDoubleClicked, this, _1, _2, _3)); m_player_list->RightClickedRowSignal.connect( boost::bind(&PlayerListWnd::PlayerRightClicked, this, _1, _2, _3)); AttachChild(m_player_list); Empires().DiplomaticStatusChangedSignal.connect( boost::bind(&PlayerListWnd::Update, this)); Empires().DiplomaticMessageChangedSignal.connect( boost::bind(&PlayerListWnd::Update, this)); DoLayout(); Refresh(); }
void AccordionPanel::SizeMove(const GG::Pt& ul, const GG::Pt& lr) { GG::Pt old_size = GG::Wnd::Size(); GG::Wnd::SizeMove(ul, lr); if (old_size != GG::Wnd::Size()) DoLayout(); }
void OnSize(wxSizeEvent &inEvent) { inEvent.Skip(); wxSize size = GetClientSize(); DoLayout(size,size.y!=mPrevHeight); mPrevHeight = size.y; ApplyLayout(); }
void Realize() { wxSize min_size; wxSize size(1,1); // layout vertically DoLayout(size,true); min_size.x = size.x; // layout horizontally size = wxSize(1,1); DoLayout(size,false); min_size.y = size.y; ApplyLayout(); SetSize(size); SetMinSize(min_size); }
void BuildingIndicator::SizeMove(const GG::Pt& ul, const GG::Pt& lr) { GG::Pt old_size = Size(); GG::Wnd::SizeMove(ul, lr); if (old_size != Size()) DoLayout(); }
void ModeratorActionsWnd::SizeMove(const GG::Pt& ul, const GG::Pt& lr) { GG::Pt old_size = GG::Wnd::Size(); CUIWnd::SizeMove(ul, lr); if (old_size != GG::Wnd::Size()) DoLayout(); }
void BaseTabStrip::Layout() { // Only do a layout if our size changed. if(last_layout_size_ == size()) { return; } DoLayout(); }
static void ChangeManaged(Widget wid) { XmGrabShellWidget gs = (XmGrabShellWidget)wid; ShellWidget shell = (ShellWidget)wid; Dimension bw = 0; XtWidgetGeometry pref, mygeom, replygeom; XtGeometryResult result; Widget child; mygeom.request_mode = 0; if (gs->composite.num_children) { child = gs->composite.children[0]; if (XtIsManaged(child)) { /* Get child's preferred size */ result = XtQueryGeometry(child, NULL, &pref); /* Take whatever they want */ if (pref.request_mode & CWWidth) { mygeom.width = pref.width; mygeom.request_mode |= CWWidth; } if (pref.request_mode & CWHeight) { mygeom.height = pref.height; mygeom.request_mode |= CWHeight; } if (pref.request_mode & CWBorderWidth) bw = pref.border_width; else bw = child->core.border_width; } } mygeom.width += 2*bw + 2*gs->grab_shell.shadow_thickness; mygeom.height += 2*bw + 2*gs->grab_shell.shadow_thickness; result = XtMakeGeometryRequest((Widget)shell, &mygeom, &replygeom); switch (result) { case XtGeometryAlmost: XtMakeGeometryRequest((Widget)shell, &replygeom, NULL); /* fall through. */ case XtGeometryYes: DoLayout(wid); break; case XtGeometryNo: case XtGeometryDone: break; } }
void SizeMove(Pt ul, Pt lr) { Pt original_size = m_owner->Size(); m_owner->Control::SizeMove(ul, lr); // Redo layout if necessary. if (m_owner->Size() != original_size) { DoLayout(); } }
void GraphControl::SetRange(double x1, double x2, double y1, double y2) { if (m_x_min != x1 || m_y_min != y1 || m_x_max != x2 || m_y_max != y2) { m_x_min = x1; m_y_min = y1; m_x_max = x2; m_y_max = y2; DoLayout(); } }
//---------------------------------------------------------------- CommandDialog::CommandDialog(wxWindow* parent, int id, const wxString& title, wxPoint pos, wxSize size, int style) : wxDialog(parent, id, title, pos, size, style) /** * \brief Constructor, initializes the CommandDialog object. **/ { InitializeUI(); DoLayout(); }
void Init(int empire_id) { m_queue_lb = new ProdQueueListBox(); m_queue_lb->SetStyle(GG::LIST_NOSORT | GG::LIST_NOSEL | GG::LIST_USERDELETE); m_queue_lb->SetName("ProductionQueue ListBox"); SetEmpire(empire_id); AttachChild(m_queue_lb); DoLayout(); }
void SitRepPanel::SizeMove(const GG::Pt& ul, const GG::Pt& lr) { GG::Pt old_size = GG::Wnd::Size(); CUIWnd::SizeMove(ul, lr); if (old_size != GG::Wnd::Size()) { DoLayout(); Update(); } }
bool TextWidget::on_configure_event(GdkEventConfigure* event) { trans = Planed::Transition(Rect(0, 0, event->width, event->height), absSz); Rect plc = RelPos(GetTextObj(), trans); //trans = Planed::Transition(plc, txtPlc.Size()); trans.SetShift(plc.A()); DoLayout(); return true; }
bool nuiLayout::SetRect(const nuiRect& rRect) { nuiWidget::SetRect(rRect); //NGL_OUT("nuiLayout::SetRect(%s)\n", rRect.GetValue().GetChars()); nuiRect r(rRect.Size()); DoLayout(r); return true; }
void MakeBars() { for(CombatSummary::UnitSummaries::const_iterator it = m_side_summary.unit_summaries.begin(); it != m_side_summary.unit_summaries.end(); ++it) { if((*it)->max_health > 0) { m_participant_bars.push_back(new ParticipantBar(**it, m_sizer)); AttachChild(m_participant_bars.back()); } } DoLayout(); }
void wxFrameBase::SetStatusBar(wxStatusBar *statBar) { bool hadBar = m_frameStatusBar != NULL; m_frameStatusBar = statBar; if ( (m_frameStatusBar != NULL) != hadBar ) { PositionStatusBar(); DoLayout(); } }