logo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/// Internal namespace.
pub( crate ) mod private
{
  use crate::protected::*;

  /// Command to draw rectangle.
  #[ allow( dead_code ) ]
  #[ derive( Debug, Clone ) ]
  pub struct RectChanger
  {
    /// Id.
    pub( crate ) id : Id,
    /// Draw changer.
    pub( crate ) draw : DrawChanger,
  }

  impl RectChanger
  {

    /// Constructor.
    #[ inline ]
    pub fn _new( draw : DrawChanger ) -> Self
    {
      let id = Id::new::< Self >();
      let change = RectChangeNew::new( id );
      let mut result = Self{ id, draw };
      change.add_to( &mut result );
      result
    }

    /// ChangeInterface region.
    #[ inline ]
    pub fn region( mut self, left_top : X2< f32 >, right_bottom : X2< f32 > ) -> Self
    {
      let change = RectChangeRegion::new( self.id() ).region( left_top, right_bottom );
      self.change_add( change );
      self
    }

    /// Get back to draw.
    #[ inline ]
    pub fn draw( self ) -> DrawChanger
    {
      self.draw
    }

    /// Get back to context.
    #[ inline ]
    pub fn context( self ) -> ContextChanger
    {
      self.draw.context_changer
    }

  }

  impl ChangerInterface for RectChanger
  {

    type Parent = DrawChanger;
    type Root = ContextChanger;

    fn context( self ) -> Self::Root
    {
      self.draw.context_changer
    }

    fn parent( &mut self ) -> &mut Self::Parent
    {
      &mut self.draw
    }

    fn end( self ) -> Self::Parent
    {
      self.draw
    }

  }

  impl HasIdInterface for RectChanger
  {
    #[ inline ]
    fn id( &self ) -> Id
    {
      self.draw.id()
    }
  }

}

crate::mod_interface!
{
  exposed use RectChanger;
}