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

📄 viewserverappview.cpp

📁 一个用户视图创建的程序
💻 CPP
字号:
/* ====================================================================
 * File: ViewServerAppView.cpp
 * Created: 07/04/05
 * Author: 
 * Copyright (c): , All rights reserved
 * ==================================================================== */

#include <coemain.h>
#include <eikenv.h>
#include <aknappui.h>
#include <w32std.h>
#include <e32std.h>
#include <ViewServer.rsg>

#include "ViewServerAppView.h"
#include "ViewServerAppUi.h"
#include "Settings.h"


// Standard construction sequence
CViewServerAppView* CViewServerAppView::NewL(const TRect& aRect) {
  CViewServerAppView* self = CViewServerAppView::NewLC(aRect);
  CleanupStack::Pop(self);
  return self;
}

CViewServerAppView* CViewServerAppView::NewLC(const TRect& aRect) {
  CViewServerAppView* self = new (ELeave) CViewServerAppView;
  CleanupStack::PushL(self);
  self->ConstructL(aRect);
  return self;
}

CViewServerAppView::CViewServerAppView() {

}

CViewServerAppView::~CViewServerAppView() {

}

void CViewServerAppView::ConstructL(const TRect& aRect) {
  // Create a window for this application view
  CreateWindowL();

  // Set the windows size
  SetRect(aRect);

  // Activate the window, which makes it ready to be drawn
  ActivateL();
}

// Draw this application's view to the screen
void CViewServerAppView::Draw(const TRect& /*aRect*/) const {
  CWindowGc& gc = SystemGc();
  TRect rect = Rect();
  TPoint point(0,0);
  const CFont* font = iEikonEnv->NormalFont();
  _LIT(KTitle,"ViewServer - View One");
  _LIT(KCredit,"by Rawsocket.org");

  gc.SetBrushColor(KRgbBlack);
  gc.Clear(rect);
  gc.SetPenColor(KRgbWhite);
  gc.UseFont(font);
  
  point.iX = rect.Width()/2 - font->TextWidthInPixels(KTitle)/2;
  point.iY = rect.Height()/2;
  
  gc.DrawText(KTitle,point);
  gc.DiscardFont();
  font = iEikonEnv->AnnotationFont();
  
  point.iX = rect.Width()/2 - font->TextWidthInPixels(KCredit)/2;
  point.iY += font->AscentInPixels() + 10;
  
  gc.UseFont(font);
  gc.DrawText(KCredit,point);
  gc.DiscardFont();
}

TVwsViewId CViewServerAppView::ViewId() const {
   return TVwsViewId(KUidViewServerApp,KViewId);
}

void CViewServerAppView::ViewActivatedL(const TVwsViewId& /*aPrevViewId*/,
                                    TUid /*aCustomMessageId*/,
                                    const TDesC8& /*aCustomMessage*/) {
  Window().SetOrdinalPosition(0);
  MakeVisible(ETrue);
}

void CViewServerAppView::ViewDeactivated() {
  MakeVisible(EFalse);
}

⌨️ 快捷键说明

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