StatusPane API: Using the Status pane API

Defining status pane in resource file

The status panes’ resource definition describes the application’s status pane properties. The resource contains also information about the control that is put inside the sub panes. Status pane’s id and type field values are defined in avkon.hrh. Status pane layout can be optionally defined by the layouts and default_layout fields. In this example status pane’s sub panes are: navigation pane with a label control, and a title pane.

RESOURCE EIK_APP_INFO
    {
    status_pane = r_app_status_pane;
    }

RESOURCE STATUS_PANE_APP_MODEL r_app_status_pane
    {
    panes=
        {
        SPANE_PANE
            {
            id = EEikStatusPaneUidNavi;
            type = EAknCtNaviPane;
            resource = r_navi_decorator;
            },
        SPANE_PANE
            {
            id = EEikStatusPaneUidTitle;
            type = EAknCtTitlePane;
            resource = r_overriden_app_name;
            }
        };
    }

RESOURCE TITLE_PANE r_overriden_app_name
    {
    txt = "Title";
    }

RESOURCE NAVI_DECORATOR r_navi_decorator
    {
    type = ENaviDecoratorLabel;
    control = NAVI_LABEL
        {
        txt="label";
        };
    }

Accessing status pane

When using Status Pane API, the first step is to access a pointer to the application’s status pane by calling the CAknAppUi::StatusPane() method. CAknAppUi is the base class of the application UI.

The status pane layout is read from AVKON resources.

// Gets a pointer to the status pane 
CEikStatusPane* sp = StatusPane();

Accessing a control inside status pane’s sub pane

In this example the title pane's text is changed. For checking if a pane is part of the layout, before accessing it, see Status pane layout and capabilities.

iTitlePane is a pointer to CAknTitlePane.

// Gets a pointer to the status pane 
CEikStatusPane* sp = StatusPane();

// Fetch pointer to the title pane control
iTitlePane = ( CAknTitlePane* )sp->ControlL(
               TUid::Uid( EEikStatusPaneUidTitle ));
iTitlePane->SetTextL( _L("New Title") );

Modifying status pane visibility

Status pane can be visible, or invisible, so this way the application can be set full screen.

// Gets a pointer to the status pane 
CEikStatusPane* sp = StatusPane();

// Changing status pane visibility to invisible
sp->MakeVisible( EFalse );

Requesting status pane visibility is trivial.

// Gets a pointer to the status pane 
CEikStatusPane* sp = StatusPane();

// Requesting visibility
TBool visible = sp->IsVisible();

Status pane layout and capabilities

Status pane layout can be changed dynamically. Based on the layout, status pane can be small, or defined with different controls, e.g. the signal strength and battery charging.

There are some predefined status pane layouts:

This example changes the status pane to small layout. Checks if title pane is the part of the current layout, and sets title text. Layouts are defined in avkon.hrh. iTitle pane is a pointer to CAknTitlePane.

// Gets a pointer to the status pane 
CEikStatusPane* sp = StatusPane();
// Switch layout
sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_SMALL );

// After switching layout check if title pane is in current layout.
TBool isTitlepaneInLayout = sp->PaneCapabilities( TUid::Uid( EEikStatusPaneUidTitle ) ).IsInCurrentLayout();

// If title pane is in the curent layout, change title text.
if ( isTitlepaneInLayout )
     {
     // Fetch pointer to the title pane control
     iTitlePane = (CAknTitlePane*)sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle));
     iTitlePane->SetTextL( _L("New Title") );
     }

Observing status pane events

Handling status pane events requires that the observing class must be derived from MEikStatusPaneObserver, and the observer must implement method HandleStatusPaneSizeChange(). This event notifies the observer that the status pane size has changed.

Note that CAknAppUi sets itself as observer. If you call SetObserver, then AppUI does not receive those events. So it is not recommended to overwrite observer in case of avkon applications.

In the example, CMyClass observes the status pane events.

class CMyClass : public CBase, MEikStatusPaneObserver
     {
     …
     // From MEikStatusPaneObserver
     void HandleStatusPaneSizeChange();     
     …
     };

Access the status pane, and set CMyClass as an observer.

void CMyClass::Construct()
     {
     …
     // Get a pointer to status pane
     CEikStatusPane* sp = STATIC_CAST( CAknAppUi*, CEikonEnv::Static()->EikAppUi() )->StatusPane();
     // Register this object as a status pane observer
     sp->SetObserver( this );
     …
     }

The HandleStatusPaneSizeChange() receives status pane events.

void CMyClass::HandleStatusPaneSizeChange()
     {
     // Do event handling code here…
     }

Error handling

Status Pane API uses standard Symbian OS error reporting mechanism. Possible panic circumstances and panic codes are indicated in class or method descriptions.

Leaves and system wide error codes as function return values are used if the error is recoverable. A client application can handle these errors similarly as a normal Symbian platform application.

Memory overhead

The amount of reserved memory for application owned navigation pane controls depend on the application, but despite the application the amount of reserved memory is relatively small.

Limitations of the API

None.


Copyright © Nokia Corporation 2001-2008
Back to top