📄 imagemanipappview.cpp
字号:
/**
*
* @brief Definition of CImageManipAppView
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDES
// Class include
#include "ImageManipAppView.h"
// System includes
#include <eikenv.h> // CEikonEnv
// User includes
#include "ImageModel.h"
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2 phase constructor.
* Constructs the CImageManipAppView using the NewLC method, popping
* the constructed object from the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CImageManipAppView
*/
CImageManipAppView* CImageManipAppView::NewL(const TRect& aRect, MImageModel& aImageModel)
{
CImageManipAppView* self = CImageManipAppView::NewLC(aRect, aImageModel);
CleanupStack::Pop(self);
return self;
}
/**
* Symbian OS 2 phase constructor.
* Constructs the CImageManipAppView using the constructor and ConstructL
* method, leaving the constructed object on the CleanupStack before returning it.
*
* @param aRect The rectangle for this window
* @return The newly constructed CImageManipAppView
*/
CImageManipAppView* CImageManipAppView::NewLC(const TRect& aRect, MImageModel& aImageModel)
{
CImageManipAppView* self = new (ELeave) CImageManipAppView(aImageModel);
CleanupStack::PushL(self);
self->ConstructL(aRect);
return self;
}
/**
* Symbian OS 2nd phase constructor. Creates a Window for the controls, which it contains.
* Constructs a label and adds it to the window, which it then activates.
* @param aRect The rectangle for this window
*/
void CImageManipAppView::ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
}
/**
* Destructor.
*/
CImageManipAppView::~CImageManipAppView()
{
}
/**
* C++ Constructor. Sets the image model reference
*
* @param aImageModel The image model used to get image to display
*/
CImageManipAppView::CImageManipAppView(MImageModel& aImageModel) :
iImageModel(aImageModel)
{
}
/**
* Blank draw function so that engine initiated redraws are performed through
* separate draw functions and won't potentially cause confusion with system
* initiated one's
*
* @param aRect The rectangular area to draw to
*/
void CImageManipAppView::Draw(const TRect& /*aRect*/) const
{
CWindowGc& gc = SystemGc();
TRect clientRect = Rect();
gc.Clear(clientRect);
CFbsBitmap* bitmap = &(iImageModel.Image());
TSize bitmapSize = bitmap->SizeInPixels();
TInt topLeftX = (clientRect.Width() - bitmapSize.iWidth) / 2;
TInt topLeftY = (clientRect.Height() - bitmapSize.iHeight) / 2;
gc.BitBlt(TPoint(topLeftX, topLeftY), bitmap);
}
/**
* Redraws the AppView using the newly converted image obtained through
* MImageModel
*/
void CImageManipAppView::RedrawAppView() const
{
DrawNow();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -