diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-6113CC3B-F994-4AA8-81E9-50433A3266E2.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-6113CC3B-F994-4AA8-81E9-50433A3266E2.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,57 @@ + + + + + +Adding +and removing toolbar extension items +

The toolbar extension can basically hold the same items as the toolbar +itself. However, the floating toolbar extension can only have focusable buttons. +A fixed toolbar extension does not naturally have focus since its parent toolbar +is not focusing.

+

The toolbar extension can have a variable number of items. They are located +from the upper left (right in mirrored layout) corner. If all items cannot +fit into the extension, items from the end will be dropped.

+

You can add items to the toolbar extension in the similar way as to a toolbar, +either by defining TBAR_CTRL resource structures in the resource +file or adding the items dynamically by using toolbar extension functions.

+

You can also remove items from the extension.

+

The example below shows how to add an item to the toolbar extension as +the first item.

+void CMyAppView::AddItemAsFirstToToolbarExtensionL() + { + CAknToolbar* toolbar = Toolbar(); + if ( toolbar ) + { + CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension(); + if ( toolbarExtension ) + { + CAknButton* newButton = CAknButton::NewL( R_MYAPP_EXTENSION_BUTTON ); + // Last parameter tells the index at where to add new item + toolbarExtension->AddItemL( + newButton, EAknCtButton, KExtensionButtonId, 0, 0 ); + } + } + } + +

The example below shows how to remove an item from the toolbar extension.

+void CMyAppView::RemoveItemFromToolbarExtensionL() + { + CAknToolbar* toolbar = Toolbar(); + if ( toolbar ) + { + CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension(); + if ( toolbarExtension ) + { + toolbarExtension->RemoveItemL( KExtensionButtonId ); + } + } + } + +
\ No newline at end of file