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