Divider.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Slot.hpp"
4 #include "Axis.hpp"
5 
6 namespace iv
7 {
8 
13 class DividerSlot : public Slot
14 {
15 public:
17  DividerSlot( Instance * inst );
18 
19  void status( iv::TableDebugView * view );
20 
21 // initialization parameters
28 
34 
35 // utility methods
36  DividerSlot * lowerOrder( unsigned );
37  DividerSlot * higherOrder( unsigned );
38 };
39 
71 class Divider : public VectorChildrenElem< DividerSlot >, public SlotChild
72 {
73 public:
74 using Elem::instance;
76 
77  Divider( Instance * inst );
78 
79  void status( iv::TableDebugView * view );
80 
81 // initialization parameters
84 
85 // utility methods
86  Divider * axis( Axis );
88 
89 protected:
90  // Elem
91  virtual void first_pass_impl( ElementRenderer * ) override;
92  virtual void second_pass_impl( ElementRenderer * ) override;
93 
94 private:
95  struct Phase
96  {
97  // primary (filled when constructing phases)
98  size_t segment;
99  bool first;
100  bool higher;
101 
102  // secondary (filled when updating sizes and weights)
103  float weight;
104  float size;
105  };
106 
107  std::multimap< unsigned, Phase > phases;
108 
109 private:
110  bool offsets_dirty;
111 };
112 
113 }