38 struct SetMarginAction;
108 Layout(
X x,
Y y,
X w,
Y h, std::size_t rows, std::size_t columns,
unsigned int border_margin = 0,
unsigned int cell_margin = INVALID_CELL_MARGIN);
112 virtual Pt MinUsableSize()
const;
114 std::size_t Rows()
const;
115 std::size_t Columns()
const;
117 unsigned int BorderMargin()
const;
118 unsigned int CellMargin()
const;
119 double RowStretch(std::size_t row)
const;
120 double ColumnStretch(std::size_t column)
const;
121 Y MinimumRowHeight(std::size_t row)
const;
122 X MinimumColumnWidth(std::size_t column)
const;
123 std::vector<std::vector<const Wnd*> >
125 std::vector<std::vector<Rect> >
127 std::vector<std::vector<Rect> >
128 RelativeCellRects()
const;
132 bool RenderOutline()
const;
137 Clr OutlineColor()
const;
141 virtual void StartingChildDragDrop(
const Wnd* wnd,
const Pt& offset);
142 virtual void CancellingChildDragDrop(
const std::vector<const Wnd*>& wnds);
143 virtual void ChildrenDraggedAway(
const std::vector<Wnd*>& wnds,
const Wnd* destination);
144 virtual void SizeMove(
const Pt& ul,
const Pt& lr);
145 virtual void Render();
159 void Add(
Wnd* wnd, std::size_t row, std::size_t column, std::size_t num_rows, std::size_t num_columns,
Flags<Alignment> alignment =
ALIGN_NONE);
164 void Remove(
Wnd* wnd);
169 void DetachAndResetChildren();
174 void ResizeLayout(std::size_t rows, std::size_t columns);
182 void SetBorderMargin(
unsigned int margin);
186 void SetCellMargin(
unsigned int margin);
192 void SetRowStretch(std::size_t row,
double stretch);
198 void SetColumnStretch(std::size_t column,
double stretch);
202 void SetMinimumRowHeight(std::size_t row,
Y height);
206 void SetMinimumColumnWidth(std::size_t column,
X width);
210 void RenderOutline(
bool render_outline);
215 void SetOutlineColor(
Clr color);
237 static const unsigned int INVALID_CELL_MARGIN;
245 virtual void MouseWheel(
const Pt& pt,
int move,
Flags<ModKey> mod_keys);
246 virtual void KeyPress(
Key key, boost::uint32_t key_code_point,
Flags<ModKey> mod_keys);
247 virtual void KeyRelease(
Key key, boost::uint32_t key_code_point,
Flags<ModKey> mod_keys);
251 struct GG_API RowColParams
257 unsigned int effective_min;
259 unsigned int current_width;
262 struct GG_API WndPosition
265 WndPosition(std::size_t first_row_, std::size_t first_column_,
266 std::size_t last_row_, std::size_t last_column_,
269 std::size_t first_row;
270 std::size_t first_column;
271 std::size_t last_row;
272 std::size_t last_column;
278 double TotalStretch(
const std::vector<RowColParams>& params_vec)
const;
279 X TotalMinWidth()
const;
280 Y TotalMinHeight()
const;
283 void ChildSizeOrMinSizeOrMaxSizeChanged();
285 std::vector<std::vector<Wnd*> > m_cells;
286 unsigned int m_border_margin;
287 unsigned int m_cell_margin;
288 std::vector<RowColParams> m_row_params;
289 std::vector<RowColParams> m_column_params;
290 std::map<Wnd*, WndPosition> m_wnd_positions;
291 Pt m_min_usable_size;
292 bool m_ignore_child_resize;
293 bool m_ignore_parent_resize;
294 bool m_render_outline;
298 friend struct SetMarginAction;