]> git.lyx.org Git - lyx.git/blob - src/mathed/xarray.h
b67d3b96815d1409665d53cb53ec1be8ed29df45
[lyx.git] / src / mathed / xarray.h
1 // -*- C++ -*-
2
3 #ifndef MATHEDXARRAY_H
4 #define MATHEDXARRAY_H
5
6 #include <iosfwd>
7 #include "array.h"
8 #include "math_metricsinfo.h"
9
10 #ifdef __GNUG__
11 #pragma interface
12 #endif
13
14 class Painter;
15
16 class MathXArray
17 {
18 public:
19         ///
20         typedef MathArray::size_type       size_type;
21         ///
22         typedef MathArray::const_iterator  const_iterator;
23
24         ///
25         MathXArray();
26         ///
27         void metrics(MathMetricsInfo const & st) const;
28         ///
29         void draw(Painter & pain, int x, int y) const;
30
31         ///
32         int xo() const { return xo_; }
33         ///
34         int yo() const { return yo_; }
35         ///
36         int pos2x(size_type pos) const;
37         ///
38         size_type x2pos(int pos) const;
39
40         ///
41         int ascent() const { return ascent_; }
42         ///
43         int descent() const { return descent_; }
44         ///
45         int height() const { return ascent_ + descent_; }
46         ///
47         int width() const { return width_; }
48
49         ///
50         const_iterator begin() const { return data_.begin(); }
51         ///
52         const_iterator end() const { return data_.end(); }
53         
54 public:
55         ///
56         MathArray data_;
57         ///
58         mutable int width_;
59         ///
60         mutable int ascent_;
61         ///
62         mutable int descent_;
63         ///
64         mutable int xo_;
65         ///
66         mutable int yo_;
67         ///
68         mutable MathMetricsInfo size_;
69 };
70
71 std::ostream & operator<<(std::ostream & os, MathXArray const & ar);
72
73 #endif