2021-08-06 14:22:56 +02:00
|
|
|
#ifndef BWIDGETS_LAYOUT_HPP
|
|
|
|
#define BWIDGETS_LAYOUT_HPP
|
2021-06-08 14:30:38 +02:00
|
|
|
|
2021-07-18 18:26:12 +02:00
|
|
|
#include <basic_widgets/core/type/size.hpp>
|
2021-08-17 12:10:41 +02:00
|
|
|
#include <basic_widgets/w/base/widget.hpp>
|
2021-07-16 17:18:13 +02:00
|
|
|
|
2021-08-06 14:22:56 +02:00
|
|
|
namespace bwidgets
|
2021-07-29 16:06:03 +02:00
|
|
|
{
|
2021-08-17 12:10:41 +02:00
|
|
|
class Layout : public virtual Widget
|
2021-07-10 19:55:53 +02:00
|
|
|
{
|
2021-08-24 00:10:09 +02:00
|
|
|
protected:
|
|
|
|
using Widget::Widget;
|
|
|
|
|
2021-07-29 16:06:03 +02:00
|
|
|
public:
|
2021-08-17 12:10:41 +02:00
|
|
|
static inline const Size default_margins {8, 8};
|
2021-08-06 14:22:56 +02:00
|
|
|
|
2021-08-23 23:50:14 +02:00
|
|
|
// Margins between layout widgets.
|
2021-08-06 14:22:56 +02:00
|
|
|
Size margins = default_margins;
|
2021-07-12 00:58:59 +02:00
|
|
|
|
2021-08-23 23:50:14 +02:00
|
|
|
// Add widget to the layout
|
2021-08-17 12:10:41 +02:00
|
|
|
virtual void add_widget(std::unique_ptr<Widget>) = 0;
|
2021-08-23 23:50:14 +02:00
|
|
|
// Apply a function to every layout widget.
|
2021-08-17 12:10:41 +02:00
|
|
|
virtual void for_widgets(const std::function<void(Widget*)>&) = 0;
|
2021-07-10 19:55:53 +02:00
|
|
|
};
|
|
|
|
}
|
2021-06-08 14:30:38 +02:00
|
|
|
|
|
|
|
#endif
|