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