svgtviewer/SvgtViewerPlugin/ScreenSaverPluginSrc/Svgtplugin.cpp
branchRCL_3
changeset 17 e52958d06c29
parent 14 1882882c7f9c
child 18 20b99a6d6175
child 20 5fd161fa28b6
equal deleted inserted replaced
14:1882882c7f9c 17:e52958d06c29
     1 /*
       
     2 * Copyright (c) 2005 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:  SVGT Plugin Implementation source file
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <e32std.h>
       
    21 #include <eikenv.h>
       
    22 #include <barsread.h>
       
    23 #include <fbs.h>
       
    24 #include <gdi.h>
       
    25 #include <f32file.h>
       
    26 
       
    27 #include "Svgtplugin.h"
       
    28 #include "SvgScreenSaver.h"
       
    29 
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // CSvgtPlugin::NewL
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CSvgtPlugin* CSvgtPlugin::NewL(NPP anInstance)
       
    36     {
       
    37     CSvgtPlugin *self = new (ELeave) CSvgtPlugin(anInstance);
       
    38     CleanupStack::PushL( self );
       
    39     self->ConstructL();
       
    40     CleanupStack::Pop( self );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CSvgtPlugin::~CSvgtPlugin
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 CSvgtPlugin::~CSvgtPlugin()
       
    49     {
       
    50     if ( iControl )
       
    51         {
       
    52         delete iControl;        
       
    53         }    
       
    54     }
       
    55     
       
    56 // -----------------------------------------------------------------------------
       
    57 // CSvgtPlugin::PrepareToExitL
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 void CSvgtPlugin::PrepareToExitL()
       
    61     {
       
    62     if ( iPluginAdapter )
       
    63         {
       
    64         iPluginAdapter->PluginFinishedL();
       
    65         }
       
    66     if ( iControl )
       
    67         {
       
    68         delete iControl;
       
    69         iControl=NULL;
       
    70         }
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CSvgtPlugin::ConstructL
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 void CSvgtPlugin::ConstructL()
       
    78     {      
       
    79     }
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CSvgtPlugin::SetWindowL
       
    83 // Sets the parent control
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void CSvgtPlugin::SetWindowL(const NPWindow *aWindow,const TRect& aRect)
       
    87     {
       
    88     if ( !aWindow )
       
    89         {
       
    90         User::Leave( KErrArgument );
       
    91         }
       
    92     iPluginAdapter = static_cast<MPluginAdapter*>(aWindow->window);
       
    93     CCoeControl* lParentControl = iPluginAdapter->GetParentControl();
       
    94 
       
    95     if ( !iControl )
       
    96         {
       
    97         // Control is created here as Parent Control is available
       
    98         // only in SetWindowL
       
    99         iControl = new (ELeave) CSvgScreenSaver;
       
   100         iControl->ConstructL( lParentControl );
       
   101         iPluginAdapter->SetPluginNotifier(iControl);
       
   102         }
       
   103 
       
   104     iControl->SetRect(aRect);
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CSvgtPlugin::CSvgtPlugin
       
   109 // Default constructor
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 CSvgtPlugin::CSvgtPlugin(NPP anInstance)
       
   113     {
       
   114     iScreenSaverMode = EFalse;
       
   115     this->iInstance=anInstance;
       
   116     }
       
   117 
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CSvgtPlugin::Control
       
   121 // returns the control
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 CSvgScreenSaver* CSvgtPlugin::Control() const
       
   125     {
       
   126     ASSERT( iControl );
       
   127     return iControl;
       
   128     }
       
   129     
       
   130 // -----------------------------------------------------------------------------
       
   131 // CSvgtPlugin::Instance
       
   132 // returns the instance
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 NPP CSvgtPlugin::Instance() const
       
   136     {
       
   137     return iInstance;
       
   138     }
       
   139  
       
   140 
       
   141 // End of File