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

📄 welcome_appview.cpp

📁 如题 就是 这东西 为什么非要我 说到 20个 字 呢 看看这回 够 不
💻 CPP
字号:
// welcome_AppView.cpp
//
// Copyright (c) 1999-2007 Symbian Software Ltd.  All rights reserved.
//
// $Change: 937687 $

////////////////////////////////////////////////////////////////////////
//
// Source file for the implementation of the 
// application view class - CExampleAppView
//
////////////////////////////////////////////////////////////////////////

// SYSTEM HEADERS
#include <eiklabel.h>

// PROJECT HEADERS
#include "welcome.h"

// Constructor for the view.
CExampleAppView::CExampleAppView()
    {
    }

// Static NewL() function to start the standard two phase construction.
CExampleAppView* CExampleAppView::NewL(const TRect& aRect)
    {
    CExampleAppView* self = new(ELeave) CExampleAppView();
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    CleanupStack::Pop(self);
    return self;
    }

// Destructor for the view.
CExampleAppView::~CExampleAppView()
    {
    delete iLabel;
    delete iExampleText;
    }

// Second phase construction.
void CExampleAppView::ConstructL(const TRect& aRect)
    {
    // Fetch the text from the resource file.
    iExampleText = iEikonEnv->AllocReadResourceL(R_EXAMPLE_TEXT_HELLO);

    // Control is a window owning control
    CreateWindowL();
    // Extent of the control. This is the whole rectangle available to
    // application. The rectangle is passed to us from the application UI.

    iLabel = new(ELeave) CEikLabel;
    iLabel->SetTextL(*iExampleText);
    iLabel->SetAlignment(EHCenterVCenter);

    SetRect(aRect);

    // At this stage, the control is ready to draw so
    // we tell the UI framework by activating it.

    TRect labelRect(aRect);
    labelRect.Shrink(10,10);               
    iLabel->SetRect(labelRect);

    ActivateL();
    }

// Returns the number of control components. 
TInt CExampleAppView::CountComponentControls() const
    {
    return(1);
    }

// Returns a pointer to the component control at index aIndex in the component control list.
// Does not imply transfer of ownership.
CCoeControl* CExampleAppView::ComponentControl(TInt /*aIndex*/) const
    {
    return(iLabel);
    }


// Drawing the view - in this example, consists of drawing a simple outline rectangle
// and then drawing the text in the middle. We use the Normal font supplied by the UI.

// In this example, we don't use the redraw region because it's easier to redraw to
// the whole client area.
void CExampleAppView::Draw(const TRect& /*aRect*/) const
    {
    // Window graphics context
    CWindowGc& gc = SystemGc();

    // Area in which we shall draw
    TRect drawRect = Rect();
    
    // Start with a clear screen
    gc.Clear();
    // Draw an outline rectangle (the default pen
    // and brush styles ensure this) slightly
    // smaller than the drawing area.
    drawRect.Shrink(10, 10);               
    gc.DrawRect(drawRect);
    }

⌨️ 快捷键说明

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