--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/taskswitcher/utils/src/tsscreenshotmsg.cpp Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Task list entry
+*
+*/
+#include <s32mem.h>
+#include <fbs.h>
+
+#include "tsscreenshotmsg.h"
+
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg* CTsScreenshotMsg::NewLC(RReadStream& stream)
+{
+ CTsScreenshotMsg *self = new(ELeave)CTsScreenshotMsg();
+ CleanupStack::PushL(self);
+ self->ConstructL(stream);
+ return self;
+}
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg* CTsScreenshotMsg::NewLC(TInt windowGroupId, const CFbsBitmap& bitmap, UpdatePriority prior)
+{
+ CTsScreenshotMsg *self = new(ELeave)CTsScreenshotMsg();
+ CleanupStack::PushL(self);
+ self->ConstructL(windowGroupId, bitmap, prior);
+ return self;
+}
+// -----------------------------------------------------------------------------
+TInt CTsScreenshotMsg::CTsScreenshotMsg::size()
+{
+ return sizeof(TInt) * 3;
+}
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg::~CTsScreenshotMsg()
+{
+ delete mBitmap;
+}
+
+// -----------------------------------------------------------------------------
+TInt CTsScreenshotMsg::windowGroupId() const
+{
+ return mWindowGroupId;
+}
+
+// -----------------------------------------------------------------------------
+const CFbsBitmap& CTsScreenshotMsg::screenshot() const
+{
+ return *mBitmap;
+}
+
+// -----------------------------------------------------------------------------
+UpdatePriority CTsScreenshotMsg::priority() const
+{
+ return mPriority;
+}
+
+// -----------------------------------------------------------------------------
+HBufC8* CTsScreenshotMsg::ExternalizeLC() const
+{
+ HBufC8* retVal = HBufC8::NewLC(size());
+ TPtr8 des(retVal->Des());
+ RDesWriteStream stream(des);
+ CleanupClosePushL(stream);
+ stream << (*this);
+ CleanupStack::PopAndDestroy(&stream);
+ return retVal;
+}
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::ExternalizeL(RWriteStream &stream) const
+{
+ stream.WriteInt32L(mWindowGroupId);
+ stream.WriteInt32L(mBitmap->Handle());
+ stream.WriteInt32L(mPriority);
+}
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::InternalizeL(RReadStream &stream)
+{
+ mWindowGroupId = stream.ReadInt32L();
+ User::LeaveIfError(mBitmap->Duplicate(stream.ReadInt32L()));
+ mPriority = static_cast<UpdatePriority>(stream.ReadInt32L());
+}
+
+// -----------------------------------------------------------------------------
+CTsScreenshotMsg::CTsScreenshotMsg()
+{}
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::ConstructL(RReadStream &stream)
+{
+ mBitmap = new(ELeave)CFbsBitmap();
+ stream >> (*this);
+}
+
+// -----------------------------------------------------------------------------
+void CTsScreenshotMsg::ConstructL(TInt windowGroupId, const CFbsBitmap& bitmap, UpdatePriority prior)
+{
+ mBitmap = new(ELeave)CFbsBitmap();
+ User::LeaveIfError(mBitmap->Duplicate(bitmap.Handle()));
+ mWindowGroupId = windowGroupId;
+ mPriority = prior;
+}