]> git.donarmstrong.com Git - lilypond.git/blob - molecule.hh
release: 0.0.4
[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 #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
22     String TeXstring() const;
23 };
24
25 /// a group of #Atom#s
26 struct Molecule {
27     PointerList<Atom*> ats;
28
29     Molecule() { }
30     Molecule(Atom a) { add(a) ; }
31
32     void add_right(const Molecule &m);
33     void add_left(const Molecule &m);
34     void add_top(const Molecule &m);
35     void add_bot(const Molecule &m);
36     void add(Molecule const &m);
37     void translate(Offset);
38     void add(Atom a) { ats.bottom().add(new Atom(a)); }
39     /// how big is #this#? 
40     Box extent() const;
41
42     String TeXstring() const;
43
44     Molecule(const Molecule&s);
45 private:
46     void operator=(const Molecule&);
47 };
48 /** a group of individually translated symbols. You can add molecules
49     to the top, to the right, etc.  */
50 #endif