diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-2D390781-4467-403D-8FFC-8ED5B2319993.dita --- a/Symbian3/PDK/Source/GUID-2D390781-4467-403D-8FFC-8ED5B2319993.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-2D390781-4467-403D-8FFC-8ED5B2319993.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,112 +1,112 @@ - - - - - -Creating -the toolbar extension -

The toolbar extension is intended for expanding fixed and floating toolbars. -It is dependent on the parent toolbar it is located in.

-

You must define the toolbar extension in resource definitions. You can -add the extension to your toolbar either in resource definitions or dynamically -during program execution like other toolbar items.

-

Use the AVKON_TOOLBAR_EXTENSION resource structure when -defining the toolbar extension. The extension structure should be defined -in the actual toolbar’s TBAR_CTRL structure when defining -the toolbar items in the resources. If you add the extension dynamically to -the toolbar, use the extension structure resource ID when creating it.

-

The example below shows how to add a toolbar extension as the last item -to the view toolbar.

- -void CMyAppView::AddExtensionToToolbarL() - { - CAknToolbar* toolbar = Toolbar(); - if ( toolbar ) - { - CAknToolbarExtension* toolbarExtension = - CAknToolbarExtension::NewL( R_MYAPP_TOOLBAR_EXTENSION ); - toolbar->AddItemL( toolbarExtension, EAknCtToolbarExtension, 0, 0 ); - } - } - -

You can also give the icon bitmap and skin ID information in the resource -structure. This way you can change the default extension icon to an application -specific icon. You can give separate bitmap or skin ID definitions to normal, -pressed, and dimmed states.

-

The example below shows the definition of a toolbar extension with a custom -icon and three extension buttons.

- -RESOURCE AVKON_TOOLBAR_EXTENSION r_myapp_toolbar_extension - { - - bmpFile = AVKON_BITMAP_FILE; - bmpId = EMbmAvkonQgn_indi_navi_arrow_left; - bmpMask = EMbmAvkonQgn_indi_navi_arrow_left_mask; - bmpSkinIdMajor = EAknsMajorAvkon; - bmpSkinIdMinor = EAknsMinorQgnIndiNaviArrowLeft; - - items = - { - TBAR_CTRL - { - type = EAknCtButton; - id = ECmdExtFirst; - control = AVKON_BUTTON - { - flags = 0; - states = - { - AVKON_BUTTON_STATE - { - extension = r_myapp_toolbar_ext_first; - } - }; - }; - }, - TBAR_CTRL - { - type = EAknCtButton; - id = ECmdExtSecond; - control = AVKON_BUTTON - { - flags = 0; - states = - { - AVKON_BUTTON_STATE - { - extension = r_myapp_toolbar_ext_second; - } - }; - }; - }, - TBAR_CTRL - { - type = EAknCtButton; - id = ECmdExtThird; - control = AVKON_BUTTON - { - flags = 0; - states = - { - AVKON_BUTTON_STATE - { - extension = r_myapp_toolbar_ext_third; - } - }; - }; - } - }; - } - -

The toolbar extension events are provided to the observer of the parent -toolbar in the same manner as the actual toolbar events. Therefore you don't -need to (or are able to) set an observer to the toolbar extension separately. -For more information, see Handling -toolbar item events.

+ + + + + +Creating +the toolbar extension +

The toolbar extension is intended for expanding fixed and floating toolbars. +It is dependent on the parent toolbar it is located in.

+

You must define the toolbar extension in resource definitions. You can +add the extension to your toolbar either in resource definitions or dynamically +during program execution like other toolbar items.

+

Use the AVKON_TOOLBAR_EXTENSION resource structure when +defining the toolbar extension. The extension structure should be defined +in the actual toolbar’s TBAR_CTRL structure when defining +the toolbar items in the resources. If you add the extension dynamically to +the toolbar, use the extension structure resource ID when creating it.

+

The example below shows how to add a toolbar extension as the last item +to the view toolbar.

+ +void CMyAppView::AddExtensionToToolbarL() + { + CAknToolbar* toolbar = Toolbar(); + if ( toolbar ) + { + CAknToolbarExtension* toolbarExtension = + CAknToolbarExtension::NewL( R_MYAPP_TOOLBAR_EXTENSION ); + toolbar->AddItemL( toolbarExtension, EAknCtToolbarExtension, 0, 0 ); + } + } + +

You can also give the icon bitmap and skin ID information in the resource +structure. This way you can change the default extension icon to an application +specific icon. You can give separate bitmap or skin ID definitions to normal, +pressed, and dimmed states.

+

The example below shows the definition of a toolbar extension with a custom +icon and three extension buttons.

+ +RESOURCE AVKON_TOOLBAR_EXTENSION r_myapp_toolbar_extension + { + + bmpFile = AVKON_BITMAP_FILE; + bmpId = EMbmAvkonQgn_indi_navi_arrow_left; + bmpMask = EMbmAvkonQgn_indi_navi_arrow_left_mask; + bmpSkinIdMajor = EAknsMajorAvkon; + bmpSkinIdMinor = EAknsMinorQgnIndiNaviArrowLeft; + + items = + { + TBAR_CTRL + { + type = EAknCtButton; + id = ECmdExtFirst; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + extension = r_myapp_toolbar_ext_first; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = ECmdExtSecond; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + extension = r_myapp_toolbar_ext_second; + } + }; + }; + }, + TBAR_CTRL + { + type = EAknCtButton; + id = ECmdExtThird; + control = AVKON_BUTTON + { + flags = 0; + states = + { + AVKON_BUTTON_STATE + { + extension = r_myapp_toolbar_ext_third; + } + }; + }; + } + }; + } + +

The toolbar extension events are provided to the observer of the parent +toolbar in the same manner as the actual toolbar events. Therefore you don't +need to (or are able to) set an observer to the toolbar extension separately. +For more information, see Handling +toolbar item events.

\ No newline at end of file