browser/ui/src/SplashContainer.cpp
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : SplashContainer.cpp
       
     3  * Description : 
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 #include "SplashContainer.h"
       
    16 
       
    17 #include <AknDef.h>
       
    18 #include <AknUtils.h>
       
    19 #include <AknViewAppui.h>
       
    20 #include <AknView.h>
       
    21 
       
    22 #include <fbs.h>
       
    23 #include <GulIcon.h>
       
    24 
       
    25 //#include <Splash_0x2002E1AB.mbg>
       
    26 
       
    27 //#include "IconLoader.h"
       
    28 
       
    29 #include "Logger.h"
       
    30 
       
    31 CSplashContainer::CSplashContainer(CAknView& aView)
       
    32     : iView(aView)
       
    33 {}
       
    34 
       
    35 CSplashContainer::~CSplashContainer()
       
    36 {
       
    37     delete iBackground;
       
    38 
       
    39     delete iBitmapContext;
       
    40     delete iBitmapDevice;
       
    41     delete iBitmap;
       
    42 }
       
    43 
       
    44 void CSplashContainer::ConstructL(const TRect& aRect, const CCoeControl* aParent)
       
    45 {
       
    46     if (aParent)
       
    47         SetContainerWindowL(*aParent);
       
    48     else
       
    49         CreateWindowL();
       
    50 
       
    51     iBitmap = new(ELeave) CFbsBitmap;
       
    52     iBitmap->Create(aRect.Size(), Window().DisplayMode());
       
    53 
       
    54     iBitmapDevice = CFbsBitmapDevice::NewL(iBitmap);
       
    55     User::LeaveIfError(iBitmapDevice->CreateContext(iBitmapContext));
       
    56 
       
    57     iBitmapContext->SetBrushColor(KRgbBlue);
       
    58     iBitmapContext->SetBrushStyle(CFbsBitGc::ESolidBrush);
       
    59     iBitmapContext->Clear();
       
    60 
       
    61     const CFont* font = iEikonEnv->LegendFont();
       
    62     iBitmapContext->UseFont(font);
       
    63 
       
    64     iBitmapContext->SetPenColor(KRgbWhite);
       
    65     iBitmapContext->SetPenStyle(CFbsBitGc::ESolidPen);
       
    66 
       
    67     _LIT(KPrimaryText, "Initializing..");
       
    68     iBitmapContext->DrawText(KPrimaryText, TPoint(font->WidthZeroInPixels(), font->FontMaxHeight()));
       
    69 
       
    70 //    _LIT(KImageFile, "\\resource\\apps\\Splash_0x20026309.mif");
       
    71 //    iBackground = CreateIconL(KImageFile, EMbmSplash_0x20026309Splash, EMbmSplash_0x20026309Splash_mask, aRect.Size());
       
    72 
       
    73     SetRect(aRect);
       
    74     ActivateL();
       
    75 }
       
    76 
       
    77 void CSplashContainer::HandleResourceChange(TInt aType)
       
    78 {
       
    79     LOGARG("CSplashContainer::HandleResourceChange(%d)", aType);
       
    80 
       
    81     CCoeControl::HandleResourceChange(aType);
       
    82 
       
    83     if (aType == KEikDynamicLayoutVariantSwitch)
       
    84     {
       
    85         TRect rect;
       
    86         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EApplicationWindow, rect);
       
    87         SetRect(rect);
       
    88     }
       
    89 }
       
    90 
       
    91 void CSplashContainer::Draw(const TRect& aRect) const
       
    92 {
       
    93     CWindowGc& gc = SystemGc();
       
    94     gc.BitBlt(TPoint(0, 0), iBitmap);
       
    95 }