Diffstat (limited to 'noncore/apps/opie-reader/StyleConsts.cpp') (more/less context) (show 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 @@ + +#include <qpixmap.h> +#include "StyleConsts.h" + +GraphicLink::~GraphicLink() { delete graphic; } + +pmstore::~pmstore() +{ +// qDebug("Deleting image"); + delete graphic; +} + +CStyle::~CStyle() +{ + if (graphic != NULL) + { + if (--(graphic->count) == 0) + { + delete graphic; + } + } +} + +CStyle::CStyle(CStyle& rhs) : graphic(NULL) +{ + *this = rhs; +} + +CStyle::CStyle(const CStyle& rhs) : graphic(NULL) +{ + *this = rhs; +} + +CStyle& CStyle::operator=(const CStyle& rhs) +{ + if (rhs.graphic != NULL) + { + (rhs.graphic->count)++; + if (graphic != NULL) + { + if (--(graphic->count) == 0) + { + delete graphic; + } + } + graphic = rhs.graphic; + } + else + { + if (graphic != NULL) + { + if (--(graphic->count) == 0) + { + delete graphic; + } + graphic = NULL; + } + } + sty = rhs.sty; + return *this; +} + +void CStyle::clearPicture() +{ + if (graphic != NULL) + { + if (--(graphic->count) == 0) + { + delete graphic; + } + graphic = NULL; + } +} + +void CStyle::unset() +{ + sty.unset(); + if (graphic != NULL) + { + if (--(graphic->count) == 0) + { + delete graphic; + } + graphic = NULL; + } +} + +void CStyle::setPicture(QPixmap* _g, bool il, unsigned long tgt) +{ + if (graphic != NULL) + { + if (--(graphic->count) == 0) + { + delete graphic; + } + graphic = NULL; + } + if (_g != NULL) graphic = new pmstore(_g, il, tgt); +} |