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