]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/graphical-element.hh
release: 0.1.22
[lilypond.git] / lily / include / graphical-element.hh
1 /*
2   graphical-element.hh -- declare Graphical_element
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9
10 #ifndef GRAPHICAL_ELEMENT_HH
11 #define GRAPHICAL_ELEMENT_HH
12
13 #include "offset.hh"
14 #include "lily-proto.hh"
15 #include "interval.hh"
16 #include "virtual-methods.hh"
17
18 /** The 2d geometric aspects of a score-element.  It was put in a
19   separate class, because Score_elem got quite big.
20
21   */
22 class Graphical_element 
23 {
24   void init ();
25   /** Is this element dimensionless?.
26     This is private to guarantee correctness of the cache
27    */
28   bool empty_b_;
29   
30 public:
31   void set_empty (bool);
32   DECLARE_MY_RUNTIME_TYPEINFO;
33   /**
34     This is  needed, because #output# may still be
35     NULL.
36     */
37   Offset offset_;
38   
39   Axis_group_element * axis_group_l_a_[NO_AXES];
40   Interval cached_dimension_a_[NO_AXES];
41   bool cached_valid_b_a_[NO_AXES];
42   
43   Graphical_element ();
44   Graphical_element (Graphical_element const&);
45   virtual ~Graphical_element ();
46   
47   void invalidate_cache (Axis);
48   Interval extent (Axis) const;
49   Interval width() const;
50   Interval height() const;
51  
52   /**
53     translate the symbol. The symbol does not have to be created yet. 
54     */
55   void translate (Offset);
56   /**
57     translate in one direction
58     */
59     
60   void translate_axis (Real, Axis);
61
62   Real relative_coordinate (Axis_group_element*group, Axis) const;
63   Offset absolute_offset() const;
64   Real absolute_coordinate (Axis) const;
65   /**
66     Find the group-element which has both #this# and #s#
67    */
68   Axis_group_element*common_group (Graphical_element const* s, Axis a) const;
69   void unlink ();
70   void junk_links ();
71   void print () const;
72 protected:
73   virtual Interval do_height () const=0;
74   virtual Interval do_width () const=0;
75 };
76
77 #endif // GRAPHICAL_ELEMENT_HH
78