summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-28 10:41:25 (UTC)
committer simon <simon>2002-12-28 10:41:25 (UTC)
commit857560112f6df95a84040b43462731f63824b3d7 (patch) (unidiff)
tree9a1e8734e427838cf33b3eb764335bf2c62b930b
parent4c05428a793bcfed723377ad33dadac5ddcd1b99 (diff)
downloadopie-857560112f6df95a84040b43462731f63824b3d7.zip
opie-857560112f6df95a84040b43462731f63824b3d7.tar.gz
opie-857560112f6df95a84040b43462731f63824b3d7.tar.bz2
- include string.h for memcmp
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/StyleConsts.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/StyleConsts.h b/noncore/apps/opie-reader/StyleConsts.h
index 5aacdf0..9701d19 100644
--- a/noncore/apps/opie-reader/StyleConsts.h
+++ b/noncore/apps/opie-reader/StyleConsts.h
@@ -1,177 +1,178 @@
1#ifndef __STYLECONSTS_H 1#ifndef __STYLECONSTS_H
2#define __STYLECONSTS_H 2#define __STYLECONSTS_H
3 3
4typedef unsigned short StyleType; 4typedef unsigned short StyleType;
5 5
6#include <stdlib.h> 6#include <stdlib.h>
7#include <string.h>
7#include <qglobal.h> 8#include <qglobal.h>
8class QPixmap; 9class QPixmap;
9 10
10struct GraphicLink 11struct GraphicLink
11{ 12{
12 QPixmap* graphic; 13 QPixmap* graphic;
13 bool isLink; 14 bool isLink;
14 unsigned long link; 15 unsigned long link;
15 GraphicLink(QPixmap* p, bool isLnk, unsigned long tgt) : 16 GraphicLink(QPixmap* p, bool isLnk, unsigned long tgt) :
16 graphic(p), isLink(isLnk), link(tgt) {} 17 graphic(p), isLink(isLnk), link(tgt) {}
17 ~GraphicLink(); 18 ~GraphicLink();
18}; 19};
19 20
20struct pmstore 21struct pmstore
21{ 22{
22 unsigned int count; 23 unsigned int count;
23 GraphicLink* graphic; 24 GraphicLink* graphic;
24 pmstore(QPixmap* p, bool isLnk, unsigned long tgt) : count(1) 25 pmstore(QPixmap* p, bool isLnk, unsigned long tgt) : count(1)
25 { 26 {
26 graphic = new GraphicLink(p, isLnk, tgt); 27 graphic = new GraphicLink(p, isLnk, tgt);
27 } 28 }
28 ~pmstore(); 29 ~pmstore();
29}; 30};
30 31
31enum EalignmentType 32enum EalignmentType
32{ 33{
33 m_AlignLeft, 34 m_AlignLeft,
34 m_AlignRight, 35 m_AlignRight,
35 m_AlignCentre, 36 m_AlignCentre,
36 m_AlignJustify 37 m_AlignJustify
37}; 38};
38 39
39class CBasicStyle 40class CBasicStyle
40{ 41{
41 friend class CStyle; 42 friend class CStyle;
42 bool m_bold, 43 bool m_bold,
43 m_italic; 44 m_italic;
44 int m_fontsize; 45 int m_fontsize;
45 EalignmentType m_align; 46 EalignmentType m_align;
46 unsigned char red, green, blue; 47 unsigned char red, green, blue;
47 unsigned long data; 48 unsigned long data;
48 bool isLink; 49 bool isLink;
49 bool m_underline; 50 bool m_underline;
50 bool m_strikethru; 51 bool m_strikethru;
51 bool m_monospaced; 52 bool m_monospaced;
52 unsigned char m_leftmargin, m_rightmargin; 53 unsigned char m_leftmargin, m_rightmargin;
53 CBasicStyle() 54 CBasicStyle()
54 { 55 {
55 unset(); 56 unset();
56 } 57 }
57 bool operator!=(const CBasicStyle& rhs) 58 bool operator!=(const CBasicStyle& rhs)
58 { 59 {
59 return (memcmp(this, &rhs, sizeof(CBasicStyle)) != 0); 60 return (memcmp(this, &rhs, sizeof(CBasicStyle)) != 0);
60 } 61 }
61 void unset() 62 void unset()
62 { 63 {
63 m_bold = false; 64 m_bold = false;
64 m_italic = false; 65 m_italic = false;
65 m_fontsize = 0; 66 m_fontsize = 0;
66 m_align = m_AlignLeft; 67 m_align = m_AlignLeft;
67 red = green = blue = 0; 68 red = green = blue = 0;
68 data = 0; 69 data = 0;
69 isLink = false; 70 isLink = false;
70 m_underline = false; 71 m_underline = false;
71 m_strikethru = false; 72 m_strikethru = false;
72 m_leftmargin = 0; 73 m_leftmargin = 0;
73 m_rightmargin = 0; 74 m_rightmargin = 0;
74 m_monospaced = false; 75 m_monospaced = false;
75 } 76 }
76}; 77};
77 78
78class CStyle 79class CStyle
79{ 80{
80 CBasicStyle sty; 81 CBasicStyle sty;
81 pmstore* graphic; 82 pmstore* graphic;
82 public: 83 public:
83 bool getPictureLink() 84 bool getPictureLink()
84 { 85 {
85 return (graphic != NULL && graphic->graphic->isLink); 86 return (graphic != NULL && graphic->graphic->isLink);
86 } 87 }
87 unsigned long getPictureLinkData() 88 unsigned long getPictureLinkData()
88 { 89 {
89 return graphic->graphic->link; 90 return graphic->graphic->link;
90 } 91 }
91 void setLeftMargin(unsigned char m) { sty.m_leftmargin = m; } 92 void setLeftMargin(unsigned char m) { sty.m_leftmargin = m; }
92 unsigned char getLeftMargin() { return sty.m_leftmargin; } 93 unsigned char getLeftMargin() { return sty.m_leftmargin; }
93 void setRightMargin(unsigned char m) { sty.m_rightmargin = m; } 94 void setRightMargin(unsigned char m) { sty.m_rightmargin = m; }
94 unsigned char getRightMargin() { return sty.m_rightmargin; } 95 unsigned char getRightMargin() { return sty.m_rightmargin; }
95 unsigned char Red() { return sty.red; } 96 unsigned char Red() { return sty.red; }
96 unsigned char Green() { return sty.green; } 97 unsigned char Green() { return sty.green; }
97 unsigned char Blue() { return sty.blue; } 98 unsigned char Blue() { return sty.blue; }
98 void setColour(unsigned char r, unsigned char g, unsigned char b) 99 void setColour(unsigned char r, unsigned char g, unsigned char b)
99 { 100 {
100 sty.red = r; 101 sty.red = r;
101 sty.green = g; 102 sty.green = g;
102 sty.blue = b; 103 sty.blue = b;
103 } 104 }
104 CStyle() : graphic(NULL) {} 105 CStyle() : graphic(NULL) {}
105 ~CStyle(); 106 ~CStyle();
106 CStyle(CStyle&); 107 CStyle(CStyle&);
107 CStyle(const CStyle&); 108 CStyle(const CStyle&);
108 CStyle& operator=(const CStyle&); 109 CStyle& operator=(const CStyle&);
109 void unset(); 110 void unset();
110 bool isPicture() { return (graphic != NULL); } 111 bool isPicture() { return (graphic != NULL); }
111 void clearPicture(); 112 void clearPicture();
112 void setPicture(QPixmap* _g, bool il=false, unsigned long tgt=0); 113 void setPicture(QPixmap* _g, bool il=false, unsigned long tgt=0);
113 QPixmap* getPicture() 114 QPixmap* getPicture()
114 { 115 {
115 QPixmap* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL); 116 QPixmap* pm = ((graphic != NULL) ? graphic->graphic->graphic : NULL);
116 return pm; 117 return pm;
117 } 118 }
118 void setUnderline() { sty.m_underline = true; } 119 void setUnderline() { sty.m_underline = true; }
119 void unsetUnderline() { sty.m_underline = false; } 120 void unsetUnderline() { sty.m_underline = false; }
120 bool isUnderline() { return sty.m_underline; } 121 bool isUnderline() { return sty.m_underline; }
121 void setStrikethru() { sty.m_strikethru = true; } 122 void setStrikethru() { sty.m_strikethru = true; }
122 void unsetStrikethru() { sty.m_strikethru = false; } 123 void unsetStrikethru() { sty.m_strikethru = false; }
123 bool isStrikethru() { return sty.m_strikethru; } 124 bool isStrikethru() { return sty.m_strikethru; }
124 void setBold() { sty.m_bold = true; } 125 void setBold() { sty.m_bold = true; }
125 void unsetBold() { sty.m_bold = false; } 126 void unsetBold() { sty.m_bold = false; }
126 bool isBold() { return sty.m_bold; } 127 bool isBold() { return sty.m_bold; }
127 void setItalic() { sty.m_italic = true; } 128 void setItalic() { sty.m_italic = true; }
128 void unsetItalic() { sty.m_italic = false; } 129 void unsetItalic() { sty.m_italic = false; }
129 bool isItalic() { return sty.m_italic; } 130 bool isItalic() { return sty.m_italic; }
130 void setMono() { sty.m_monospaced = true; } 131 void setMono() { sty.m_monospaced = true; }
131 void unsetMono() { sty.m_monospaced = false; } 132 void unsetMono() { sty.m_monospaced = false; }
132 bool isMono() { return sty.m_monospaced; } 133 bool isMono() { return sty.m_monospaced; }
133 134
134 void setLeftJustify() 135 void setLeftJustify()
135 { 136 {
136 sty.m_align = m_AlignLeft; 137 sty.m_align = m_AlignLeft;
137 } 138 }
138 void setRightJustify() 139 void setRightJustify()
139 { 140 {
140 sty.m_align = m_AlignRight; 141 sty.m_align = m_AlignRight;
141 } 142 }
142 void setCentreJustify() 143 void setCentreJustify()
143 { 144 {
144 sty.m_align = m_AlignCentre; 145 sty.m_align = m_AlignCentre;
145 } 146 }
146 void setFullJustify() 147 void setFullJustify()
147 { 148 {
148 sty.m_align = m_AlignJustify; 149 sty.m_align = m_AlignJustify;
149 } 150 }
150 StyleType getJustify() 151 StyleType getJustify()
151 { 152 {
152 return sty.m_align; 153 return sty.m_align;
153 } 154 }
154 155
155 void setFontSize(int _fs) 156 void setFontSize(int _fs)
156 { 157 {
157 sty.m_fontsize = _fs; 158 sty.m_fontsize = _fs;
158 } 159 }
159 int getFontSize() 160 int getFontSize()
160 { 161 {
161 return sty.m_fontsize; 162 return sty.m_fontsize;
162 } 163 }
163 bool operator!=(const CStyle& rhs) 164 bool operator!=(const CStyle& rhs)
164 { 165 {
165 return 166 return
166 ( 167 (
167 (sty != rhs.sty) || 168 (sty != rhs.sty) ||
168 (graphic != rhs.graphic) 169 (graphic != rhs.graphic)
169 ); 170 );
170 } 171 }
171 void setLink(bool _l) { sty.isLink = _l; } 172 void setLink(bool _l) { sty.isLink = _l; }
172 bool getLink() { return sty.isLink; } 173 bool getLink() { return sty.isLink; }
173 void setData(unsigned long _d) { sty.data = _d; } 174 void setData(unsigned long _d) { sty.data = _d; }
174 unsigned long getData() { return sty.data; } 175 unsigned long getData() { return sty.data; }
175}; 176};
176 177
177#endif 178#endif