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