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

📄 aknexlistsettingcontainer.cpp

📁 Symbian手机编程
💻 CPP
📖 第 1 页 / 共 2 页
字号:
            break;
        default:
            {
            break;
            }

        }

    switch (iOutlineId)
        {
        case EAknExListCmdOutline74:
            {
            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 EAknExListCmdOutline23:
            {
            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 )
        {
        return iListBox->OfferKeyEventL( aKeyEvent, aType );
        }
    else
        {
        return EKeyWasNotConsumed;
        }
    }

// ----------------------------------------------------------------------------
// void CAknExListSettingContainer::GraphicIconL( CArrayPtr<CGulIcon>* )
// Appends graphics data.
// ----------------------------------------------------------------------------
//
void CAknExListSettingContainer::GraphicIconL( CArrayPtr<CGulIcon>* aIcons )
    {
    if ( aIcons )
        {
        // Graphics for marking.
        aIcons->AppendL( iEikonEnv->CreateIconL( KAknExListMbmFileName,
                                                 EMbmAknexlistProp_group_small,
                                                 EMbmAknexlistProp_group_small_m));
                                                 //EMbmAknexlistM,
                                                 //    EMbmAknexlistMm ) );
        }
    }

// ----------------------------------------------------------------------------
// void CAknExListSettingContainer::SetCountAndAddItemL( const TKeyEvent& )
// Sets count of added list items and calls AddItemL().
// ----------------------------------------------------------------------------
//
void CAknExListSettingContainer::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_SETTING );

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

// ----------------------------------------------------------------------------
// void CAknExListSettingContainer::SetCountAndRemoveItemL( const TKeyEvent& )
// Sets count of removed list items and calls RemoveItemL().
// ----------------------------------------------------------------------------
//
void CAknExListSettingContainer::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 CAknExListSettingContainer::SizeChanged()
// Called by framework when the view size is changed.
// ----------------------------------------------------------------------------
//
void CAknExListSettingContainer::SizeChanged()
    {
    if ( iListBox )
        {
        iListBox->SetRect( Rect() ); // Sets rectangle of lstbox.
        }
    }

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

    if ( iListBox )
        {
        count++;
        }

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

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

// End of File

⌨️ 快捷键说明

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