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

📄 simpleex_view.cpp

📁 symbian下的几个小例子。。很值得学习
💻 CPP
字号:
// simpleEx_view.cpp
//
// Copyright (c) Symbian Software Ltd 1999 - 2007.  All rights reserved.
//

/*=================================================================

      File: simpleEx_view.cpp

      This file contains the application view class for SimpleEx.

==================================================================*/

#include "eikenv.h"
#include <coemain.h>

#include "SimpleEx.h"
#include <SimpleExGui.rsg>
#include <QikCommand.h>


CSimpleExAppView* CSimpleExAppView::NewL(CQikAppUi& aAppUi)
    {
    CSimpleExAppView* self = CSimpleExAppView::NewLC(aAppUi);
    CleanupStack::Pop(self);
    return self;
    }

CSimpleExAppView* CSimpleExAppView::NewLC(CQikAppUi& aAppUi)
    {
    CSimpleExAppView* self = new (ELeave) CSimpleExAppView(aAppUi);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

CSimpleExAppView::CSimpleExAppView(CQikAppUi& aAppUi) 
    : CQikViewBase(aAppUi, KNullViewId)
    {
    }

void CSimpleExAppView::ConstructL()
    {

    BaseConstructL();
    iTextColor=KRgbBlack;
    iCoeEnv->ReadResource(iDisplayText,R_EXAMPLE_TEXT);  
    }

void CSimpleExAppView::ViewConstructL()
    {
    // Loads information about the UI configurations this view supports
    // together with definition of each view.	
    ViewConstructFromResourceL(R_SIMPLEEX_CONFIGURATIONS);
    }


TVwsViewId CSimpleExAppView::ViewId()const
    {
    return TVwsViewId(KUidSimpleExApp, KUidSimpleExView);
    }

void CSimpleExAppView::Draw(const TRect& ) const
    {

    CWindowGc& gc = SystemGc();   
    const CFont*     font;
    TRect drawRect = Rect();
        
    gc.Clear();

    font = iEikonEnv->TitleFont();
    gc.UseFont(font);
    TInt   baselineOffset=(drawRect.Height() - font->HeightInPixels())/2; 

    gc.SetPenColor(iTextColor);
    gc.DrawText(iDisplayText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
    
    gc.DiscardFont();

    }

void CSimpleExAppView::HandleCommandL(CQikCommand& aCommand)
    {

    switch(aCommand.Id())
        {  
        case ESimpleExCommand:
            {
            HBufC* message = iCoeEnv->AllocReadResourceAsDes16L(R_START_SELECTED);
            iEikonEnv->AlertWin(*message);
            delete message;
            break;
            }
        case ESimpleExDialog:
            CSimpleExDialog::RunDlgLD(iDisplayText,iTextColor);
            DrawNow();
            break;
        default:
            CQikViewBase::HandleCommandL(aCommand);
        }
    }
             

⌨️ 快捷键说明

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