lilypond-0.0.5
[lilypond.git] / molecule.hh
blob05ec64e3e09b13843ee2b837db373dba80c31b86
1 #ifndef MOLECULE_HH
2 #define MOLECULE_HH
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;
13 void translate(Offset o) {
14 off += o;
17 /// how big is #this#?
18 Box extent() const;
19 Atom(Symbol s);
21 void print() const;
23 String TeXstring() const;
26 /// a group of #Atom#s
27 struct Molecule {
28 PointerList<Atom*> ats;
30 Molecule() { }
31 Molecule(Atom a) { add(a) ; }
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;
43 String TeXstring() const;
45 Molecule(const Molecule&s);
46 void print() const;
47 private:
48 void operator=(const Molecule&);
50 /** a group of individually translated symbols. You can add molecules
51 to the top, to the right, etc. */
52 #endif