Euphoria
layout.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "base/rect.h"
4 #include "base/size2.h"
5 
6 
7 #include <memory>
8 
9 
10 namespace eu::gui
11 {
12  struct Widget;
13 }
14 
15 
16 namespace eu::gui
17 {
18  struct Layout
19  {
20  Layout();
21 
22  virtual
24 
25  Layout(const Layout& other) = delete;
26  void operator=(const Layout&) = delete;
27  Layout(Layout&& other) = delete;
28  void operator=(Layout&&) = delete;
29 
30  [[nodiscard]] virtual size2f
32  (
33  const std::vector<std::shared_ptr<Widget>>& widgets
34  ) const = 0;
35 
36  virtual
37  void
39  (
40  std::vector<std::shared_ptr<Widget>>* widgets,
41  const Rectf& area
42  ) const = 0;
43  };
44 
46  {
48  (
49  const std::vector<bool>& er,
50  const std::vector<bool>& ec,
51  float cp
52  );
53 
54  ~TableLayout() override = default;
55 
56  TableLayout(const TableLayout& other) = delete;
57  void operator=(const TableLayout&) = delete;
58  TableLayout(TableLayout&& other) = delete;
59  void operator=(TableLayout&&) = delete;
60 
61  [[nodiscard]] size2f
63  (
64  const std::vector<std::shared_ptr<Widget>>& widgets
65  ) const override;
66 
67  void
68  lay_out
69  (
70  std::vector<std::shared_ptr<Widget>>* widgets,
71  const Rectf& area
72  ) const override;
73 
74  std::vector<bool> expandable_rows;
75  std::vector<bool> expandable_cols;
77  };
78 
80  {
81  SingleRowLayout(float padding);
82 
83  ~SingleRowLayout() override = default;
84 
85  SingleRowLayout(const SingleRowLayout& other) = delete;
86  void operator=(const SingleRowLayout&) = delete;
87  SingleRowLayout(SingleRowLayout&& other) = delete;
88  void operator=(SingleRowLayout&&) = delete;
89 
90  [[nodiscard]] size2f
92  (
93  const std::vector<std::shared_ptr<Widget>>& widgets
94  ) const override;
95 
96  void
97  lay_out
98  (
99  std::vector<std::shared_ptr<Widget>>* widgets,
100  const Rectf& area
101  ) const override;
102 
103  float padding;
104  };
105 }
Definition: rect.h:27
virtual ~Layout()
Layout(const Layout &other)=delete
virtual void lay_out(std::vector< std::shared_ptr< Widget >> *widgets, const Rectf &area) const =0
void operator=(Layout &&)=delete
virtual size2f calc_minimum_area(const std::vector< std::shared_ptr< Widget >> &widgets) const =0
Layout(Layout &&other)=delete
void operator=(const Layout &)=delete
~SingleRowLayout() override=default
SingleRowLayout(const SingleRowLayout &other)=delete
SingleRowLayout(SingleRowLayout &&other)=delete
void operator=(const SingleRowLayout &)=delete
size2f calc_minimum_area(const std::vector< std::shared_ptr< Widget >> &widgets) const override
Definition: layout.cc:170
void lay_out(std::vector< std::shared_ptr< Widget >> *widgets, const Rectf &area) const override
Definition: layout.cc:197
SingleRowLayout(float padding)
Definition: layout.cc:162
void operator=(SingleRowLayout &&)=delete
size2f calc_minimum_area(const std::vector< std::shared_ptr< Widget >> &widgets) const override
Definition: layout.cc:49
void operator=(const TableLayout &)=delete
~TableLayout() override=default
std::vector< bool > expandable_rows
Definition: layout.h:74
TableLayout(const std::vector< bool > &er, const std::vector< bool > &ec, float cp)
Definition: layout.cc:24
TableLayout(const TableLayout &other)=delete
TableLayout(TableLayout &&other)=delete
void lay_out(std::vector< std::shared_ptr< Widget >> *widgets, const Rectf &area) const override
Definition: layout.cc:77
void operator=(TableLayout &&)=delete
std::vector< bool > expandable_cols
Definition: layout.h:75
float combined_padding
Definition: layout.h:76