Diffstat (limited to 'noncore/apps/opie-reader/StyleConsts.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-reader/StyleConsts.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/noncore/apps/opie-reader/StyleConsts.cpp b/noncore/apps/opie-reader/StyleConsts.cpp new file mode 100644 index 0000000..e111dbd --- a/dev/null +++ b/noncore/apps/opie-reader/StyleConsts.cpp | |||
@@ -0,0 +1,99 @@ | |||
1 | |||
2 | #include <qpixmap.h> | ||
3 | #include "StyleConsts.h" | ||
4 | |||
5 | GraphicLink::~GraphicLink() { delete graphic; } | ||
6 | |||
7 | pmstore::~pmstore() | ||
8 | { | ||
9 | // qDebug("Deleting image"); | ||
10 | delete graphic; | ||
11 | } | ||
12 | |||
13 | CStyle::~CStyle() | ||
14 | { | ||
15 | if (graphic != NULL) | ||
16 | { | ||
17 | if (--(graphic->count) == 0) | ||
18 | { | ||
19 | delete graphic; | ||
20 | } | ||
21 | } | ||
22 | } | ||
23 | |||
24 | CStyle::CStyle(CStyle& rhs) : graphic(NULL) | ||
25 | { | ||
26 | *this = rhs; | ||
27 | } | ||
28 | |||
29 | CStyle::CStyle(const CStyle& rhs) : graphic(NULL) | ||
30 | { | ||
31 | *this = rhs; | ||
32 | } | ||
33 | |||
34 | CStyle& CStyle::operator=(const CStyle& rhs) | ||
35 | { | ||
36 | if (rhs.graphic != NULL) | ||
37 | { | ||
38 | (rhs.graphic->count)++; | ||
39 | if (graphic != NULL) | ||
40 | { | ||
41 | if (--(graphic->count) == 0) | ||
42 | { | ||
43 | delete graphic; | ||
44 | } | ||
45 | } | ||
46 | graphic = rhs.graphic; | ||
47 | } | ||
48 | else | ||
49 | { | ||
50 | if (graphic != NULL) | ||
51 | { | ||
52 | if (--(graphic->count) == 0) | ||
53 | { | ||
54 | delete graphic; | ||
55 | } | ||
56 | graphic = NULL; | ||
57 | } | ||
58 | } | ||
59 | sty = rhs.sty; | ||
60 | return *this; | ||
61 | } | ||
62 | |||
63 | void CStyle::clearPicture() | ||
64 | { | ||
65 | if (graphic != NULL) | ||
66 | { | ||
67 | if (--(graphic->count) == 0) | ||
68 | { | ||
69 | delete graphic; | ||
70 | } | ||
71 | graphic = NULL; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | void CStyle::unset() | ||
76 | { | ||
77 | sty.unset(); | ||
78 | if (graphic != NULL) | ||
79 | { | ||
80 | if (--(graphic->count) == 0) | ||
81 | { | ||
82 | delete graphic; | ||
83 | } | ||
84 | graphic = NULL; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | void CStyle::setPicture(QPixmap* _g, bool il, unsigned long tgt) | ||
89 | { | ||
90 | if (graphic != NULL) | ||
91 | { | ||
92 | if (--(graphic->count) == 0) | ||
93 | { | ||
94 | delete graphic; | ||
95 | } | ||
96 | graphic = NULL; | ||
97 | } | ||
98 | if (_g != NULL) graphic = new pmstore(_g, il, tgt); | ||
99 | } | ||