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