Border.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Elem.hpp"
4 #include "Slot.hpp"
5 #include "OneChildElem.hpp"
6 
7 namespace iv
8 {
9 
20 class Border : public OneChildElem< SlotChild >, public SlotChild
21 {
22 public:
24 using Elem::instance;
25  Border( Instance * );
26 
27  void status( iv::TableDebugView * view );
28 
29 // initialization parameters
32 
35 
38 
39 // utility methods
40  Border * enabled( bool val );
41 
42  Border * borderLeft( std::optional< float > );
43  Border * borderRight( std::optional< float > );
44  Border * borderTop( std::optional< float > );
45  Border * borderBottom( std::optional< float > );
46  Border * borderFront( std::optional< float > );
47  Border * borderBack( std::optional< float > );
48 
49  Border * leftTop( std::optional< float > left, std::optional< float > top );
50  Border * leftBottom( std::optional< float > left, std::optional< float > bottom );
51  Border * rightTop( std::optional< float > right, std::optional< float > top );
52  Border * rightBottom( std::optional< float > right, std::optional< float > bottom );
53 
54  Border * leftRight( std::optional< float > left, std::optional< float > right );
55  Border * topBottom( std::optional< float > top, std::optional< float > bottom );
56  Border * frontBack( std::optional< float > front, std::optional< float > back );
57 
58 protected:
59  // Elem
60  virtual void first_pass_impl( ElementRenderer * ) override;
61  virtual void second_pass_impl( ElementRenderer * ) override;
62 
63 private:
64  float3 BorderSums() const;
65  void inner_layout( float3 & out_size, float3 & out_position ) const;
66 
67 private:
68  // cache
69  bool insizeDirty;
70  float3 insize;
71  float3 inpos;
72 };
73 
74 }