亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? oandxappview.cpp

?? 一個類似黑白棋的軟件源碼,可用再symbina上.不錯的
?? CPP
字號:
// Copyright (c) 2004, Symbian Software Ltd. All rights reserved.

#include <coemain.h>
#include <gulutil.h>
#include <e32keys.h>


#include "OandXAppView.h"
#include "OandXAppUi.h"
#include "OandX.pan"
#include "oandxdefs.h"

// Tile member functions

COandXTile::COandXTile()
    {
    }
    
COandXTile::~COandXTile()
    {
    }

void COandXTile::ConstructL(RWindow& aWindow)
    {
    SetContainerWindowL(aWindow);
    // No call to ActivateL() as the window is activated by its container
    }

void COandXTile::Draw(const TRect& /*aRect*/) const
    {
    TInt tileType;
    tileType = iAppView->SquareStatus(this);

    CWindowGc& gc = SystemGc();
    TRect rect = Rect();
    
    if (IsFocused())
        {
        gc.SetBrushColor(KRgbYellow);
        }
    gc.Clear(rect);
    if (tileType!=ETileBlank)
        {
        TSize size;
        size.SetSize(rect.iBr.iX- rect.iTl.iX, rect.iBr.iY - rect.iTl.iY);
        rect.Shrink(size.iWidth/6,size.iHeight/6); // Shrink by about 15%
        gc.SetPenStyle(CGraphicsContext::ESolidPen);
        size.iWidth /= 9; // Pen size set to just over 10% of the shape's size
        size.iHeight /= 9;
        gc.SetPenSize(size);
        if (tileType == ETileNought)
            {
            gc.SetPenColor(KRgbRed);
            gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
            gc.DrawEllipse(rect);
            }
        else // draw a cross
            {
            gc.SetPenColor(KRgbGreen);
            rect.Shrink(size.iWidth/2,size.iHeight/2); // Cosmetic reduction of cross size by half the line width
            gc.DrawLine(rect.iTl, rect.iBr);
            TInt temp;
            temp = rect.iTl.iX;
            rect.iTl.iX = rect.iBr.iX;
            rect.iBr.iX = temp;
            gc.DrawLine(rect.iTl, rect.iBr);
            }
        }
    }

void  COandXTile::SetOwnerAndObserver(COandXAppView* aControl)
    {
    iAppView = aControl;
    SetObserver(aControl);
    }

void COandXTile::TryHitL()
    {
    if (iAppView->TryHitSquareL(this))
        {
        DrawDeferred();
        }
    }

TKeyResponse COandXTile::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    TKeyResponse keyResponse = EKeyWasNotConsumed;
    if (aType!=EEventKey)
        {
        return keyResponse;
        }
    switch (aKeyEvent.iCode)
        {
    case EKeyOK:
        TryHitL();
        keyResponse = EKeyWasConsumed;
        break;
    default:
        keyResponse = EKeyWasNotConsumed;
        break;        
        }
    return keyResponse;
    }

TCoeInputCapabilities COandXTile::InputCapabilities() const
    {
    return TCoeInputCapabilities::ENavigation;
    }

void COandXTile::HandlePointerEventL(const TPointerEvent& aPointerEvent)
    {
    if (aPointerEvent.iType == TPointerEvent::EButton1Down)
        {
        TryHitL();
        }
    }

void COandXTile::FocusChanged(TDrawNow aDrawNow)
    {
    if (aDrawNow == EDrawNow)
        {
        DrawNow();
        }
    }


// App View member functions

#define KBorderWidth 10
#define KLineWidth ((KTilesPerRow > KTilesPerCol ? KTilesPerRow : KTilesPerCol) > 4 ? 2 : 4)

COandXAppView::COandXAppView()
    {
    }

COandXAppView::~COandXAppView()
    {
    for (TInt i=0; i<CountComponentControls(); i++)
        {
        delete iTiles[i];
        }
    iTiles.Close();
    }

void COandXAppView::ConstructL(const TRect& aRect, MOandXGameControl* aGameControl)
    {
    // Create a window for this application view
    CreateWindowL();
    iGameControl = aGameControl;

    for (TInt i = 0; i < CountComponentControls(); i++)
        {
        User::LeaveIfError(iTiles.Append(CreateTileL()));
        }
    ComponentControl(0)->SetFocus(ETrue);

    // Set the window's size
    SetRect(aRect); // needs to be after tile creation - see SizeChanged()
    // Activate the window, which makes it ready to be drawn
    ActivateL();
    }

COandXTile* COandXAppView::CreateTileL()
    {
    COandXTile * tile = new(ELeave) COandXTile;
    CleanupStack::PushL(tile);
    tile->ConstructL(Window());
    CleanupStack::Pop(); // tile
    tile->SetOwnerAndObserver(this);
    return tile;
    }
    
void COandXAppView::SizeChanged()
    {
    __ASSERT_DEBUG(iTiles[KNumberOfTiles-1], Panic(EOandXNoTiles)); // all component tiles must already exist

    TSize controlSize = Rect().Size();
    TSize tileSize;
    tileSize.iWidth=2*((controlSize.iWidth-2*KBorderWidth-(KTilesPerRow-1)*KLineWidth)/(2*KTilesPerRow));
    tileSize.iHeight=2*((controlSize.iHeight-2*KBorderWidth-(KTilesPerCol-1)*KLineWidth)/(2*KTilesPerCol));
    iTileSide = tileSize.iWidth < tileSize.iHeight ? tileSize.iWidth :tileSize.iHeight;
    TSize boardSize;
    boardSize.iWidth = KTilesPerRow*iTileSide + (KTilesPerRow-1)*KLineWidth;
    boardSize.iHeight = KTilesPerCol*iTileSide + (KTilesPerCol-1)*KLineWidth;
    iBoardRect.iTl.iX = (controlSize.iWidth - boardSize.iWidth)/2;
    iBoardRect.iTl.iY = (controlSize.iHeight - boardSize.iHeight)/2;
    iBoardRect.iBr.iX = iBoardRect.iTl.iX + boardSize.iWidth;
    iBoardRect.iBr.iY = iBoardRect.iTl.iY + boardSize.iHeight;
    iBorderRect = iBoardRect;
    iBorderRect.Grow(KBorderWidth,KBorderWidth);
	
    for (TInt i=0; i<CountComponentControls(); i++)
        {
        TInt row = i / KTilesPerRow;
        TInt col = i % KTilesPerRow;
        TRect tileRect;
        tileRect.iTl.iX = iBoardRect.iTl.iX + col * (iTileSide + KLineWidth);
        tileRect.iTl.iY = iBoardRect.iTl.iY + row * (iTileSide + KLineWidth);
        tileRect.iBr.iX = tileRect.iTl.iX + iTileSide;
        tileRect.iBr.iY = tileRect.iTl.iY + iTileSide;
        ComponentControl(i)->SetRect(tileRect);
        }
    }
	
void COandXAppView::ResetView()
    {
    MoveFocusTo(0);
    DrawNow();
    }


void COandXAppView::Draw(const TRect& /*aRect*/) const
    {
    CWindowGc& gc = SystemGc();
    TRect rect = Rect();
    
    // Draw outside the border
    gc.SetPenStyle(CGraphicsContext::ENullPen);
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.SetBrushColor(KRgbWhite);
    DrawUtils::DrawBetweenRects(gc, rect, iBorderRect);
    
    // Draw a border around the board
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    gc.SetBrushColor(KRgbGray);
    DrawUtils::DrawBetweenRects(gc, iBorderRect, iBoardRect);
    
    //Draw the first vertical line
    gc.SetBrushColor(KRgbBlack);
    TRect line;
    line.iTl.iX = iBoardRect.iTl.iX + iTileSide;
    line.iTl.iY = iBoardRect.iTl.iY;
    line.iBr.iX = line.iTl.iX + KLineWidth;
    line.iBr.iY = iBoardRect.iBr.iY;
    gc.DrawRect(line);
    TInt i;
    // Draw the remaining (KTilesPerRow-2) vertical lines
    for (i = 0; i < KTilesPerRow - 2; i++)
        {
        line .iTl.iX += iTileSide + KLineWidth;
        line .iBr.iX += iTileSide + KLineWidth;
        gc.DrawRect(line);
        }
    // Draw the first horizontal line
    line.iTl.iX = iBoardRect.iTl.iX;
    line.iTl.iY = iBoardRect.iTl.iY + iTileSide;
    line.iBr.iX = iBoardRect.iBr.iX;
    line.iBr.iY = line.iTl.iY + KLineWidth;
    gc.DrawRect(line);
    // Draw the remaining (KTilesPerCol -2) horizontal lines
    for (i = 0; i < KTilesPerCol - 2; i++)
        {
        line .iTl.iY += iTileSide + KLineWidth;
        line .iBr.iY += iTileSide + KLineWidth;
        gc.DrawRect(line);
        }
    }


TInt COandXAppView::CountComponentControls() const
    {
    return KNumberOfTiles;
    }

CCoeControl* COandXAppView::ComponentControl(TInt aIndex) const
    {
    return const_cast<COandXTile*>(iTiles[aIndex]);
    }

TKeyResponse COandXAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {
    TKeyResponse keyResponse = EKeyWasNotConsumed;
    if (aType!=EEventKey)
        {
        return keyResponse;
        }
    TInt index = IdOfFocusControl();
    switch (aKeyEvent.iCode)
        {
    case EKeyLeftArrow: // check not in first column
        if (index % KTilesPerRow)
            {
            MoveFocusTo(index-1);
            keyResponse = EKeyWasConsumed;
            }
        break;
    case EKeyRightArrow: // check not in last column
        if ((index % KTilesPerRow) < KTilesPerRow - 1)
            {
            MoveFocusTo(index+1);
            keyResponse = EKeyWasConsumed;
            }
        break;
    case EKeyUpArrow: // check not on top row
        if (index >= KTilesPerRow)
            {
            MoveFocusTo(index-KTilesPerRow);
            keyResponse = EKeyWasConsumed;
            }
        break;
    case EKeyDownArrow: // check not in bottom row
        if (index < KNumberOfTiles - KTilesPerRow)
            {
            MoveFocusTo(index+KTilesPerRow);
            keyResponse = EKeyWasConsumed;
            }
        break;
    default:
        keyResponse = ComponentControl(index)->OfferKeyEventL(aKeyEvent,aType);
        break;
        }
    return keyResponse;
    }

TInt COandXAppView::IdOfFocusControl()
    {
    TInt ret = -1;
    for (TInt i=0; i<CountComponentControls(); i++)
        {
        if (ComponentControl(i)->IsFocused())
            {
            ret = i;
            break;
            }
        }
    __ASSERT_ALWAYS(ret>=0, Panic(EOandXNoTileWithFocus));
    return ret;
    }
    
void COandXAppView::SwitchFocus(TInt aFromIndex, CCoeControl* aToControl)
    {
    ComponentControl(aFromIndex)->SetFocus(EFalse, EDrawNow);
    aToControl->SetFocus(ETrue, EDrawNow);
    }
    
void COandXAppView::MoveFocusTo(const TInt index)
    {
    TInt oldIndex = IdOfFocusControl();
    if (index!= oldIndex)
        {
        SwitchFocus(oldIndex, ComponentControl(index));
        }
    }


void COandXAppView::HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType)
    {
    switch (aEventType)
        {
    case EEventRequestFocus:
        SwitchFocus(IdOfFocusControl(), aControl);
        break;
    default:
        break;
        }
    }

TBool COandXAppView::TryHitSquareL(const COandXTile* aControl)
    {
    return iGameControl->HitSquareL(Index(aControl));
    }

TInt COandXAppView::SquareStatus(const COandXTile* aControl)
    {
    return iGameControl->SquareStatus(Index(aControl));
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91女神在线视频| 91一区二区在线观看| 国产99久久久国产精品潘金| 91美女片黄在线观看| 欧美一二三区在线| 一区二区三区在线观看视频| 国产精品 日产精品 欧美精品| 91免费视频网址| 国产日韩欧美不卡| 蜜桃av噜噜一区二区三区小说| 91社区在线播放| 亚洲国产成人在线| 国内欧美视频一区二区 | 一本一道久久a久久精品| 日韩免费高清视频| 日韩精品亚洲专区| 欧美日韩在线观看一区二区 | 91精品福利在线| 国产精品萝li| 成人综合在线视频| 久久久电影一区二区三区| 蜜桃在线一区二区三区| 欧美性生活一区| 亚洲美女区一区| 91免费国产在线| 中文字幕五月欧美| 99r精品视频| 1区2区3区国产精品| 波多野结衣中文字幕一区二区三区| 久久综合久久综合久久综合| 久久99最新地址| 欧美精品一区二区三区一线天视频 | 三级在线观看一区二区| 在线免费观看日本欧美| 亚洲激情av在线| 在线观看av一区二区| 一二三区精品福利视频| 欧美在线观看一区| 日韩精品一卡二卡三卡四卡无卡| 欧美日韩国产一二三| 免费成人美女在线观看.| 日韩午夜中文字幕| 国产揄拍国内精品对白| 国产午夜精品一区二区三区视频| 国产精品一二二区| 亚洲人成网站精品片在线观看| 91久久人澡人人添人人爽欧美| 中文字幕佐山爱一区二区免费| 91国模大尺度私拍在线视频 | 国产精品久久久久久久久图文区| 成人av网址在线观看| 亚洲综合视频网| 日韩欧美一级精品久久| 国产成人精品www牛牛影视| 亚洲视频一区在线| 正在播放亚洲一区| 国产成人在线电影| 亚洲精品国产第一综合99久久 | 欧美精品一卡二卡| 国内外精品视频| 一区二区三区久久久| 日韩美女主播在线视频一区二区三区| 国产不卡视频在线观看| 亚洲国产精品久久一线不卡| 精品久久久久香蕉网| 日本精品视频一区二区| 久久激情五月激情| 亚洲精品视频免费观看| 欧美videofree性高清杂交| 成人h动漫精品一区二区| 首页国产欧美久久| 中文字幕在线免费不卡| 日韩久久精品一区| 日本久久一区二区三区| 国产成人精品1024| 亚洲成人一区在线| 亚洲欧洲另类国产综合| 日韩一区二区三区视频在线| 色综合久久88色综合天天免费| 久久国产精品色婷婷| 亚洲大型综合色站| 自拍偷在线精品自拍偷无码专区| 欧美电影精品一区二区| 在线观看亚洲一区| 成人国产精品免费网站| 国产在线精品一区二区不卡了| 亚洲va天堂va国产va久| 国产精品久久久久一区| 久久一留热品黄| 91精品国产色综合久久不卡蜜臀 | 精品国免费一区二区三区| 欧美视频完全免费看| 大胆亚洲人体视频| 免费一区二区视频| 爽好多水快深点欧美视频| 樱桃视频在线观看一区| 日韩美女精品在线| 国产精品美女一区二区三区| 久久久久9999亚洲精品| 精品国产区一区| 日韩欧美在线影院| 777xxx欧美| 欧美日韩综合在线免费观看| 色综合天天性综合| 99精品国产热久久91蜜凸| 国产精品自拍三区| 国产美女一区二区三区| 国产精品一区二区久久精品爱涩 | 色狠狠色噜噜噜综合网| 成年人国产精品| av男人天堂一区| 懂色一区二区三区免费观看| 国产98色在线|日韩| 成人听书哪个软件好| 国产999精品久久| 99这里都是精品| 在线视频国内一区二区| 在线视频亚洲一区| 欧美日韩dvd在线观看| 在线播放国产精品二区一二区四区| 欧美优质美女网站| 欧美人狂配大交3d怪物一区| 欧美一区二区三区在线看| 欧美一级国产精品| 欧美大片在线观看一区| 2021中文字幕一区亚洲| 日本一区二区三区视频视频| 亚洲人精品一区| 亚洲国产精品一区二区久久| 免费在线观看不卡| 粉嫩欧美一区二区三区高清影视| 成人在线视频一区二区| 97se亚洲国产综合自在线| 色婷婷久久综合| 7777精品伊人久久久大香线蕉超级流畅 | 久久精品国产一区二区| 国产v综合v亚洲欧| 色婷婷亚洲综合| 欧美一区2区视频在线观看| 久久久蜜桃精品| 亚洲免费电影在线| 日本不卡123| 高清beeg欧美| 欧美另类videos死尸| 亚洲精品在线观看网站| 亚洲色图清纯唯美| 久久爱另类一区二区小说| 91丨九色丨尤物| 日韩欧美黄色影院| 亚洲激情图片qvod| 韩国毛片一区二区三区| 色诱视频网站一区| 久久综合一区二区| 一卡二卡欧美日韩| 国产成人亚洲精品青草天美| 欧美三级视频在线| 欧美国产精品中文字幕| 日精品一区二区三区| 成人av网站免费| 精品少妇一区二区| 亚洲精品成a人| 韩国成人福利片在线播放| 欧美色综合天天久久综合精品| 久久在线免费观看| 日韩va亚洲va欧美va久久| 91网站在线播放| 国产欧美中文在线| 久久精品国产第一区二区三区| 91福利视频网站| 中文字幕第一页久久| 久久精品av麻豆的观看方式| 欧美三级中文字幕在线观看| 国产欧美一区二区三区鸳鸯浴| 视频一区欧美日韩| 在线免费观看一区| 自拍偷拍亚洲综合| 丁香另类激情小说| 久久人人97超碰com| 免费一级片91| 91精品欧美一区二区三区综合在| 一级特黄大欧美久久久| 99久久婷婷国产综合精品电影| 国产亚洲成aⅴ人片在线观看| 日本亚洲天堂网| 欧美精品在线一区二区三区| 亚洲精品视频免费看| 97久久精品人人做人人爽| 中文字幕不卡在线观看| 国产精品自拍三区| 国产色产综合产在线视频| 狠狠狠色丁香婷婷综合久久五月| 欧美一卡二卡在线| 麻豆视频一区二区| 精品久久久久久综合日本欧美| 日韩av网站在线观看| 欧美一级一级性生活免费录像| 午夜精品在线视频一区| 91精品国产乱码| 久久精品久久99精品久久| 久久综合久久99|