/* 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 "TwoForms.hrh" #include "TwoFormsAppView.h" #include "TwoFormsContainer.h" #include "TwoFormsSaveForm.h" // ================= MEMBER FUNCTIONS ========================================= // ---------------------------------------------------------------------------- // CTwoFormsContainer::CTwoFormsContainer() // Overload constructor. // ---------------------------------------------------------------------------- // CTwoFormsContainer::CTwoFormsContainer( CTwoFormsView* aView ) : iView( aView ), iLabel( NULL ) { } // ---------------------------------------------------------------------------- // void CTwoFormsContainer::ConstructL() // Symbian constructor. // ---------------------------------------------------------------------------- // void CTwoFormsContainer::ConstructL( const TRect& aRect ) { // Creates window. CreateWindowL(); // Creates label object. CreateLabelL(); SetRect( aRect ); // Sets rectangle of frame. ActivateL(); // Activates the window. ( Ready to draw ) } // ---------------------------------------------------------------------------- // CTwoFormsContainer::~CTwoFormsContainer() // Destructor. // ---------------------------------------------------------------------------- // CTwoFormsContainer::~CTwoFormsContainer() { delete iLabel; } // ---------------------------------------------------------------------------- // CTwoFormsContainer::SetTextToLabelL() // // ---------------------------------------------------------------------------- // void CTwoFormsContainer::SetTextToLabelL( TInt aResourceId ) { TBuf messageString( NULL ); iCoeEnv->ReadResource( messageString, aResourceId ); iLabel->SetTextL( messageString ); } // ---------------------------------------------------------------------------- // CTwoFormsContainer::DisplayFormL() // // ---------------------------------------------------------------------------- // void CTwoFormsContainer::DisplayFormL( TInt aResourceId ) { CTwoFormsSaveForm* form = CTwoFormsSaveForm::NewL(); { form->ExecuteLD( aResourceId ); } } // ---------------------------------------------------------------------------- // CTwoFormsContainer::CreateLabelL() // Creates label object. // ---------------------------------------------------------------------------- // void CTwoFormsContainer::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_TWOFORMS_TITLE ); } // ---------------------------------------------------------------------------- // CTwoFormsContainer::OfferKeyEventL() // Handles the key events. // ---------------------------------------------------------------------------- // TKeyResponse CTwoFormsContainer::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; } // ---------------------------------------------------------------------------- // CTwoFormsContainer::SizeChanged() // Called by framework when the view size is changed // ---------------------------------------------------------------------------- // void CTwoFormsContainer::SizeChanged() { iLabel->SetRect( Rect() ); } // ---------------------------------------------------------------------------- // CTwoFormsContainer::CountComponentControls() // Returns number of component. // ---------------------------------------------------------------------------- // TInt CTwoFormsContainer::CountComponentControls() const { // returns nbr of controls inside this container return KTwoFormsCountComponent; } // ---------------------------------------------------------------------------- // CTwoFormsContainer::ComponentControl() // Returns pointer to particular component. // ---------------------------------------------------------------------------- // CCoeControl* CTwoFormsContainer::ComponentControl( TInt aIndex ) const { switch ( aIndex ) // Component is... { case ETwoFormsComponentLabel: // Label object. return iLabel; default: // Exception : returns NULL value. return NULL; } } // ---------------------------------------------------------------------------- // CTwoFormsContainer::Draw() // Clears the window's rectangle. // ---------------------------------------------------------------------------- // void CTwoFormsContainer::Draw( const TRect& aRect ) const { CWindowGc& gc = SystemGc(); gc.SetPenStyle( CGraphicsContext::ENullPen ); gc.SetBrushColor( TWOFORMS_BACKGROUND_COLOR ); gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); gc.DrawRect( aRect ); } // End of File