]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/graphical-element.hh
819a0ea31fba6dbab0ebe4e2bc0583cb51eb9c59
[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--1999 Han-Wen Nienhuys <hanwen@cs.uu.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 #include "dimension-cache.hh"
18
19
20
21 /** The 2d geometric aspects of a score-element.  It was put in a
22   separate class, because Score_element got quite big.
23   */
24 class Graphical_element 
25 {
26   void init ();
27 public:
28   Dimension_cache *dim_cache_[NO_AXES];
29
30   /**
31      Set this if anyone points to me, or if I point to anyone.
32    */
33   bool used_b_;
34   
35   char const * name () const;
36   void set_empty (bool);
37   Graphical_element ();
38   Graphical_element (Graphical_element const&);
39   virtual ~Graphical_element ();
40   
41   void invalidate_cache (Axis);
42   Interval extent (Axis) const;
43  
44   /**
45     translate the symbol.
46     */
47   void translate (Offset);
48   /**
49     translate in one direction
50     */
51     
52   void translate_axis (Real, Axis);
53
54   Real relative_coordinate (Dimension_cache*group, Axis) const;
55   Real absolute_coordinate (Axis) const;
56   /**
57     Find the group-element which has both #this# and #s#
58    */
59   Dimension_cache*common_group (Graphical_element const* s, Axis a) const;
60   Dimension_cache*common_group (Link_array<Graphical_element> elems, Axis a) const;
61   
62   Graphical_element *parent_l (Axis a) const;
63   
64   virtual void do_print () const;
65   virtual void print () const;  
66 };
67
68 #endif // GRAPHICAL_ELEMENT_HH
69