Browse Source

added missing file

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@482 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 16 years ago
parent
commit
6812093910
2 changed files with 63 additions and 0 deletions
  1. 47 0
      ClipFormatQListCtrl.cpp
  2. 16 0
      ClipFormatQListCtrl.h

+ 47 - 0
ClipFormatQListCtrl.cpp

@@ -0,0 +1,47 @@
+#include "stdafx.h"
+#include "ClipFormatQListCtrl.h"
+#include "BitmapHelper.h"
+
+CClipFormatQListCtrl::CClipFormatQListCtrl(void)
+{
+	m_clipRow = -1;
+	m_convertedToSmallImage = false;
+}
+
+CClipFormatQListCtrl::~CClipFormatQListCtrl(void)
+{
+}
+
+
+HGLOBAL CClipFormatQListCtrl::GetDib(CDC *pDc, int height)
+{
+	if(m_cfType != CF_DIB)
+	{
+		return NULL;
+	}
+
+	if(m_convertedToSmallImage)
+	{
+		return m_hgData;
+	}
+
+	m_convertedToSmallImage = true;
+
+	CBitmap Bitmap;
+	if( !CBitmapHelper::GetCBitmap(this, pDc, &Bitmap, height) )
+	{
+		Bitmap.DeleteObject();
+		// the data is useless, so free it.
+		this->Free(); 
+		return FALSE;
+	}
+
+	// delete the large image data loaded from the db
+	this->Free();
+
+	//Convert the smaller bitmap back to a dib
+	HPALETTE hPal = NULL;
+	this->m_hgData = CBitmapHelper::hBitmapToDIB((HBITMAP)Bitmap, BI_RGB, hPal);
+
+	return this->m_hgData;
+}

+ 16 - 0
ClipFormatQListCtrl.h

@@ -0,0 +1,16 @@
+#pragma once
+
+#include "Clip.h"
+
+class CClipFormatQListCtrl : public CClipFormat
+{
+public:
+	CClipFormatQListCtrl(void);
+	~CClipFormatQListCtrl(void);
+
+	long m_clipRow;
+	bool m_convertedToSmallImage;
+
+	HGLOBAL GetDib(CDC *pDc, int height);
+};
+