📄 aknexlistcolumncontainer.cpp
字号:
resourceId = R_AKNEXLIST_SINGLE_SUB;
iListBox = new( ELeave ) CAknSingleStyleListBox();
iListBox->SetListBoxObserver( this );
break;
default:
break;
}
if ( iListBox )
{
// Sets ListBox.
if ( resourceId )
{
SetListBoxFromResourceL( iListBox, resourceId );
}
else
{
SetListBoxFromInnerDescriptionL( iListBox );
}
if ( flagsOfFindBox )
{
// Sets style of findbox.
CAknSearchField::TSearchFieldStyle style(
CAknSearchField::ESearch );
if ( flagsOfPopup )
{
style = CAknSearchField::EPopup;
}
// Creates FindBox.
iFindBox = CreateFindBoxL( iListBox, iListBox->Model(), style );
if ( iFindBox && style == CAknSearchField::EPopup )
{
// Popup findbox is not shown when listbox display initial.
iFindBox->MakeVisible( EFalse );
}
}
SizeChanged();
if ( flagsOfNumber )
{
// Automatic numbering.
AutoNumberingL( iListBox );
}
if ( flagsOfGraphic )
{
// Creates graphic.
SetGraphicIconL( iListBox );
}
if ( emptyResourceId )
{
// Sets empty text.
SetEmptyListL( iListBox, emptyResourceId );
}
//ActivateL();
iListBox->ActivateL();
if ( iFindBox && flagsOfPopup )
{
// For window owning overlay control when findbox is popup.
iFindBox->ActivateL();
}
// Update scrollbar in order to draw correct scroll bar.
UpdateScrollBar(iListBox);
}
DrawNow();
if ( messageId )
{
InfoMessage( messageId ); // Displays information message.
}
}
// ----------------------------------------------------------------------------
// TKeyResponse CAknExListColumnContainer::OfferKeyEventL( const TKeyEvent&,
// TEventCode )
// Handles the key events.
// ----------------------------------------------------------------------------
//
TKeyResponse CAknExListColumnContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,
TEventCode aType )
{
if ( aType != EEventKey ) // Is not key event?
{
return EKeyWasNotConsumed;
}
CAknTabGroup* tabGroup = iView->TabGroup();
TChar charCode(aKeyEvent.iCode);
switch ( charCode ) // The code of key event is...
{
case EKeySpace: // Space key.
iView->DisplayNextOutlineL();
return EKeyWasConsumed;
// Switches tab.
case EKeyLeftArrow: // Left key.
case EKeyRightArrow: // Right Key.
if ( tabGroup ) // Is tab group created?
{
if ( tabGroup->OfferKeyEventL( aKeyEvent, aType ) ==
EKeyWasConsumed )
{
iView->SwitchDisplayOutlineL(
tabGroup->TabIdFromIndex(
tabGroup->ActiveTabIndex() ) );
return EKeyWasConsumed;
}
}
break;
default:
break;
}
switch (iOutlineId)
{
case EAknExListCmdOutline66:
{
if (charCode == AKNEXLIST_ADDINGTYPE1_KEY ||
charCode == AKNEXLIST_ADDINGTYPE2_KEY ||
charCode == AKNEXLIST_ADDINGTYPE3_KEY ||
charCode == AKNEXLIST_ADDINGTYPE4_KEY ||
charCode == AKNEXLIST_ADDINGTYPE5_KEY)
{
SetCountAndAddItemL( aKeyEvent ); // Adds list item.
return EKeyWasConsumed;
}
else if (charCode == AKNEXLIST_REMOVINGTYPE1_KEY ||
charCode == AKNEXLIST_REMOVINGTYPE2_KEY ||
charCode == AKNEXLIST_REMOVINGTYPE3_KEY ||
charCode == AKNEXLIST_REMOVINGTYPE4_KEY ||
charCode == AKNEXLIST_REMOVINGTYPE5_KEY)
{
SetCountAndRemoveItemL( aKeyEvent ); // Removes list item.
return EKeyWasConsumed;
}
break;
}
case EAknExListCmdOutline44:
{
if (charCode == AKNEXLIST_ICONPRIORITY_KEY)
{
// Confirms priority of additional icons.
AdditionalIconPriorityL();
return EKeyWasConsumed;
}
break;
}
case EAknExListCmdOutline10:
case EAknExListCmdOutline14:
{
if (charCode == AKNEXLIST_AUTONUMBERING_KEY)
{
// Automatic numbering.
AutoNumberingL( iListBox );
// Updates listbox.
iListBox->DrawNow();
// Displays information message.
InfoMessage( R_AKNEXLIST_AUTO_NUMBERING_MSG );
return EKeyWasConsumed;
}
break;
}
case EAknExListCmdOutline30T1:
case EAknExListCmdOutline30T2:
case EAknExListCmdOutline31:
{
if (charCode == AKNEXLIST_MARKEDINDEX_KEY)
{
// Displays message of marked item index.
if (iListBox)
{
InfoMarkedItemIndexL(iListBox->SelectionIndexes());
}
return EKeyWasConsumed;
}
break;
}
default:
{
break;
}
}
if ( iListBox )
{
if ( iFindBox )
{
TBool needRefresh( EFalse );
TBool flagsOfPopup( EFalse );
if ( iOutlineId == EAknExListCmdOutline41T2 )
{
flagsOfPopup = ETrue;
}
// Offers the key event to find box.
if ( AknFind::HandleFindOfferKeyEventL( aKeyEvent, aType, this,
iListBox, iFindBox,
flagsOfPopup,
needRefresh ) ==
EKeyWasConsumed )
{
if ( needRefresh )
{
SizeChangedForFindBox();
DrawNow();
}
return EKeyWasConsumed;
}
}
return iListBox->OfferKeyEventL( aKeyEvent, aType );
}
else
{
return EKeyWasNotConsumed;
}
}
// ----------------------------------------------------------------------------
// void CAknExListColumnContainer::HandleListBoxEventL( CEikListBox*,
// TListBoxEvent )
// Handles listbox event.
// ----------------------------------------------------------------------------
void CAknExListColumnContainer::HandleListBoxEventL(
CEikListBox* /*aListBox*/,
TListBoxEvent aEventType )
{
if ( ( aEventType == MEikListBoxObserver::EEventEnterKeyPressed ) ||
( aEventType == MEikListBoxObserver::EEventItemClicked ) )
{
if ( iOutlineId == EAknExListCmdOutline27 )
{
// Displays information message.
InfoMessage( R_AKNEXLIST_ITEM_OPEN );
}
else if ( iOutlineId == EAknExListCmdOutline80 )
{
// Gets current selected item index.
TInt currentItem( iListBox->CurrentItemIndex() );
switch ( currentItem )
{
case EKAknExListItemIndex0:
{
// Displays information message.
InfoMessage( R_AKNEXLIST_ITEM_OPEN );
}
break;
case EKAknExListItemIndex1:
// Displays Sub of OUTLINE80 screen.
DisplayListBoxL( EAknExListCmdOutline80Sub );
break;
default:
break;
}
}
else if ( iOutlineId == EAknExListCmdOutline80Sub )
{
// Gets current selected item index.
TInt currentItem( iListBox->CurrentItemIndex() );
if ( currentItem == EKAknExListItemIndex0 )
{
// Displays OUTLINE80 screen.
DisplayListBoxL( EAknExListCmdOutline80 );
}
}
}
}
// ----------------------------------------------------------------------------
// void CAknExListColumnContainer::SetLabelL( const TInt )
// Creates and sets label control object.
// ----------------------------------------------------------------------------
//
void CAknExListColumnContainer::SetLabelL( const TInt aResourceId )
{
// Sets start screen label.
if ( !iLabel )
{
TBuf<KAknExListLabelBufLength> initFormat( 0 );
iCoeEnv->ReadResource( initFormat, aResourceId );
iLabel = new( ELeave ) CEikLabel();
iLabel->SetContainerWindowL( *this );
iLabel->SetTextL( initFormat );
iLabel->SetFont( LatinBold19() );
iLabel->SetAlignment( EHCenterVCenter );
SizeChanged();
}
}
// ----------------------------------------------------------------------------
// void CAknExListColumnContainer::GraphicIconL( CArrayPtr<CGulIcon>* )
// Appends graphics data.
// ----------------------------------------------------------------------------
//
void CAknExListColumnContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
{
if ( aIcons )
{
// Appends icon according to iOutlineId.
switch ( iOutlineId )
{
case EAknExListCmdOutline12:
case EAknExListCmdOutline13:
case EAknExListCmdOutline30T1:
case EAknExListCmdOutline30T2:
case EAknExListCmdOutline33:
case EAknExListCmdOutline41T1:
case EAknExListCmdOutline45:
case EAknExListCmdOutline49:
case EAknExListCmdOutline50:
case EAknExListCmdOutline63:
case EAknExListCmdOutline78:
aIcons->AppendL( iEikonEnv->CreateIconL( KAknExListMbmFileName,
EMbmAknexlistMarked_add,
EMbmAknexlistMarked_add_m ) );
aIcons->AppendL(
iEikonEnv->CreateIconL( KAknExListMbmFileName,
EMbmAknexlistGolgo3,
EMbmAknexlistGolgo3m ) );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -