You Are Here:

Community: Wiki

This page was last modified on 30 October 2009, at 09:41.

触摸屏UI下的全屏模式

From Forum Nokia Wiki

Contents

简介

S60第五版手机触摸屏API没有CBA按钮支持,因此如果我们想要全屏模式我们必须要隐藏control pane.否则用户将无法访问访问菜单等功能。

为了计算全屏模式下应用程序区域(如control pane的区域大小。我们可以使用Avkon helper类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();
...
}


后记

全屏模式将可以在程序中使用,并支持触摸UI


See also

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

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fFileE3aMicrokernelE5fArchitectureE2eGIFX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ