⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aknexlistformcontainer.cpp

📁 Symbian手机编程
💻 CPP
📖 第 1 页 / 共 2 页
字号:
                        tabGroup->TabIdFromIndex(
                            tabGroup->ActiveTabIndex() ) );
                    return EKeyWasConsumed;
                    }
                }
            break;
        default:
            break;
        }

    switch (iOutlineId)
        {
        case EAknExListCmdOutline67:
            {
            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 EAknExListCmdOutline17:
        case EAknExListCmdOutline20:
            {
            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;
            }
        default:
            {
            break;
            }
        }
        
    if ( iListBox )
        {
        if ( iFindBox )
            {
            TBool needRefresh( EFalse );

            // Offers the key event to find box.
            if ( AknFind::HandleFindOfferKeyEventL( aKeyEvent, aType, this,
                                                    iListBox, iFindBox, ETrue,
                                                    needRefresh ) ==
                EKeyWasConsumed )
                {
                if ( needRefresh )
                    {
                    SizeChanged();
                    DrawNow();
                    }

                return EKeyWasConsumed;
                }
            }

        return iListBox->OfferKeyEventL( aKeyEvent, aType );
        }
    else
        {
        return EKeyWasNotConsumed;
        }
    }

// ----------------------------------------------------------------------------
// void CAknExListFormContainer::GraphicIconL( CArrayPtr<CGulIcon>* )
// Appends graphics data.
// ----------------------------------------------------------------------------
//
void CAknExListFormContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
    {
    if ( aIcons )
        {
        // Appends icon according to iOutlineId.
        switch ( iOutlineId )
            {
            case EAknExListCmdOutline18:
            case EAknExListCmdOutline21:
            case EAknExListCmdOutline57:
            case EAknExListCmdOutline58:
                aIcons->AppendL( iEikonEnv->CreateIconL( KAknExListMbmFileName,
                                                         EMbmAknexlistMarked_add,
                                                         EMbmAknexlistMarked_add_m ) );
                aIcons->AppendL(
                    iEikonEnv->CreateIconL( KAknExListMbmFileName,
                                            EMbmAknexlistGolgo2,
                                            EMbmAknexlistGolgo2m ) );
                break;
            case EAknExListCmdOutline55:
                aIcons->AppendL( iEikonEnv->CreateIconL( KAknExListMbmFileName,
                                                         EMbmAknexlistMarked_add,
                                                         EMbmAknexlistMarked_add_m ) );
                aIcons->AppendL(
                    iEikonEnv->CreateIconL( KAknExListMbmFileName,
                                            EMbmAknexlistGolgo3,
                                            EMbmAknexlistGolgo3m ) );
                break;
            default:
                break;
            }
        }
    }

// ----------------------------------------------------------------------------
// void CAknExListFormContainer::SetCountAndAddItemL( const TKeyEvent& )
// Sets count of added list items and calls AddItemL().
// ----------------------------------------------------------------------------
//
void CAknExListFormContainer::SetCountAndAddItemL( const TKeyEvent& aKeyEvent )
    {
    if ( iListBox )
        {
        TInt addCount( KAknExListAddInitCount );

        // Sets number(addCount) of adding list items
        switch ( aKeyEvent.iCode )
            {
            case AKNEXLIST_ADDINGTYPE1_KEY: // 'a' key.
                addCount = KAknExListNumberOfItemType1;
                break;
            case AKNEXLIST_ADDINGTYPE2_KEY: // 'z' key.
                addCount = KAknExListNumberOfItemType2;
                break;
            case AKNEXLIST_ADDINGTYPE3_KEY: // 'x' key.
                addCount = KAknExListNumberOfItemType3;
                break;
            case AKNEXLIST_ADDINGTYPE4_KEY: // 'c' key.
                addCount = KAknExListNumberOfItemType4;
                break;
            case AKNEXLIST_ADDINGTYPE5_KEY: // 'v' key.
                addCount = KAknExListNumberOfItemType5;
                break;
            default:
                break;
            }

        if ( addCount )
            {
            // Adds list items.
            CTextListBoxModel* model = iListBox->Model();
            AddItemL( iListBox, model, addCount, R_AKNEXLIST_ADD_ITEM_DOUBLE );

            // Displays information for total number of list items.
            CountMessage( model );
            }
        }
    }

// ----------------------------------------------------------------------------
// void CAknExListFormContainer::SetCountAndRemoveItemL( const TKeyEvent& )
// Sets count of removed list items and calls RemoveItemL().
// ----------------------------------------------------------------------------
//
void CAknExListFormContainer::SetCountAndRemoveItemL(
    const TKeyEvent& aKeyEvent )
    {
    if ( iListBox )
        {
        TInt removeCount( KAknExListRemoveInitCount );

        // Sets number(removeCount) of removing list items.
        switch ( aKeyEvent.iCode )
            {
            case AKNEXLIST_REMOVINGTYPE1_KEY: // 'd' key.
                removeCount = KAknExListNumberOfItemType1;
                break;
            case AKNEXLIST_REMOVINGTYPE2_KEY: // 'p' key.
                removeCount = KAknExListNumberOfItemType2;
                break;
            case AKNEXLIST_REMOVINGTYPE3_KEY: // 'o' key.
                removeCount = KAknExListNumberOfItemType3;
                break;
            case AKNEXLIST_REMOVINGTYPE4_KEY: // 'i' key.
                removeCount = KAknExListNumberOfItemType4;
                break;
            case AKNEXLIST_REMOVINGTYPE5_KEY: // 'u' key.
                removeCount = KAknExListNumberOfItemType5;
                break;
            default:
                break;
            }

        if ( removeCount )
            {
            // Removes list items.
            CTextListBoxModel* model = iListBox->Model();
            RemoveItemL( iListBox, model, removeCount );

            // Displays information for total number of list items.
            CountMessage( model );
            }
        }
    }

// ----------------------------------------------------------------------------
// void CAknExListFormContainer::SizeChanged()
// Called by framework when the view size is changed.
// ----------------------------------------------------------------------------
//
void CAknExListFormContainer::SizeChanged()
    {
    if ( iListBox )
        {
        if ( iFindBox )
            {
            // Calls HandleFindSizeChanged after creates findbox.
            AknFind::HandlePopupFindSizeChanged(this, iListBox, iFindBox);
            }
        else
            {
            iListBox->SetRect( Rect() ); // Sets rectangle of lstbox.
            }
        }
    }

// ----------------------------------------------------------------------------
// TInt CAknExListFormContainer::CountComponentControls() const
// Returns number of components.
// ----------------------------------------------------------------------------
//
TInt CAknExListFormContainer::CountComponentControls() const
    {
    TInt count( KAknExListInitCount );

    if ( iListBox )
        {
        count++;
        }

    if ( iFindBox )
        {
        count++;
        }

    return count; // Returns number of controls inside this container.
    }

// ----------------------------------------------------------------------------
// CCoeControl* CAknExListFormContainer::ComponentControl( TInt ) const
// Returns pointer to particular component.
// ----------------------------------------------------------------------------
//
CCoeControl* CAknExListFormContainer::ComponentControl( TInt aIndex ) const
    {
    switch ( aIndex )
        {
        case EAknExListComponentListBox:
            return iListBox; // Returns the pointer to listbox object.
        case EAknExListComponentFindBox:
            return iFindBox; // Returns the pointer to findbox object.
        default:
            return NULL; // Exception : Returns NULL.
        }
    }

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -