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

📄 singlelistbox.cpp

📁 0S9.平台任务管理.内存监控示例.还sign后才可以安装
💻 CPP
字号:
#include "ListBoxProxy.h"

#include <eiktxlbm.h>   // CTextListBoxModel
#include <eikclbd.h>    // CColumnListBoxData

void CSingleListBox::ConstructL(CCoeControl* aParent, TInt /*aFlags*/)
{
    CEikColumnListBox::ConstructL(aParent);
}

TInt CSingleListBox::CurrentItemIndex() const
{
    return CEikColumnListBox::CurrentItemIndex();
}

TKeyResponse CSingleListBox::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
{
    return CEikColumnListBox::OfferKeyEventL(aKeyEvent, aType);
}

void CSingleListBox::RefreshL()
{
    CEikColumnListBox::HandleItemRemovalL();
    CEikColumnListBox::HandleItemAdditionL();
    CEikColumnListBox::SetCurrentItemIndex(0);
    CEikColumnListBox::SetFocus(ETrue);
}

void CSingleListBox::SetContainerWindowL(const CCoeControl& aContainer)
{
    CEikColumnListBox::SetContainerWindowL(aContainer);
}

void CSingleListBox::SetItemList(MDesCArray* aTextArray, CArrayPtr<CGulIcon>* aIconArray)
{
    Model()->SetItemTextArray(aTextArray);
    Model()->SetOwnershipType(ELbmDoesNotOwnItemArray);

    CColumnListBoxData* cd = ItemDrawer()->ColumnData();
    cd->SetIconArray(aIconArray);

    cd->SetGraphicsColumnL(0, ETrue);
    cd->SetColumnWidthPixelL(0, 20);
    cd->SetColumnAlignmentL(0, CGraphicsContext::ECenter);

    cd->SetColumnWidthPixelL(1, 120);
    cd->SetColumnAlignmentL(1, CGraphicsContext::ELeft);

    cd->SetColumnWidthPixelL(2, 50);
    cd->SetColumnAlignmentL(2, CGraphicsContext::ELeft);
}

void CSingleListBox::SetListBoxObserver(MEikListBoxObserver* aObserver)
{
    CEikColumnListBox::SetListBoxObserver(aObserver);
}

void CSingleListBox::SetMopParent(MObjectProvider* /*aParent*/)
{}

void CSingleListBox::SetRect(const TRect& aRect)
{
    TInt rectHeight = aRect.Height();
#if   defined(__S80__)
    const TInt height(rectHeight / 6);      // 6 items per screen
#elif defined(__S90__)
    const TInt height(rectHeight / 8);
#elif defined(__UIQ__)
    const TInt height(rectHeight / 10);
#endif

    CEikTextListBox::SetItemHeightL(height);
    CEikColumnListBox::SetRect(aRect);
}

void CSingleListBox::SetScrollBarL()
{
    CEikColumnListBox::CreateScrollBarFrameL();
}

void CSingleListBox::ShowScrollBarL(TBool aShow)
{
    if (CEikTextListBox::ScrollBarFrame())
    {
        if (aShow)
            CEikTextListBox::ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
        else
            CEikTextListBox::ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff);

        CEikTextListBox::UpdateScrollBarsL();
    }
}

CEikListBox* CSingleListBox::This()
{
    return this;
}

⌨️ 快捷键说明

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