📄 scalablescreendrawingcontrol.cpp
字号:
// ScalableScreenDrawingControl.cpp
// ---------------------
//
////////////////////////////////////////////////////////////////////////
//
// Source file for the implementation of the
// control class - CScalableScreenDrawingControl
//
////////////////////////////////////////////////////////////////////////
#include <eikenv.h>
#include <aknutils.h>
#include "akndef.h"
#include <e32svr.h>
#include "ScalableScreenDrawingControl.h"
// Second-phase constructor creates the engine object.
void CScalableScreenDrawingControl::ConstructL(const TRect& /*aRect*/, CAknViewAppUi* aAppUi)
{
CreateWindowL();
SetExtentToWholeScreen();
iBlizzardEngine = new (ELeave) CScalableScreenDrawingEngine (iEikonEnv->WsSession(), aAppUi);
iBlizzardEngine->ConstructL(Window(),CCoeEnv::Static()->ScreenDevice());
ActivateL();
}
// Destructor
CScalableScreenDrawingControl::~CScalableScreenDrawingControl()
{
delete iBlizzardEngine;
}
// We don't have any sub-controls
TInt CScalableScreenDrawingControl::CountComponentControls() const
{
return 0;
}
// Empty implementation
void CScalableScreenDrawingControl::HandleControlEventL(CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
{
}
// Handle resource change event, here it is the event that occurs
// when screen mode changes.
void CScalableScreenDrawingControl::HandleResourceChange(TInt aType)
{
CCoeControl::HandleResourceChange(aType);
if( aType == KEikDynamicLayoutVariantSwitch)
{
iBlizzardEngine->ScaleImage(); // Tell engine to scale bitmaps accordingly
SetExtentToWholeScreen();
}
}
// This event handler detects key events and calls the engine accordingly
TKeyResponse CScalableScreenDrawingControl::OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType)
{
if(aType == EEventKey)
{
if(aKeyEvent.iScanCode == EStdKeyUpArrow)
{
iBlizzardEngine->ArrowUp();
return EKeyWasConsumed;
}
else if(aKeyEvent.iScanCode == EStdKeyDownArrow)
{
iBlizzardEngine->ArrowDown();
return EKeyWasConsumed;
}
else if(aKeyEvent.iScanCode == EStdKeyEnter || aKeyEvent.iScanCode == EStdKeyDevice3)
{
iBlizzardEngine->EnterPress();
return EKeyWasConsumed;
}
else if(aKeyEvent.iScanCode == EStdKeyHash)
{
iBlizzardEngine->ToggleDecorators();
return EKeyWasConsumed;
}
}
return EKeyWasNotConsumed;
}
// End of file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -