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