From: <geo...@us...> - 2014-07-26 10:36:17
|
Revision: 7296 http://sourceforge.net/p/freeorion/code/7296 Author: geoffthemedio Date: 2014-07-26 10:36:13 +0000 (Sat, 26 Jul 2014) Log Message: ----------- Added code to set size of hulls list column to 0 so that it will properly resize when the enclosing window is resized (avoids commonly occurring issue with GG::ListBox where the initial column widths become the minimum to which contained controls will be resized). Modified Paths: -------------- trunk/FreeOrion/UI/DesignWnd.cpp Modified: trunk/FreeOrion/UI/DesignWnd.cpp =================================================================== --- trunk/FreeOrion/UI/DesignWnd.cpp 2014-07-25 10:16:32 UTC (rev 7295) +++ trunk/FreeOrion/UI/DesignWnd.cpp 2014-07-26 10:36:13 UTC (rev 7296) @@ -939,14 +939,15 @@ mutable boost::signals2::signal<void (const ShipDesign*)> DesignRightClickedSignal; private: - void BaseDoubleClicked(GG::ListBox::iterator it); - void BaseLeftClicked(GG::ListBox::iterator it, const GG::Pt& pt); - void BaseRightClicked(GG::ListBox::iterator it, const GG::Pt& pt); + void BaseDoubleClicked(GG::ListBox::iterator it); + void BaseLeftClicked(GG::ListBox::iterator it, const GG::Pt& pt); + void BaseRightClicked(GG::ListBox::iterator it, const GG::Pt& pt); - GG::Pt ListRowSize(); + GG::Pt ListRowSize(); + void InitRowSizes(); - void PopulateWithEmptyHulls(); - void PopulateWithCompletedDesigns(); + void PopulateWithEmptyHulls(); + void PopulateWithCompletedDesigns(); int m_empire_id_shown; std::pair<bool, bool> m_availabilities_shown; // first indicates whether available parts should be shown. second indicates whether unavailable parts should be shown @@ -1068,6 +1069,8 @@ m_showing_empty_hulls(false), m_showing_completed_designs(false) { + InitRowSizes(); + GG::Connect(DoubleClickedSignal, &BasesListBox::BaseDoubleClicked, this); GG::Connect(LeftClickedSignal, &BasesListBox::BaseLeftClicked, this); GG::Connect(RightClickedSignal, &BasesListBox::BaseRightClicked, this); @@ -1118,6 +1121,14 @@ GG::Pt BasesListBox::ListRowSize() { return GG::Pt(Width() - ClientUI::ScrollWidth() - 5, BASES_LIST_BOX_ROW_HEIGHT); } +void BasesListBox::InitRowSizes() { + // preinitialize listbox/row column widths, because what + // ListBox::Insert does on default is not suitable for this case + SetNumCols(1); + SetColWidth(0, GG::X0); + LockColWidths(); +} + void BasesListBox::PopulateWithEmptyHulls() { ScopedTimer scoped_timer("BasesListBox::PopulateWithEmptyHulls"); |