Nokia N97 SDK
Example Applications Guide

CAknExNoteContainer Class Reference

#include <aknexnotecontainer.h>

Inheritance diagram for CAknExNoteContainer:

List of all members.

Detailed Description

CAknExNoteContainer container control class.

Definition at line 38 of file aknexnotecontainer.h.


Public Member Functions

  CAknExNoteContainer (CAknExNoteView *aView)
void  ConstructL (const TRect &aRect)
virtual  ~CAknExNoteContainer ()
void  SetTextToLabelL (TInt aResourceId)
void  ShowGeneralNoteL (TInt aResourceId, const CAknNoteDialog::TTimeout aTimeout, const CAknNoteDialog::TTone aTone)
void  ShowGeneralNoteL (TInt aResourceId, TInt aControlId, const CAknNoteDialog::TTimeout aTimeout, const CAknNoteDialog::TTone aTone, TBool aPlural)
void  ShowDynamicNumberNoteL ()
void  ShowWaitNoteL (TInt aResourceId, TInt aControlId)
void  ShowProgressNoteUnderSingleProcessL (TInt aResourceId, TInt aControlId)
void  ShowShowNoteL (TAknGlobalNoteType aType, TInt aResourceId)
TInt  UpdateProgressNote ()
void  DialogDismissedL (TInt aButtonId)

Static Public Member Functions

static TInt  CallbackIncrementProgressNoteL (TAny *aThis)

Private Types

enum   TAknExNoteComponentControls { EAknExNoteComponentLabel, EAknExNoteComponentListbox }

Private Member Functions

void  CreateLabelL ()
TKeyResponse  OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
void  SizeChanged ()
TInt  CountComponentControls () const
CCoeControl *  ComponentControl (TInt aIndex) const
void  Draw (const TRect &aRect) const

Private Attributes

CEikLabel *  iLabel
CIdle *  iIdle
CAknProgressDialog *  iProgressDialog
CEikProgressInfo *  iProgressInfo
CAknExNoteView *  iView
TInt  iGlobalNoteId
TInt  iPermanentNoteId
TRequestStatus  iStatus


Constructor & Destructor Documentation

CAknExNoteContainer::CAknExNoteContainer (  CAknExNoteView *  aView  ) 
 

CAknExNoteContainer. C++ default constructor.

Parameters:
aView  Pointer to view class object.

Definition at line 40 of file aknexnotecontainer.cpp.

00041 : iLabel( NULL ), iView( aView )
00042   
00043     {
00044     // No implementation required
00045     }

CAknExNoteContainer::~CAknExNoteContainer (   )  [virtual]
 

~CAknExNoteContainer. Virtual Destructor.

Definition at line 73 of file aknexnotecontainer.cpp.

References iIdle, and iLabel.

00074     {
00075     delete iLabel;
00076     delete iIdle;
00077     }


Member Function Documentation

void CAknExNoteContainer::ConstructL (  const TRect &  aRect  ) 
 

ConstructL 2nd phase constructor.

Parameters:
aRect  Frame rectangle for container.

Definition at line 53 of file aknexnotecontainer.cpp.

References CreateLabelL().

Referenced by CAknExNoteView::DoActivateL().

00054     {
00055     // Creates window.
00056     CreateWindowL();
00057 
00058     // Creates label object.
00059     CreateLabelL();
00060 
00061      // Sets rectangle of frame.
00062     SetRect( aRect );
00063 
00064     // Activates the window. (Ready to draw)
00065     ActivateL();
00066     }

void CAknExNoteContainer::SetTextToLabelL (  TInt  aResourceId  ) 
 

SetTextToLabelL

Parameters:
aResourceId 

Definition at line 84 of file aknexnotecontainer.cpp.

References iLabel.

Referenced by CreateLabelL(), and CAknExNoteView::HandleCommandL().

00085     {
00086     //Allocate TBuf with constant length.
00087     TBuf<KAknExNoteMessageBufLength> messageString( NULL );
00088 
00089     // Reads a resource into a descriptor.
00090     iCoeEnv->ReadResource( messageString, aResourceId );
00091     
00092     // Set label's text with descriptor
00093     iLabel->SetTextL( messageString );
00094     }

void CAknExNoteContainer::ShowGeneralNoteL (  TInt  aResourceId,
const CAknNoteDialog::TTimeout  aTimeout,
const CAknNoteDialog::TTone  aTone
) 
 

ShowGeneralNoteL Indicates general note

Parameters:
aResourceId 
aTimeout 
aTone 

Definition at line 101 of file aknexnotecontainer.cpp.

Referenced by CAknExNoteView::HandleCommandL().

00106     {
00107     // Create CAknNoteDialog instance
00108     CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( aTone, aTimeout );
00109     
00110     // Show the Dialog
00111     dlg->ExecuteLD( aResourceId );
00112     }

void CAknExNoteContainer::ShowGeneralNoteL (  TInt  aResourceId,
TInt  aControlId,
const CAknNoteDialog::TTimeout  aTimeout,
const CAknNoteDialog::TTone  aTone,
TBool  aPlural
) 
 

ShowGeneralNoteL Indicates general note.

Parameters:
aResourceId 
aControlId 
aTimeout 
aTone 
aPlural 

Definition at line 119 of file aknexnotecontainer.cpp.

00122     {
00123 
00124     // Create CAknNoteDialog instance
00125     CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( aTone, aTimeout );
00126 
00127     dlg->PrepareLC( aResourceId );
00128     dlg->SetTextPluralityL( aPlural );
00129     
00130     // Show the Dialog
00131     dlg->RunLD();
00132     }

void CAknExNoteContainer::ShowDynamicNumberNoteL (   ) 
 

ShowDynamicNumberNoteL Indicates note

Definition at line 139 of file aknexnotecontainer.cpp.

Referenced by CAknExNoteView::HandleCommandL().

00140     {
00141 
00142     // Create CAknNoteDialog instance
00143     CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( 
00144                                          CAknNoteDialog::EConfirmationTone, 
00145                                          CAknNoteDialog::ELongTimeout );
00146 
00147     dlg->PrepareLC( R_AKNEXNOTE_DYNAMIC_TEXT );
00148     TTime theTime( KAknExNoteInitializeTime );
00149     theTime.UniversalTime();
00150     TInt64 randSeed( theTime.Int64() );
00151     TInt number( Math::Rand( randSeed ) % KAknExNoteRandomNumberRange );
00152     dlg->SetTextPluralityL( EFalse );
00153     dlg->SetTextNumberL( number );
00154     
00155     // Show the Dialog
00156     dlg->RunLD();
00157     }

void CAknExNoteContainer::ShowWaitNoteL (  TInt  aResourceId,
TInt  aControlId
) 
 

ShowWaitNoteL Indicates wait note.

Parameters:
aResourceId 
aControlId 

Definition at line 164 of file aknexnotecontainer.cpp.

Referenced by CAknExNoteView::HandleCommandL().

00166     {        
00167     // Create CAknWaitDialog instance
00168     CAknWaitDialog* waitDialog =  new ( ELeave ) CAknWaitDialog( NULL, ETrue );
00169     
00170     // Show the Dialog
00171     waitDialog->ExecuteLD( aResourceId ); 
00172     }

void CAknExNoteContainer::ShowProgressNoteUnderSingleProcessL (  TInt  aResourceId,
TInt  aControlId
) 
 

ShowProgressNoteUnderSingleProcessL Indicates ProgressNote.

Parameters:
aResourceId 
aControlId 

Definition at line 179 of file aknexnotecontainer.cpp.

References CallbackIncrementProgressNoteL(), iIdle, iProgressDialog, and iProgressInfo.

Referenced by CAknExNoteView::HandleCommandL().

00182     { 
00183     // Delete possible previous CAknProgressDialog.
00184     delete iProgressDialog;
00185 
00186     // Create new CAknProgressDialog.
00187     iProgressDialog = new ( ELeave ) CAknProgressDialog( reinterpret_cast
00188                                                          <CEikDialog**> 
00189                                                          ( &iProgressDialog ) );
00190     
00191     iProgressDialog->SetCallback( this );
00192     iProgressDialog->PrepareLC( aResourceId );
00193     iProgressInfo = iProgressDialog->GetProgressInfoL();
00194     iProgressInfo->SetFinalValue( KAknExNoteProgressbarFinalValue );
00195     iProgressDialog->RunLD();
00196 
00197     delete iIdle;
00198     iIdle = CIdle::NewL( CActive::EPriorityStandard );
00199     TCallBack callback( CallbackIncrementProgressNoteL, this );
00200     iIdle->Start( callback );
00201     }

void CAknExNoteContainer::ShowShowNoteL (  TAknGlobalNoteType  aType,
TInt  aResourceId
) 
 

ShowShowNoteL Show Note

Parameters:
aType 
aResourceId 

Definition at line 208 of file aknexnotecontainer.cpp.

References iPermanentNoteId.

Referenced by CAknExNoteView::HandleCommandL().

00210     {
00211     //Allocate TBuf with constant length.
00212     TBuf<KAknExNoteTextBufLength> text( NULL );
00213 
00214     // Reads a resource into a descriptor.
00215     CEikonEnv::Static()->ReadResource( text, aResourceId );
00216 
00217     TPtrC noteText( text );
00218 
00219     // Create new CAknGlobalNote instance.
00220     CAknGlobalNote* globalNote = CAknGlobalNote::NewL();
00221 
00222     // Push CAknGlobalNote's pointer to CleanupStack
00223     CleanupStack::PushL( globalNote );
00224 
00225     iPermanentNoteId = globalNote->ShowNoteL( aType, noteText );
00226 
00227     // Pop and Destroy CAknGlobalNote's pointer from CleanupStack
00228     CleanupStack::PopAndDestroy();
00229     }

TInt CAknExNoteContainer::CallbackIncrementProgressNoteL (  TAny *  aThis  )  [static]
 

CallbackIncrementProgressNoteL Callback function to increment progress note

Parameters:
aThis 
Returns:
TInt Return 0 when work is done, otherwise return 1.

Definition at line 238 of file aknexnotecontainer.cpp.

References UpdateProgressNote().

Referenced by ShowProgressNoteUnderSingleProcessL().

00239     {
00240     return static_cast<CAknExNoteContainer*>( aThis )->UpdateProgressNote();
00241     }

TInt CAknExNoteContainer::UpdateProgressNote (   ) 
 

UpdateProgressNote The entity of ProgressCallBackL() function

Returns:
TInt 0 when work is done, otherwise return 1.

Definition at line 248 of file aknexnotecontainer.cpp.

References iProgressDialog, and iProgressInfo.

Referenced by CallbackIncrementProgressNoteL().

00249     {
00250     TTime intervalTime;
00251     intervalTime.HomeTime();
00252     intervalTime += TTimeIntervalMicroSeconds( 50000 );
00253     TTime currentTime;
00254     currentTime.HomeTime();
00255 
00256     while ( intervalTime > currentTime )
00257         {
00258         currentTime.HomeTime();
00259         }
00260 
00261     iProgressInfo->IncrementAndDraw( 1 );
00262     if ( KAknExNoteProgressbarFinalValue <= iProgressInfo->CurrentValue() )
00263         {
00264         iProgressDialog->ProcessFinishedL();
00265         delete iProgressDialog;
00266         iProgressDialog = NULL;
00267         return 0;
00268         }
00269     return 1;
00270     }

void CAknExNoteContainer::DialogDismissedL (  TInt  aButtonId  ) 
 

DialogDismissedL Called when/if the dialog has been dismissed.

Parameters:
aButtonId 

Definition at line 278 of file aknexnotecontainer.cpp.

References iIdle.

00279     {
00280     // Check when pressing cancel button.
00281     if ( aButtonId == -1 )
00282         { 
00283         delete iIdle;
00284         iIdle = NULL;
00285         }
00286     }

void CAknExNoteContainer::CreateLabelL (   )  [private]
 

CreateLabelL Creates the label object.

Definition at line 293 of file aknexnotecontainer.cpp.

References iLabel, and SetTextToLabelL().

Referenced by ConstructL().

00294     {
00295     if ( iLabel )
00296         {
00297         delete iLabel;
00298         iLabel = NULL;
00299         }
00300 
00301     // Create new CEikLabel instance
00302     iLabel = new ( ELeave ) CEikLabel;
00303     iLabel->SetContainerWindowL( *this );
00304     iLabel->SetAlignment( EHCenterVCenter );
00305     
00306     // Set lablel's font
00307     iLabel->SetFont( LatinBold19() );
00308 
00309     // Set the Label's text from resource.
00310     SetTextToLabelL( R_AKNEXNOTE_TEXT_LABEL_TITLE );
00311     }

TKeyResponse CAknExNoteContainer::OfferKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [private]
 

OfferKeyEventL. Handles the key events.

Parameters:
aKeyEvent  Key event
aType  Type of key event (EEventKey, EEventKeyUp or EEventKeyDown)
Returns:
if key-event is consumed, EKeyWasConsumed. Else EKeyWasNotConsumed

Definition at line 318 of file aknexnotecontainer.cpp.

References CAknExNoteView::DisplayNextOutlineL(), and iView.

00320     {
00321     // Is not key event?
00322     if ( aType != EEventKey )
00323         {
00324         return EKeyWasNotConsumed;
00325         }
00326 
00327     switch ( aKeyEvent.iCode )
00328         {
00329         // Space key.
00330         case EKeySpace: 
00331 
00332             // Requires to display next outline screen.
00333             iView->DisplayNextOutlineL();
00334             DrawNow();
00335             break;
00336 
00337         // Is list box created?
00338         default:
00339             return EKeyWasNotConsumed;
00340         }
00341     return EKeyWasConsumed;
00342     }

void CAknExNoteContainer::SizeChanged (   )  [private]
 

SizeChanged Called by framework when the View size is changed..

Definition at line 349 of file aknexnotecontainer.cpp.

References iLabel.

00350     {
00351     iLabel->SetRect( Rect() );
00352     }

TInt CAknExNoteContainer::CountComponentControls (   )  const [private]
 

CountComponentControls. Returns number of component.

Returns:
Number of controls

Definition at line 359 of file aknexnotecontainer.cpp.

00360     {
00361     // return nbr of controls inside this container
00362     TInt count( KAknExNoteComponentCount );
00363     return count;
00364     }

CCoeControl * CAknExNoteContainer::ComponentControl (  TInt  aIndex  )  const [private]
 

ComponentControl. Returns pointer to particular component.

Parameters:
aIndex  Index of the control
Returns:
Pointer to Control's component control, identified by index

Definition at line 371 of file aknexnotecontainer.cpp.

References iLabel.

00372     {
00373     switch ( aIndex )
00374         {
00375         // Label object.
00376         case EAknExNoteComponentLabel: 
00377             return iLabel;
00378         // Exception : returns NULL value.
00379         default:
00380             return NULL;
00381         }
00382     }

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

Draw

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

Definition at line 389 of file aknexnotecontainer.cpp.

00390     {
00391     CWindowGc& gc = SystemGc();
00392     gc.SetPenStyle( CGraphicsContext::ENullPen );
00393     gc.SetBrushColor( KAknExNoteGray );
00394     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
00395     gc.DrawRect( aRect );
00396     }


Member Data Documentation

CEikLabel* CAknExNoteContainer::iLabel [private]
 

iLabel owned by CAknExNoteContainer object.

Definition at line 221 of file aknexnotecontainer.h.

Referenced by ComponentControl(), CreateLabelL(), SetTextToLabelL(), SizeChanged(), and ~CAknExNoteContainer().

CIdle* CAknExNoteContainer::iIdle [private]
 

iIdle owned by CAknExNoteContainer object.

Definition at line 227 of file aknexnotecontainer.h.

Referenced by DialogDismissedL(), ShowProgressNoteUnderSingleProcessL(), and ~CAknExNoteContainer().

CAknProgressDialog* CAknExNoteContainer::iProgressDialog [private]
 

iProgressDialog Not owned by CAknExNoteContainer object.

Definition at line 233 of file aknexnotecontainer.h.

Referenced by ShowProgressNoteUnderSingleProcessL(), and UpdateProgressNote().

CEikProgressInfo* CAknExNoteContainer::iProgressInfo [private]
 

iProgressInfo Not owned by CAknExNoteContainer object.

Definition at line 239 of file aknexnotecontainer.h.

Referenced by ShowProgressNoteUnderSingleProcessL(), and UpdateProgressNote().

CAknExNoteView* CAknExNoteContainer::iView [private]
 

iView Not owned by CAknExNoteContainer object.

Definition at line 245 of file aknexnotecontainer.h.

Referenced by OfferKeyEventL().

TInt CAknExNoteContainer::iGlobalNoteId [private]
 

Private Integers for Notes behaviours

Definition at line 248 of file aknexnotecontainer.h.


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

© Nokia 2009

Back to top