]> git.tdb.fi Git - libs/gltk.git/blob - source/grid.h
Rework how widget ownership works in Container
[libs/gltk.git] / source / grid.h
1 #ifndef MSP_GLTK_GRID_H_
2 #define MSP_GLTK_GRID_H_
3
4 #include <msp/datafile/objectloader.h>
5 #include "arrangement.h"
6
7 namespace Msp {
8 namespace GLtk {
9
10 class Grid: public Arrangement
11 {
12 public:
13         class Loader: public DataFile::ObjectLoader<Grid>
14         {
15         public:
16                 Loader(Grid &);
17         private:
18                 void next_row();
19                 void skip();
20         };
21
22 private:
23         struct Column
24         {
25                 Edge left;
26                 Edge right;
27         };
28
29         std::vector<Column> columns;
30         Edge row_top;
31         Edge row_bottom;
32         bool first_row;
33         unsigned column;
34
35 public:
36         Grid(Layout &, unsigned);
37
38         void skip();
39         void next_row();
40
41 private:
42         virtual void process_widget(Widget &, Side, bool);
43         virtual void finish_widget(Widget &);
44         virtual void finish_slot();
45         void finish_row();
46 };
47
48 } // namespace GLtk
49 } // namespace Msp
50
51 #endif