]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/graphical-element.hh
release: 1.1.6
[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--1998 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   */
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   Offset offset_;
31   Interval cached_dimension_a_[NO_AXES];
32   bool cached_valid_b_a_[NO_AXES];
33 public:
34
35   void set_empty (bool);
36
37   bool empty_b () const;
38   
39   
40   
41   Graphical_axis_group * axis_group_l_a_[NO_AXES];
42   
43   Graphical_element ();
44   Graphical_element (Graphical_element const&);
45   
46   void invalidate_cache (Axis);
47   Interval extent (Axis) const;
48   Interval width() const;
49   Interval height() const;
50  
51   /**
52     translate the symbol. The symbol does not have to be created yet. 
53     */
54   void translate (Offset);
55   /**
56     translate in one direction
57     */
58     
59   void translate_axis (Real, Axis);
60
61   Real relative_coordinate (Graphical_axis_group*group, Axis) const;
62   Offset absolute_offset() const;
63   Real absolute_coordinate (Axis) const;
64   /**
65     Find the group-element which has both #this# and #s#
66    */
67   Graphical_axis_group*common_group (Graphical_element const* s, Axis a) const;
68   void unlink ();
69   void junk_links ();
70   virtual void do_print () const;
71 protected:
72   virtual Interval do_height () const=0;
73   virtual Interval do_width () const=0;
74 };
75
76 #endif // GRAPHICAL_ELEMENT_HH
77