Nokia N97 SDK
Example Applications Guide

CDirectoryLocalizerExContainer Class Reference

#include <directorylocalizerexcontainer.h>

Inheritance diagram for CDirectoryLocalizerExContainer:

List of all members.

Detailed Description

container class

Definition at line 29 of file directorylocalizerexcontainer.h.


Public Member Functions

  CDirectoryLocalizerExContainer ()
virtual  ~CDirectoryLocalizerExContainer ()
void  ConstructL (const TRect &aRect)
void  SetControlL (CCoeControl *aControl)
void  ResetControl ()
void  LocalizedFromResIdL ()
void  SetupFromResRdL ()
void  SetupFromResIdL ()
void  GetExtraDataL ()
void  GetIconIndexL ()
TInt  CountComponentControls () const
CCoeControl *  ComponentControl (TInt aIndex) const

Private Member Functions

void  Draw (const TRect &aRect) const

Private Attributes

CCoeControl *  iControl


Constructor & Destructor Documentation

CDirectoryLocalizerExContainer::CDirectoryLocalizerExContainer (   ) 
 

C++ default constructor.

Definition at line 39 of file directorylocalizerexcontainer.cpp.

00040     {
00041     }

CDirectoryLocalizerExContainer::~CDirectoryLocalizerExContainer (   )  [virtual]
 

Destructor.

Definition at line 47 of file directorylocalizerexcontainer.cpp.

References ResetControl().

00048     {
00049     ResetControl();
00050     }


Member Function Documentation

void CDirectoryLocalizerExContainer::ConstructL (  const TRect &  aRect  ) 
 

Symbian 2nd constructor.

Definition at line 56 of file directorylocalizerexcontainer.cpp.

Referenced by CDirectoryLocalizerExAppUi::ConstructL().

00057     {
00058     CreateWindowL();
00059     SetRect( aRect );
00060     ActivateL();
00061     }

void CDirectoryLocalizerExContainer::SetControlL (  CCoeControl *  aControl  ) 
 

Set component control, and container will own the control.

Parameters:
aControl  pointer to a control.

Definition at line 106 of file directorylocalizerexcontainer.cpp.

References iControl.

00107     {
00108     iControl = aControl;
00109     if ( iControl )
00110         {
00111         // You can change the position and size
00112         iControl->SetExtent( Rect().iTl, Rect().Size() );
00113         iControl->ActivateL();
00114         DrawNow();
00115         }
00116     }

void CDirectoryLocalizerExContainer::ResetControl (   ) 
 

Delete control.

Definition at line 122 of file directorylocalizerexcontainer.cpp.

References iControl.

Referenced by ~CDirectoryLocalizerExContainer().

00123     {
00124     delete iControl;
00125     iControl = NULL;
00126     }

void CDirectoryLocalizerExContainer::LocalizedFromResIdL (   ) 
 

Create a CDirectoryLocalizer instance, and add entries using RSS Id,user can use SetFullPath() function by inputting a existing path as param,then the user can get the localized name.

Definition at line 189 of file directorylocalizerexcontainer.cpp.

Referenced by CDirectoryLocalizerExAppUi::HandleCommandL().

00190     {
00191     // construct with default data
00192     CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL();
00193     CleanupStack::PushL(localizer);  // localizer
00194 
00195     localizer->AddFromResourceL( R_EXAMPLE_LOCALIZER_ENTRIES );
00196     localizer->SetFullPath( KDLTestExistsDir );
00197     TBool success = localizer->IsLocalized();
00198 
00199     CAknInformationNote *note = new ( ELeave ) CAknInformationNote();
00200     if( success )
00201         {
00202         const TPtrC strNote = localizer->LocalizedName();
00203         note->ExecuteLD( strNote );
00204         }
00205     else
00206         {
00207         note->ExecuteLD( strNote );
00208         }
00209 
00210     CleanupStack::PopAndDestroy();  // localizer
00211     }

void CDirectoryLocalizerExContainer::SetupFromResRdL (   ) 
 

Using a ResourceReader to read directory entries from RSS file, and Construct a CDirectoryLocalizer from ResourceReader, user can use SetFullPath() function by inputting a existing path as param, then the user can get the localized name.

Definition at line 132 of file directorylocalizerexcontainer.cpp.

Referenced by CDirectoryLocalizerExAppUi::HandleCommandL().

00133     {
00134     TResourceReader reader;
00135     CCoeEnv::Static()->CreateResourceReaderLC( reader,
00136                             R_EXAMPLE_LOCALIZER_ENTRIES );
00137     CDirectoryLocalizer*  localizer = CDirectoryLocalizer::NewL( reader );
00138     CleanupStack::PushL(localizer);  // localizer
00139 
00140     localizer->SetFullPath( KDLTestExistsDir );
00141     TBool success = localizer->IsLocalized();
00142 
00143     CAknInformationNote *note = new ( ELeave ) CAknInformationNote();
00144     if( success )
00145         {
00146         const TPtrC strNote = localizer->LocalizedName();
00147         note->ExecuteLD( strNote );
00148         }
00149     else
00150         {
00151         note->ExecuteLD( strNote );
00152         }
00153 
00154     CleanupStack::PopAndDestroy();  // localizer
00155     CleanupStack::PopAndDestroy();  // reader
00156     }

void CDirectoryLocalizerExContainer::SetupFromResIdL (   ) 
 

Construct a CDirectoryLocalizer instance from ResourceId, user can use SetFullPath() function by inputting a existing path as param, then the user can get the localized name.

Definition at line 161 of file directorylocalizerexcontainer.cpp.

Referenced by CDirectoryLocalizerExAppUi::HandleCommandL().

00162     {
00163     // construct with default data
00164     CDirectoryLocalizer* localizer = CDirectoryLocalizer
00165                                          ::NewL( R_EXAMPLE_LOCALIZER_ENTRIES );
00166     CleanupStack::PushL(localizer);  // localizer
00167 
00168     localizer->SetFullPath( KDLTestExistsDir );
00169     TBool success = localizer->IsLocalized();
00170 
00171     CAknInformationNote *note = new ( ELeave ) CAknInformationNote();
00172     if( success )
00173         {
00174         const TPtrC strNote = localizer->LocalizedName();
00175         note->ExecuteLD( strNote );
00176         }
00177     else
00178         {
00179         note->ExecuteLD( strNote );
00180         }
00181 
00182     CleanupStack::PopAndDestroy();  // localizer
00183     }

void CDirectoryLocalizerExContainer::GetExtraDataL (   ) 
 

User can use the ExtraData() function after localized succefully to get the extra data from resource structrue.

Definition at line 217 of file directorylocalizerexcontainer.cpp.

Referenced by CDirectoryLocalizerExAppUi::HandleCommandL().

00218     {
00219     // construct with default data
00220     CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL();
00221     CleanupStack::PushL(localizer);  // localizer
00222 
00223     localizer->AddFromResourceL( R_EXAMPLE_LOCALIZER_ENTRIES );
00224     localizer->SetFullPath( KDLTestExistsDir );
00225     TBool success = localizer->IsLocalized();
00226 
00227     CAknInformationNote *note = new ( ELeave ) CAknInformationNote();
00228     if( success )
00229         {
00230         const TPtrC strNote = localizer->ExtraData();
00231         note->ExecuteLD( strNote );
00232         }
00233     else
00234         {
00235         note->ExecuteLD( strNote );
00236         }
00237 
00238     CleanupStack::PopAndDestroy();  // localizer
00239     }

void CDirectoryLocalizerExContainer::GetIconIndexL (   ) 
 

User can use the Icon() function after localized succefully to get the extra data from resource structrue.

Definition at line 244 of file directorylocalizerexcontainer.cpp.

Referenced by CDirectoryLocalizerExAppUi::HandleCommandL().

00245     {
00246     // construct with default data
00247     CDirectoryLocalizer* localizer = CDirectoryLocalizer::NewL();
00248     CleanupStack::PushL(localizer);  // localizer
00249 
00250     localizer->AddFromResourceL( R_EXAMPLE_LOCALIZER_ENTRIES );
00251     localizer->SetFullPath( KDLTestExistsDir );
00252     TBool success = localizer->IsLocalized();
00253 
00254     CAknInformationNote *note = new ( ELeave ) CAknInformationNote();
00255     if( success )
00256         {
00257         TInt iconIndex = localizer->Icon();
00258         TBuf<KMaxString> strIndex;
00259         strIndex.AppendNum( iconIndex );
00260         note->ExecuteLD( strIndex );
00261         }
00262     else
00263         {
00264         note->ExecuteLD( strNote );
00265         }
00266 
00267     CleanupStack::PopAndDestroy();  // localizer
00268     }

TInt CDirectoryLocalizerExContainer::CountComponentControls (   )  const
 

Return count of component controls.

Definition at line 81 of file directorylocalizerexcontainer.cpp.

References iControl.

00082     {
00083     if ( iControl )
00084         {
00085         return 1;
00086         }
00087     else
00088         {
00089         return 0;
00090         }
00091     }

CCoeControl * CDirectoryLocalizerExContainer::ComponentControl (  TInt  aIndex  )  const
 

Return pointer to component control specified by index.

Parameters:
aIndex  a index to specify a component control.

Definition at line 97 of file directorylocalizerexcontainer.cpp.

References iControl.

00098     {
00099     return iControl;
00100     }

void CDirectoryLocalizerExContainer::Draw (  const TRect &  aRect  )  const [private]
 

From CCoeControl, Draw. Fills the window's rectangle.

Parameters:
aRect  Region of the control to be (re)drawn.

Definition at line 68 of file directorylocalizerexcontainer.cpp.

00069     {
00070     CWindowGc& gc = SystemGc();
00071     gc.SetPenStyle( CGraphicsContext::ENullPen );
00072     gc.SetBrushColor( KAknAtListGray );
00073     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
00074     gc.DrawRect( aRect );
00075     }


Member Data Documentation

CCoeControl* CDirectoryLocalizerExContainer::iControl [private]
 

Pointer to component control. Own.

Definition at line 124 of file directorylocalizerexcontainer.h.

Referenced by ComponentControl(), CountComponentControls(), ResetControl(), and SetControlL().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top