summaryrefslogtreecommitdiff
path: root/molecule.hh
blob: 6709b7375074b89124e5e39e2de2a2ac71e3d438 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef MOLECULE_HH
#define MOLECULE_HH

#include "list.hh"
#include "boxes.hh"
#include "item.hh"

/// a symbol which can be translated, and freely copied
struct Atom {
    Offset off;
    const Symbol * sym;

    void translate(Offset o) {
	off += o;
    }
    
    /// how big is #this#?
    Box extent() const;
    Atom(const Symbol*s);
    String TeXstring() const;
};

/// a group of #Atom#s
struct Molecule : Output {
    List<Atom> ats;

    Molecule() { }
    Molecule(Atom a) { ats.bottom().add(a); }
    //    Molecule(Molecule const&src);
    void add_right(const Molecule &m);
    void add_left(const Molecule &m);
    void add_top(const Molecule &m);
    void add_bot(const Molecule &m);
    void add(Molecule const &m);
    void translate(Offset);

    /// how big is #this#? 
    Box extent() const;

    String TeXstring() const;
};
/** a group of individually translated symbols. You can add molecules
    to the top, to the right, etc.  */
#endif