1 // -*- C++ -*-
2 /* GG is a GUI for OpenGL.
3 
4    Copyright (C) 2016 LGM-Doyle
5 
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public License
8    as published by the Free Software Foundation; either version 2.1
9    of the License, or (at your option) any later version.
10 
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15 
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free
18    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA
20 
21    If you do not wish to comply with the terms of the LGPL please
22    contact the author as other terms are available for a fee.
23 
24    Zach Laine
25    whatwasthataddress@gmail.com */
26 
27 /** \file DeferredLayout.h \brief Contains the DefferedLayout class, which is used to size and
28     align GG windows in the PreRender() phase. */
29 
30 #ifndef _GG_DeferredLayout_h_
31 #define _GG_DeferredLayout_h_
32 
33 #include <GG/Layout.h>
34 
35 namespace GG {
36 
37 /** \brief An invisible Wnd subclass that arranges its child Wnds during PreRender.
38 
39     A DeferredLayout is a layout that does all of the expensive layout operations once per frame
40     during PreRender().
41 */
42 class GG_API DeferredLayout : public Layout
43 {
44 public:
45     /** \name Structors */ ///@{
46     /** Ctor. */
47     DeferredLayout(X x, Y y, X w, Y h, std::size_t rows, std::size_t columns,
48                    unsigned int border_margin = 0, unsigned int cell_margin = INVALID_CELL_MARGIN);
49     //@}
50 
51     /** \name Accessors */ ///@{
52     //@}
53 
54     /** \name Mutators */ ///@{
55     void SizeMove(const Pt& ul, const Pt& lr) override;
56     void PreRender() override;
57     //@}
58 
59 protected:
60     /** \name Mutators */ ///@{
61     void RedoLayout() override;
62     //@}
63 
64 private:
65     Pt   m_ul_prerender;
66     Pt   m_lr_prerender;
67     bool m_make_resize_immediate_during_prerender;
68 };
69 
70 } // namespace GG
71 
72 #endif
73