]> git.donarmstrong.com Git - lilypond.git/blob - molecule.hh
release: 0.0.3
[lilypond.git] / molecule.hh
1 #ifndef MOLECULE_HH
2 #define MOLECULE_HH
3
4 #include "list.hh"
5 #include "boxes.hh"
6 #include "item.hh"
7
8 /// a symbol which can be translated, and freely copied
9 struct Atom {
10     Offset off;
11     const Symbol * sym;
12
13     void translate(Offset o) {
14         off += o;
15     }
16     
17     /// how big is #this#?
18     Box extent() const;
19     Atom(const Symbol*s);
20     String TeXstring() const;
21 };
22
23 /// a group of #Atom#s
24 struct Molecule : Output {
25     List<Atom> ats;
26
27     Molecule() { }
28     Molecule(Atom a) { ats.bottom().add(a); }
29     //    Molecule(Molecule const&src);
30     void add_right(const Molecule &m);
31     void add_left(const Molecule &m);
32     void add_top(const Molecule &m);
33     void add_bot(const Molecule &m);
34     void add(Molecule const &m);
35     void translate(Offset);
36
37     /// how big is #this#? 
38     Box extent() const;
39
40     String TeXstring() const;
41 };
42 /** a group of individually translated symbols. You can add molecules
43     to the top, to the right, etc.  */
44 #endif