idlehomescreen/xmluirendering/renderingplugins/xnbitmapfactory/src/xnbitmapadapter.cpp
branchRCL_3
changeset 26 1b758917cafc
parent 0 f72a12da539e
equal deleted inserted replaced
25:137ebc85284b 26:1b758917cafc
    18 
    18 
    19 #include "xnnodepluginif.h"
    19 #include "xnnodepluginif.h"
    20 #include "xndomproperty.h"
    20 #include "xndomproperty.h"
    21 #include "xnproperty.h"
    21 #include "xnproperty.h"
    22 #include "xncontroladapter.h"
    22 #include "xncontroladapter.h"
    23 
    23 #include "xnimagedecoder.h"
    24 #include "xnbitmapadapter.h"
    24 #include "xnbitmapadapter.h"
    25 
    25 
    26 _LIT(KSkin, "skin(");
    26 _LIT(KSkin, "skin(");
    27 
    27 
    28 // ============================ MEMBER FUNCTIONS ===============================
    28 // ============================ MEMBER FUNCTIONS ===============================
    53     CXnControlAdapter::ConstructL( aNode );
    53     CXnControlAdapter::ConstructL( aNode );
    54     
    54     
    55     iAreBitmapsLoaded = EFalse;
    55     iAreBitmapsLoaded = EFalse;
    56     
    56     
    57     iFallbackPathChange = ETrue;
    57     iFallbackPathChange = ETrue;
       
    58     
       
    59     iDecoder = CXnImageDecoder::NewL( *this, iCoeEnv->FsSession() );
    58     }
    60     }
    59     
    61     
    60 // -----------------------------------------------------------------------------
    62 // -----------------------------------------------------------------------------
    61 // CXnBitmapAdapter::CXnBitmapAdapter
    63 // CXnBitmapAdapter::CXnBitmapAdapter
    62 // C++ default constructor
    64 // C++ default constructor
    71 // C++ destructor
    73 // C++ destructor
    72 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    73 //
    75 //
    74 CXnBitmapAdapter::~CXnBitmapAdapter()
    76 CXnBitmapAdapter::~CXnBitmapAdapter()
    75     {
    77     {
       
    78     delete iDecoder;
    76     delete iPath;
    79     delete iPath;
    77     delete iFallbackPath;
    80     delete iFallbackPath;
    78     }
    81     }
    79 
    82 
    80 // -----------------------------------------------------------------------------
    83 // -----------------------------------------------------------------------------
    81 // CXnBitmapAdapter::SetContentBitmaps
    84 // CXnBitmapAdapter::SetContentBitmaps
    82 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    83 //
    86 //
    84 void CXnBitmapAdapter::SetContentBitmaps(CFbsBitmap* aBitmap, CFbsBitmap* aMask)
    87 void CXnBitmapAdapter::SetContentBitmaps(CFbsBitmap* aBitmap, CFbsBitmap* aMask)
    85     {    
    88     {
       
    89     iDecoder->Cancel();
       
    90     
    86     CXnControlAdapter::SetContentBitmaps( aBitmap, aMask );
    91     CXnControlAdapter::SetContentBitmaps( aBitmap, aMask );
    87     
    92     
    88     iAreBitmapsSet = ETrue;
    93     iAreBitmapsSet = ETrue;
    89     
    94     
    90     TRAP_IGNORE( iNode.SetDirtyL() );
    95     TRAP_IGNORE( iNode.SetDirtyL() );
    91     }   
    96     }   
       
    97 
       
    98 // -----------------------------------------------------------------------------
       
    99 // CXnBitmapAdapter::SetContentBitmaps
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 void CXnBitmapAdapter::SetContentBitmaps( TFileName& aFilename )
       
   103     {       
       
   104     TRAPD( err, iDecoder->DecodeL( aFilename ) );
       
   105     
       
   106     if ( err )
       
   107         {
       
   108         SetContentBitmaps( NULL, NULL );
       
   109         }
       
   110     }
    92 
   111 
    93 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
    94 // CXnBitmapAdapter::ContentBitmaps
   113 // CXnBitmapAdapter::ContentBitmaps
    95 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
    96 //
   115 //
    97 void CXnBitmapAdapter::ContentBitmaps(CFbsBitmap*& aBitmap, CFbsBitmap*& aMask)
   116 void CXnBitmapAdapter::ContentBitmaps(CFbsBitmap*& aBitmap, CFbsBitmap*& aMask)
    98     {    
   117     {    
    99     CXnControlAdapter::ContentBitmaps( aBitmap, aMask );
   118     CXnControlAdapter::ContentBitmaps( aBitmap, aMask );
   100     }
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CXnBitmapAdapter::Draw
       
   104 // -----------------------------------------------------------------------------
       
   105 //
       
   106 void CXnBitmapAdapter::Draw(const TRect& aRect) const
       
   107     {        
       
   108     CXnControlAdapter::Draw( aRect );    
       
   109     }
   119     }
   110 
   120 
   111 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   112 // CXnBitmapAdapter::SizeChanged
   122 // CXnBitmapAdapter::SizeChanged
   113 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   188         InitializeBitmapsL();
   198         InitializeBitmapsL();
   189         }
   199         }
   190     }
   200     }
   191 
   201 
   192 // -----------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   193 // CXnTextAdapter::HandleResourceChange
       
   194 // -----------------------------------------------------------------------------
       
   195 //
       
   196 void CXnBitmapAdapter::HandleScreenDeviceChangedL( )
       
   197     {
       
   198     CXnControlAdapter::HandleScreenDeviceChangedL();        
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CXnBitmapAdapter::HandlePointerEventL
       
   203 // (other items were commented in a header).
       
   204 // -----------------------------------------------------------------------------
       
   205 // 
       
   206 void CXnBitmapAdapter::HandlePointerEventL( const TPointerEvent& aPointerEvent )
       
   207     {        
       
   208     CXnControlAdapter::HandlePointerEventL( aPointerEvent );    
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // CXnBitmapAdapter::SkinChanged
   203 // CXnBitmapAdapter::SkinChanged
   213 // -----------------------------------------------------------------------------
   204 // -----------------------------------------------------------------------------
   214 //
   205 //
   215 void CXnBitmapAdapter::SkinChanged()
   206 void CXnBitmapAdapter::SkinChanged()
   216     {
   207     {