WEB开发网
开发学院手机开发Symbian 开发 深入探索Symbian多视图程序开发 阅读

深入探索Symbian多视图程序开发

 2010-06-22 03:03:00 来源:WEB开发网   
核心提示:* @return TUid uid of the view*/TUid Id() const;// UID of viewconst TUid KViewId = {1};/*** From CAknView returns Uid of View* @return TUid uid of the view*/TUi

* @return TUid uid of the view

*/

TUid Id() const;

// UID of view

const TUid KViewId = {1};

/**

* From CAknView returns Uid of View

* @return TUid uid of the view

*/

TUid Id() const;

那么从一个View跳转到另一个View就需要下面的代码

view plaincopy to clipboardprint?

((CAknViewAppUi*)(iEikonEnv->AppUi()))->ActivateLocalViewL( TUid::Uid( 3 ));或

static_cast(iEikonEnv->AppUi())->ActivateLocalViewL( TUid::Uid( 3 ));

((CAknViewAppUi*)(iEikonEnv->AppUi()))->ActivateLocalViewL( TUid::Uid( 3 ));或

static_cast(iEikonEnv->AppUi())->ActivateLocalViewL( TUid::Uid( 3 ));

上面的代码讲述了AppUI如何管理众多的View以及View之间的切换,那么下面讲述每个View是如何管理它里面众多的Containers的。

首先要明白View继承自CAknView,它做为Container(继承自CCoeControl)的容器通过以下的代码激活某个Container

view plaincopy to clipboardprint?

iContainer = new (ELeave) CApplicationContainerSetting;

iContainer->ConstructL( KFullScreen );

iContainer->SetMopParent(this);

iContainer->SetObserver(this);

iContainer->SetApplicationDbEngine(iDbEngine);

AppUi()->AddToStackL( *this, iContainer );

iContainer = new (ELeave) CApplicationContainerSetting;

iContainer->ConstructL( KFullScreen );

iContainer->SetMopParent(this);

iContainer->SetObserver(this);

iContainer->SetApplicationDbEngine(iDbEngine);

AppUi()->AddToStackL( *this, iContainer );

那么在DoActivateL()中通过以上代码放置初始显示的Container。

那么View是如何管理众多的Container的呢?

从以上代码可以看出,负责Container管理的View都继承自MCoeControlObserver,而

Tags:深入 探索 Symbian

编辑录入:coldstar [复制链接] [打 印]
赞助商链接