×
Namespaces

Variants
Actions

Title Pane触摸监测API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

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

Contents

简介

标题触摸监测API允许一个程序监测用户对标题的触控。如利用这个API可以当用户按住标题栏时恢复程序缺省视图。这个需要完成MAknTitlePaneObserver的HandleTitlePaneEventL()方法,即可对标题触控响应

MMP文件

CAPABILITY none
LIBRARY avkon.lib

头文件

#include <akntitlepaneobserver.h>
 
class CSampleAppUi : public CAknAppUi, public MAknTitlePaneObserver
{
...
private:
/**
* From MAknTitlePaneObserver
*/

void HandleTitlePaneEventL(TInt aEventID);
...
};

源文件

#include <eikspane.h>
#include <akntitle.h>
 
// AppUi second-phase constructor
void CSampleAppUi::ConstructL()
{
...
// Call CAknAppUi::StatusPane() which returns CEikStatusPane*
CEikStatusPane* statusPane = StatusPane();
if (statusPane)
{
// Title pane UID
TUid titlePaneUid;
titlePaneUid.iUid = EEikStatusPaneUidTitle;
// Get pointer to CAknTitlePane object
CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(titlePaneUid);
// Set this AppUi object as the observer of the title pane
titlePane->SetTitlePaneObserver(this);
}
...
}
 
// Implementation of the observer interface
void CSampleAppUi::HandleTitlePaneEventL(TInt aEventID)
{
// Although at the moment EAknTitlePaneTapped
// is the only one value in the TAknTitlePaneEvents enumeration,
// we should consider that later that enumeration could be extended
if (aEventID == EAknTitlePaneTapped)
{
// Custom action on title pane tapping event
}
else
{
// No implementation's required at the moment
}
}


后记

标题栏的触控将被监控到

This page was last modified on 22 December 2011, at 07:46.
151 page views in the last 30 days.
×