/* Machine-made version of this file copyright (c) 2005 Somusar */ /* Derived from samples that are Copyright (c) 2004, Nokia. All rights reserved */ // INCLUDE FILES #include // for AKN_LAF_COLOR #include #include // for label #include // for form control #include // for secret editor #include // for edwins #include #include "AknExForm.hrh" #include "AknExFormAppView.h" #include "AknExFormContainer.h" #include "AknExFormSaveForm.h" // ================= MEMBER FUNCTIONS ========================================= // ---------------------------------------------------------------------------- // CAknExFormContainer::CAknExFormContainer() // Overload constructor. // ---------------------------------------------------------------------------- // CAknExFormContainer::CAknExFormContainer( CAknExFormView* aView ) : iView( aView ), iLabel( NULL ) { } // ---------------------------------------------------------------------------- // void CAknExFormContainer::ConstructL() // Symbian constructor. // ---------------------------------------------------------------------------- // void CAknExFormContainer::ConstructL( const TRect& aRect ) { // Creates window. CreateWindowL(); // Creates label object. CreateLabelL(); SetRect( aRect ); // Sets rectangle of frame. ActivateL(); // Activates the window. ( Ready to draw ) } // ---------------------------------------------------------------------------- // CAknExFormContainer::~CAknExFormContainer() // Destructor. // ---------------------------------------------------------------------------- // CAknExFormContainer::~CAknExFormContainer() { delete iLabel; } // ---------------------------------------------------------------------------- // CAknExFormContainer::SetTextToLabelL() // // ---------------------------------------------------------------------------- // void CAknExFormContainer::SetTextToLabelL( TInt aResourceId ) { TBuf messageString( NULL ); iCoeEnv->ReadResource( messageString, aResourceId ); iLabel->SetTextL( messageString ); } // ---------------------------------------------------------------------------- // CAknExFormContainer::DisplayFormL() // // ---------------------------------------------------------------------------- // void CAknExFormContainer::DisplayFormL( TInt aResourceId ) { CAknExFormSaveForm* form = CAknExFormSaveForm::NewL(); { form->ExecuteLD( aResourceId ); } } // ---------------------------------------------------------------------------- // CAknExFormContainer::CreateLabelL() // Creates label object. // ---------------------------------------------------------------------------- // void CAknExFormContainer::CreateLabelL() { if ( !iLabel ) { iLabel = new( ELeave ) CEikLabel; iLabel->SetContainerWindowL( *this ); iLabel->SetAlignment( EHCenterVCenter ); #ifdef __AVKON_APAC__ iLabel->SetFont( ApacPlain16()); #else iLabel->SetFont( LatinBold19()); #endif } SetTextToLabelL( R_AKNEXFORM_TITLE ); } // ---------------------------------------------------------------------------- // CAknExFormContainer::OfferKeyEventL() // Handles the key events. // ---------------------------------------------------------------------------- // TKeyResponse CAknExFormContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) { if ( aType != EEventKey ) // Is not key event? { return EKeyWasNotConsumed; } switch ( aKeyEvent.iCode ) // The code of key event is... { case EKeySpace: // Space key. { // Requires to display next outline screen. iView->DisplayNextOutlineL(); DrawNow(); break; } default: return EKeyWasNotConsumed; } return EKeyWasConsumed; } // ---------------------------------------------------------------------------- // CAknExFormContainer::SizeChanged() // Called by framework when the view size is changed // ---------------------------------------------------------------------------- // void CAknExFormContainer::SizeChanged() { iLabel->SetRect( Rect() ); } // ---------------------------------------------------------------------------- // CAknExFormContainer::CountComponentControls() // Returns number of component. // ---------------------------------------------------------------------------- // TInt CAknExFormContainer::CountComponentControls() const { // returns nbr of controls inside this container return KAknExFormCountComponent; } // ---------------------------------------------------------------------------- // CAknExFormContainer::ComponentControl() // Returns pointer to particular component. // ---------------------------------------------------------------------------- // CCoeControl* CAknExFormContainer::ComponentControl( TInt aIndex ) const { switch ( aIndex ) // Component is... { case EAknExFormComponentLabel: // Label object. return iLabel; default: // Exception : returns NULL value. return NULL; } } // ---------------------------------------------------------------------------- // CAknExFormContainer::Draw() // Clears the window's rectangle. // ---------------------------------------------------------------------------- // void CAknExFormContainer::Draw( const TRect& aRect ) const { CWindowGc& gc = SystemGc(); gc.SetPenStyle( CGraphicsContext::ENullPen ); gc.SetBrushColor( AKNEXFORM_BACKGROUND_COLOR ); gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); gc.DrawRect( aRect ); } // End of File