Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 05:01, 22 December 2011 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

触摸界面的全屏模式

From Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台安全性
需要的签名: Self-Signed

文章
翻译:
hoolee
最后由 hamishwillee 在 22 Dec 2011 编辑

Contents

概述

S60手机第五版触摸屏没有硬件CBA按钮,因此如果我们需要一个全屏模式我们不需要隐藏control pane否则用户无法访问菜单。

要计算实际全屏的尺寸(如考虑到control pane的区域)我们将需要使用AknLayoutUtils来帮助我们。

MMP文件

LIBRARY avkon.lib
LIBRARY eikcore.lib
CAPABILITY could be self-signed


Header file

class CAknViewClass: public CAknView ...
{
...
public:
void ConstructL();
void SetFullRect();
private:
void CalculateFullscreenRect();
private:
TRect iFullRect;
...
};
class CAknAppUiClass: public CAknAppUi
{
...
protected:
void HandleResourceChangeL( TInt aType );
 
private:
CAknViewClass* iViewInstance;
...
};


源文件

#include <AknUtils.h> 
...
void CAknViewClass::ConstructL()
{
...
// Calculate actual full-screen mode rect
CalculateFullscreenRect();
// Set view extent
SetRect(iFullRect);
...
}
 
void CAknViewClass:SetFullRect()
{
SetRect(iFullRect);
}
...
void CAknViewClass::CalculateFullscreenRect()
{
// Window that fills the entire screen
TRect temp_rect;
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, temp_rect);
iFullRect = temp_rect;
 
// Rect that occupied by control pane (i.e. CBA)
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, temp_rect);
 
// Calculate final rect which depends on CBA location
AknLayoutUtils::TAknCbaLocation cba_location = AknLayoutUtils::CbaLocation();
 
switch(cba_location) {
case AknLayoutUtils::EAknCbaLocationBottom:
iFullRect.iBr.iY -= temp_rect.Height();
break;
 
case AknLayoutUtils::EAknCbaLocationLeft:
iFullRect.iTl.iX += temp_rect.Width();
break;
 
case AknLayoutUtils::EAknCbaLocationRight:
iFullRect.iBr.iX -= temp_rect.Width();
break;
 
default:
break;
}
}
CAknAppUiClass::HandleResourceChangeL( TInt aType )
{
...
iViewInstance->CalculateFullscreenRect();
 
iViewInstance->SetFullRect();
...
}


后记

触摸屏将可以支持全屏模式。

相关资料

How to make a full-screen application using Symbian C++

This page was last modified on 22 December 2011, at 05:01.
94 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×