Diffstat (limited to 'noncore/apps/opie-reader/CDrawBuffer.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/CDrawBuffer.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/noncore/apps/opie-reader/CDrawBuffer.h b/noncore/apps/opie-reader/CDrawBuffer.h index 9ec0ed9..2625a72 100644 --- a/noncore/apps/opie-reader/CDrawBuffer.h +++ b/noncore/apps/opie-reader/CDrawBuffer.h | |||
@@ -1,43 +1,51 @@ | |||
1 | #ifndef __CDRAWBUFFER_H | 1 | #ifndef __CDRAWBUFFER_H |
2 | #define __CDRAWBUFFER_H | 2 | #define __CDRAWBUFFER_H |
3 | 3 | ||
4 | #include <qcolor.h> | ||
4 | #include "StyleConsts.h" | 5 | #include "StyleConsts.h" |
5 | #include "CBuffer.h" | 6 | #include "CBuffer.h" |
6 | #include "my_list.h" | 7 | #include "my_list.h" |
7 | #include "linktype.h" | 8 | #include "linktype.h" |
8 | 9 | ||
9 | class QPainter; | 10 | class QPainter; |
11 | class QImage; | ||
10 | 12 | ||
11 | struct textsegment | 13 | struct textsegment |
12 | { | 14 | { |
13 | int start; | 15 | int start; |
14 | CStyle style; | 16 | CStyle style; |
15 | textsegment(int _start, const CStyle& _style) | 17 | textsegment(int _start, const CStyle& _style) |
16 | : | 18 | : |
17 | start(_start), style(_style) | 19 | start(_start), style(_style) |
18 | {} | 20 | {} |
19 | }; | 21 | }; |
20 | 22 | ||
21 | class FontControl; | 23 | class FontControl; |
22 | 24 | ||
23 | class CDrawBuffer : public CBuffer | 25 | class CDrawBuffer : public CBuffer |
24 | { | 26 | { |
27 | bool m_hastext; | ||
25 | CList<textsegment> segs; | 28 | CList<textsegment> segs; |
26 | int len; | 29 | int len; |
27 | FontControl* fc; | 30 | FontControl* fc; |
28 | int m_maxstyle, m_ascent, m_descent, m_lineSpacing, m_lineExtraSpacing; | 31 | int m_ascent, m_descent, m_lineSpacing, m_lineExtraSpacing; |
29 | bool m_bEof; | 32 | bool m_bEof, m_bBop; |
30 | bool m_bSop, m_bEop; | 33 | bool m_bSop, m_bEop; |
34 | bool m_showPartial; | ||
31 | CDrawBuffer(const CDrawBuffer&); | 35 | CDrawBuffer(const CDrawBuffer&); |
32 | CDrawBuffer& operator=(const tchar*sztmp); | 36 | CDrawBuffer& operator=(const tchar*sztmp); |
37 | void Highlight(QPainter*_p, bool drawBackground, int _x, int _y, int w, QColor bgColour); | ||
33 | public: | 38 | public: |
34 | void setstartpara() { m_bSop = true; } | 39 | void setstartpara() { m_bSop = true; } |
40 | void setBop() { m_bBop = true; } | ||
41 | bool isBop() { return m_bBop; } | ||
35 | void setendpara() { m_bEop = true; } | 42 | void setendpara() { m_bEop = true; } |
43 | void setendpara(const CStyle& cs); | ||
36 | int leftMargin(); | 44 | int leftMargin(); |
37 | int rightMargin(); | 45 | int rightMargin(); |
38 | void setEof() { m_bEof = true; } | 46 | void setEof() { m_bEof = true; } |
39 | bool eof() { return m_bEof; } | 47 | bool eof() { return m_bEof; } |
40 | CDrawBuffer& operator=(CDrawBuffer&); | 48 | CDrawBuffer& operator=(CDrawBuffer&); |
41 | CDrawBuffer(FontControl* _fs = NULL) | 49 | CDrawBuffer(FontControl* _fs = NULL) |
42 | : | 50 | : |
43 | fc(_fs) | 51 | fc(_fs) |
@@ -48,26 +56,32 @@ class CDrawBuffer : public CBuffer | |||
48 | /* | 56 | /* |
49 | CDrawBuffer() | 57 | CDrawBuffer() |
50 | : | 58 | : |
51 | size(0) | 59 | size(0) |
52 | { | 60 | { |
53 | empty(); | 61 | empty(); |
54 | } | 62 | } |
55 | */ | 63 | */ |
56 | int width(int numchars = -1, bool onscreen = false, int scwidth = 0, unsigned char _border = 0); | 64 | int charwidth(int numchars, CStyle& currentstyle); |
57 | int offset(int, unsigned char); | 65 | int charwidth(int numchars); |
58 | void render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scw, unsigned char); | 66 | int width(int availht, int numchars = -1, bool onscreen = false, int scwidth = 0, unsigned short _lborder = 0, unsigned short _rborder = 0); |
67 | int offset(int, unsigned short, unsigned short, int); | ||
68 | void render(QPainter* _p, int _y, bool _bMono, int _charWidth, int scw, unsigned short, unsigned short, const QColor&, int availht); | ||
59 | void empty(); | 69 | void empty(); |
60 | void addch(tchar ch, CStyle _style); | 70 | void addch(tchar ch, CStyle _style); |
61 | void truncate(int); | 71 | void truncate(int); |
62 | void setright(CDrawBuffer&, int); | 72 | void setright(CDrawBuffer&, int); |
73 | CStyle firststyle(); | ||
63 | CStyle laststyle(); | 74 | CStyle laststyle(); |
64 | int ascent() { return m_ascent; } | 75 | int ascent() { return m_ascent; } |
65 | int descent() { return m_descent; } | 76 | int descent() { return m_descent; } |
66 | int lineSpacing() { return m_lineSpacing; } | 77 | int lineSpacing() { return m_lineSpacing; } |
67 | int lineExtraSpacing() { return m_lineExtraSpacing; } | 78 | int lineExtraSpacing() { return m_lineExtraSpacing; } |
68 | 79 | ||
69 | // void frig(); | 80 | // void frig(); |
70 | linkType getLinkType(int numchars, size_t& tgt); | 81 | linkType getLinkType(int numchars, size_t& tgt, size_t& offset, size_t& pictgt, QImage*&); |
71 | void resize(); | 82 | void resize(int); |
83 | bool showPartial() { return m_showPartial; } | ||
84 | CStyle* getNextLink(int&); | ||
85 | int invertLink(int); | ||
72 | }; | 86 | }; |
73 | #endif | 87 | #endif |