]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/graphical-element.hh
release: 1.2.4
[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.
19   */
20 class Graphical_element 
21 {
22   void init ();
23 public:
24   Dimension_cache *dim_cache_[NO_AXES];
25
26   /**
27      Set this if anyone points to me, or if I point to anyone.
28    */
29   bool used_b_;
30   
31   char const * name () const;
32   /**
33      Set empty in direction a1 and a2.  If an argument is NO_AXES, it is ignored.
34    */
35   void set_empty (bool b, Axis a1 = NO_AXES, Axis a2 = NO_AXES);
36   bool empty_b (Axis a1 = NO_AXES, Axis a2 = NO_AXES);
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 (Graphical_element const* refp, Axis) const;
55   /**
56     Find the group-element which has both #this# and #s#
57    */
58   Graphical_element*common_refpoint (Graphical_element const* s, Axis a) const;
59   Graphical_element*common_refpoint (Link_array<Graphical_element> elems, Axis a) const;
60
61   /**
62      Set the  parent refpoint of THIS to E
63    */
64   void set_parent (Graphical_element* e, Axis);
65   
66   Graphical_element *parent_l (Axis a) const;
67   
68   virtual void do_print () const;
69   virtual void print () const;  
70 };
71
72 #endif // GRAPHICAL_ELEMENT_HH
73