diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-01 10:12:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:07 +0100 |
commit | 5e5f693a14e788862ff65ed6976a9c336596cfea (patch) | |
tree | 2b7d78b9ca568803a9b333365efc26cd9eea1b75 /vcl/inc/vcl/layout.hxx | |
parent | 3aaeca4c1b7a67fc33208fdf63d30de8af53049e (diff) |
add a grid container
Diffstat (limited to 'vcl/inc/vcl/layout.hxx')
-rw-r--r-- | vcl/inc/vcl/layout.hxx | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 0aacc2db6bf0..9d15468bac3b 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -30,6 +30,7 @@ #include <vcl/dllapi.h> #include <vcl/window.hxx> +#include <boost/multi_array.hpp> enum VclPackType { @@ -248,6 +249,67 @@ protected: } }; +class VCL_DLLPUBLIC Grid : public Window +{ +private: + bool m_bRowHomogeneous; + bool m_bColumnHomogeneous; + int m_nRowSpacing; + int m_nColumnSpacing; + typedef boost::multi_array<Window*, 2> array_type; + + array_type assembleGrid() const; + bool isNullGrid(const array_type& A) const; + void calcMaxs(const array_type &A, std::vector<long> &rWidths, std::vector<long> &rHeights) const; + + Size calculateRequisition() const; + void setAllocation(const Size &rAllocation); +public: + Grid(Window *pParent) + : Window(pParent) + , m_bRowHomogeneous(false), m_bColumnHomogeneous(false) + , m_nRowSpacing(0), m_nColumnSpacing(0) + { + Show(); + } + void set_row_homogeneous(bool bHomogeneous) + { + m_bRowHomogeneous = bHomogeneous; + } + void set_column_homogeneous(bool bHomogeneous) + { + m_bColumnHomogeneous = bHomogeneous; + } + bool get_row_homogeneous() const + { + return m_bRowHomogeneous; + } + bool get_column_homogeneous() const + { + return m_bColumnHomogeneous; + } + void set_row_spacing(int nSpacing) + { + m_nRowSpacing = nSpacing; + } + void set_column_spacing(int nSpacing) + { + m_nColumnSpacing = nSpacing; + } + int get_row_spacing() const + { + return m_nRowSpacing; + } + int get_column_spacing() const + { + return m_nColumnSpacing; + } +public: + virtual Size GetOptimalSize(WindowSizeType eType) const; + using Window::SetPosSizePixel; + virtual void SetPosSizePixel(const Point& rNewPos, const Size& rNewSize); +}; + //Get a Size which is large enough to contain all children with //an equal amount of space at top left and bottom right Size getLegacyBestSizeForChildren(const Window &rWindow); |