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