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