javauis/mmapi_qt/baseline/src/cmmaitemdisplay.cpp
changeset 23 98ccebc37403
child 26 dc7c549001d5
equal deleted inserted replaced
21:2a9601315dfc 23:98ccebc37403
       
     1 /*
       
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Bitmap display that draws to the Java CustomItem's bitmap.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //  Include Files
       
    20 #include <logger.h>
       
    21 //#include <lcdui.h>
       
    22 
       
    23 #include "cmmaitemdisplay.h"
       
    24 #include "cmmabitmapwindow.h"
       
    25 
       
    26 // CONSTRUCTION
       
    27 // Static constructor, leaves pointer to cleanup-stack
       
    28 CMMAItemDisplay* CMMAItemDisplay::NewLC(/*MMIDCustomItem* aCustomItem*/)
       
    29 {
       
    30     CMMAItemDisplay* self = new(ELeave) CMMAItemDisplay(/*aCustomItem*/);
       
    31     CleanupStack::PushL(self);
       
    32    // self->Construct(/*&(aCustomItem->DirectContainer())*/);
       
    33     return self;
       
    34 }
       
    35 
       
    36 
       
    37 // Destructor (virtual by CBase)
       
    38 CMMAItemDisplay::~CMMAItemDisplay()
       
    39 {
       
    40 }
       
    41 
       
    42 
       
    43 CMMAItemDisplay::CMMAItemDisplay(/*MMIDCustomItem* aCustomItem*/)
       
    44         //: iItem(aCustomItem)
       
    45 {
       
    46     iVisible = ETrue; // Item is visible at startup
       
    47 }
       
    48 
       
    49 void CMMAItemDisplay::SizeChangedL(CMMAItemDisplay* aDisplay,
       
    50                                    TInt /*aWidth*/,
       
    51                                    TInt /*aHeight*/)
       
    52 // currently width and height is ignored
       
    53 // may be used later to layout the image.
       
    54 {
       
    55 	/*
       
    56     if (aDisplay->iWindow)
       
    57     {
       
    58         CFbsBitmap* bitmap = aDisplay->iItem->FrameBuffer();
       
    59         aDisplay->iWindow->SetDestinationBitmapL(bitmap);
       
    60     }
       
    61     */
       
    62 }
       
    63 
       
    64 void CMMAItemDisplay::SetFullScreenL(TBool aFullScreen)
       
    65 {
       
    66     iFullScreen = aFullScreen;
       
    67     if (!iWindow)
       
    68     {
       
    69         return;
       
    70     }
       
    71     if (aFullScreen)
       
    72     {
       
    73         // switch to fullscreen
       
    74         iWindow->SetDrawRect(ScaleToFullScreen(
       
    75                                  iWindow->WindowSize(), iSourceSize));
       
    76     }
       
    77     else
       
    78     {
       
    79         // switch to normal screen
       
    80         iWindow->SetDrawRect(iUserRect);
       
    81     }
       
    82 }
       
    83 
       
    84 void CMMAItemDisplay::SetWindowL(MMMADisplayWindow* aWindow)
       
    85 {
       
    86     CMMADisplay::SetWindowL(aWindow);
       
    87     if (!iWindow)
       
    88     {
       
    89         LOG( EJavaMMAPI, EInfo, "CMMAItemDisplay::SetWindowL: NULL window, returning");
       
    90         return;
       
    91     }
       
    92     iSourceSize = iWindow->WindowSize();
       
    93    /* CFbsBitmap* bitmap = iItem->FrameBuffer();
       
    94 
       
    95     if (bitmap)
       
    96     {
       
    97         iWindow->SetDestinationBitmapL(bitmap);
       
    98     }
       
    99    */
       
   100 }
       
   101 
       
   102 void CMMAItemDisplay::SetDisplayLocationL(const TPoint& /*aPosition*/)
       
   103 {
       
   104     // In item( USE_GUI_PRIMITIVE ) mode, this call will be ignored.
       
   105 }
       
   106 
       
   107 
       
   108 TPoint CMMAItemDisplay::DisplayLocation()
       
   109 {
       
   110     // Java Item's location is always 0, 0
       
   111     return TPoint(0, 0);
       
   112 }
       
   113 
       
   114 void CMMAItemDisplay::SourceSizeChanged(const TSize& aSourceSize)
       
   115 {
       
   116     LOG1(EJavaMMAPI,EInfo,"MMA::CMMAItemDisplay::SourceSizeChanged %d",
       
   117               aSourceSize.iWidth);
       
   118     LOG1(EJavaMMAPI,EInfo,"MMA::CMMAItemDisplay::SourceSizeChanged %d",
       
   119               aSourceSize.iHeight);
       
   120 
       
   121 	#ifdef RD_JAVA_NGA_ENABLED
       
   122 	if ( iWindow )
       
   123 	{
       
   124 	iWindow->SetVideoCropRegion( TRect( iUserRect.iTl, aSourceSize ) );
       
   125 	}
       
   126 	#endif
       
   127 
       
   128     iSourceSize = aSourceSize;
       
   129 
       
   130     if (iWindow)
       
   131     {
       
   132         TRect clientRect(iUserRect.iTl, aSourceSize);
       
   133 
       
   134         iWindow->SetDrawRect(clientRect);
       
   135         // Setting initial window size if not already set, actual size will
       
   136         // be set in MdcItemContentRectChanged()
       
   137         if (iWindow->WindowSize() == TSize())
       
   138         {
       
   139             iWindow->SetWindowRect(clientRect, MMMADisplay::EMmaThread);
       
   140         }
       
   141     }
       
   142 
       
   143     SetClippingRegion();
       
   144 
       
   145     if (iUserRect.IsEmpty())
       
   146     {
       
   147         // Java side hasn't set size.
       
   148         iUserRect.SetSize(iSourceSize);
       
   149     }
       
   150 }
       
   151 
       
   152 void CMMAItemDisplay::StaticSourceSize(CMMAItemDisplay* aDisplay,
       
   153                                        TSize* aSize)
       
   154 {
       
   155     *aSize = aDisplay->iUserRect.Size();
       
   156 }
       
   157 
       
   158 /*void CMMAItemDisplay::MdcItemContentRectChanged(const TRect& aContentRect,
       
   159         const TRect& aScreenRect)
       
   160 {
       
   161     if (iWindow)
       
   162     {
       
   163         // Change windows rect.
       
   164         iWindow->SetWindowRect(aScreenRect, MMMADisplay::EUiThread);
       
   165         TRect drawRect = aContentRect;
       
   166         drawRect.Move(- aScreenRect.iTl);
       
   167         iWindow->SetDrawRectThread(drawRect);
       
   168     }
       
   169     SetClippingRegion();
       
   170 }
       
   171 */
       
   172 /*void CMMAItemDisplay::MdcContentBoundsChanged(const TRect& aRect)
       
   173 {
       
   174     // Do nothing in Item display
       
   175 }
       
   176 */
       
   177 //  END OF FILE