X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgrid.h;h=0e71748b6a71bdd84da98bdd31c8bfa3957094c9;hb=646af3dd91a6ca981572a5b69a0f0bd205d9af49;hp=519151eace3be77a90be986c92b5026bf7c8862d;hpb=df07e8f3e239b146cbc458d3cbd69758e590d255;p=libs%2Fgltk.git diff --git a/source/grid.h b/source/grid.h index 519151e..0e71748 100644 --- a/source/grid.h +++ b/source/grid.h @@ -1,38 +1,37 @@ #ifndef MSP_GLTK_GRID_H_ #define MSP_GLTK_GRID_H_ -#include "layout.h" +#include "arrangement.h" namespace Msp { namespace GLtk { -/** -Arranges widgets in a grid. - -This layout class places widgets in a grid, lining up their edges in rows and -columns. Widgets are placed on rows left-to-right and rows are placed top-to- -bottom. - -The start of each row must be indicated manually. Individual cells can be -skipped to leave them empty. -*/ -class Grid: public Layout +class Grid: public Arrangement { private: - bool uniform; - std::vector columns; - unsigned cur_column; - bool first; - bool skipped; + struct Column + { + Edge left; + Edge right; + }; + + std::vector columns; + Edge row_top; + Edge row_bottom; + bool first_row; + unsigned column; public: - Grid(bool = false); + Grid(Layout &, unsigned); - void start_row(); - void skip_cell(); + void skip(); + void next_row(); private: - Slot *create_slot(Widget &); + virtual void process_widget(Widget &, Side, bool); + virtual void finish_widget(Widget &); + virtual void finish_slot(); + void finish_row(); }; } // namespace GLtk