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

📄 conslauncherappview.cpp

📁 《SymbianOSC手机应用开发》源码
💻 CPP
字号:
/* Copyright (c) 2003 Symbian Software Ltd. All rights reserved */

#include <coemain.h>

#include "ConsLauncherAppView.h"

#include <ConsLauncher.rsg>

#include <eiktxlbm.h>

CConsLauncherAppView::CConsLauncherAppView()
    { // No implementation required
    }

CConsLauncherAppView::~CConsLauncherAppView()
    {
    delete iTextListBox;
    }

void CConsLauncherAppView::ConstructL(const TRect& aRect,  CDir* aCDir)
    {
    CreateWindowL();
    SetRect(aRect);
	SetBlank();
    iTextListBox = new(ELeave) CEikTextListBox;
    iTextListBox->ConstructL(this,0);
    iTextListBox->CreateScrollBarFrameL();
    iTextListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
    iTextListBox->SetBorder(TGulBorder::EDeepSunken);
    TRect lbRect = Rect();
    lbRect.Shrink(10,10);
    iTextListBox->SetRect(lbRect);
    iNamesArray = static_cast<CDesCArray*>(iTextListBox->Model()->ItemTextArray());
    AppendItemsL(aCDir);
    ActivateL();
    }

TKeyResponse CConsLauncherAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
	{
    return iTextListBox->OfferKeyEventL(aKeyEvent,aType);
	}
	
	
void CConsLauncherAppView::AppendItemsL(const CDir* aFileList)
    {
    TInt n = 0;
    if (aFileList)
        {
        n = aFileList->Count();
        }
    if (n>0)
        {
        for (TInt i = 0; i < n; i++)
            {
            TPtrC ThisName = (*aFileList)[i].iName;
            iNamesArray->AppendL(ThisName);
            }
        }
    else
        {
        HBufC* msg=iCoeEnv->AllocReadResourceLC(R_CONSLAUNCHER_TEXT_NOTFOUND);
        iNamesArray->AppendL(*msg);
        CleanupStack::PopAndDestroy(msg);
        }
    iTextListBox->HandleItemAdditionL();
    iTextListBox->SetCurrentItemIndex(0);
    iTextListBox->SetFocus(ETrue);
    }

CCoeControl* CConsLauncherAppView::ComponentControl(TInt /* aIndex */) const
    {
    return iTextListBox;
    }
  
TInt CConsLauncherAppView::CountComponentControls() const
    {
    return 1;
    }

TInt CConsLauncherAppView::GetCurrentItem()
    {
    return iTextListBox->CurrentItemIndex();
    }

⌨️ 快捷键说明

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