fep/aknfep/src/aknfepuispellcontainer.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c)  Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Provides the CAknFepUiSpellContainer methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 // INCLUDE FILES
       
    30 #include <eikgted.h>                  // for CEikGlobalTextEditor
       
    31 #include <eiktxlbm.h>                 // for CTextListBoxModel
       
    32 #include <eikclbd.h>                  // for CColumnListBoxData
       
    33 #include <eikbtgpc.h>                 // for CEikButtonGroupContainer
       
    34 #include <barsread.h>                 // for TResourceReader
       
    35 #include <eikclb.h>                   // for CEikColumnListBox
       
    36 #include <aknnotewrappers.h>          // for CAknInformationNote
       
    37 #include <appapaclayout.cdl.h>        // for Layout stuff
       
    38 #include <StringLoader.h>
       
    39 #include <aknlayoutscalable_apps.cdl.h>
       
    40 #include <layoutmetadata.cdl.h>
       
    41 
       
    42 #include "aknfepuispellcontainer.h"            
       
    43 #include "aknfepuispellinputpane.h"
       
    44 
       
    45 // CONSTANTS
       
    46 const TInt KNumberOfContainerControl = 1;
       
    47 
       
    48 // Enumarations
       
    49 enum TControls
       
    50     {
       
    51     EInputPane
       
    52     };
       
    53 
       
    54 // ================= MEMBER FUNCTIONS ======================
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CAknFepUiSpellContainer::CAknFepUiSpellContainer
       
    58 // (other items were commented in a header)
       
    59 // ---------------------------------------------------------------------------
       
    60 // 
       
    61 CAknFepUiSpellContainer::CAknFepUiSpellContainer()
       
    62 :iInputPane( NULL )
       
    63     {
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // CAknFepUiSpellContainer::InputPane
       
    68 // (other items were commented in a header)
       
    69 // ---------------------------------------------------------------------------
       
    70 // 
       
    71 CAknFepUiSpellInputPane* CAknFepUiSpellContainer::InputPane()
       
    72     {
       
    73     return iInputPane;
       
    74     }
       
    75 
       
    76 // ---------------------------------------------------------------------------
       
    77 // CAknFepUiSpellContainer::SetInputWinObserver
       
    78 // (other items were commented in a header)
       
    79 // ---------------------------------------------------------------------------
       
    80 // 
       
    81 void CAknFepUiSpellContainer::SetInputWinObserver( MEikEdwinObserver* aObserver )
       
    82     {
       
    83     iInputPane->SetInputWinObserver(aObserver);
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CAknFepUiSpellContainer::ConstructL
       
    88 // (other items were commented in a header)
       
    89 // ---------------------------------------------------------------------------
       
    90 // 
       
    91 void CAknFepUiSpellContainer::ConstructL(const TInt aEditorFlag, 
       
    92     const TInt aEditorCase, const TInt aEditorSCTResID)
       
    93     {  
       
    94     CreateWindowL();
       
    95 
       
    96     iInputPane = CAknFepUiSpellInputPane::NewL( this, aEditorFlag, aEditorCase,aEditorSCTResID);
       
    97     
       
    98     iInputPane->SetMopParent(this);
       
    99     
       
   100     iInputPane->SetFocus( ETrue );
       
   101     SetContainerRect();
       
   102     
       
   103     iEikonEnv->EikAppUi()->AddToStackL(this,ECoeStackPriorityDialog);    
       
   104     ActivateL();
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CAknFepUiSpellContainer::NewL
       
   109 // (other items were commented in a header)
       
   110 // ---------------------------------------------------------------------------
       
   111 // 
       
   112 CAknFepUiSpellContainer* CAknFepUiSpellContainer::NewL(const TInt aEditorFlag, 
       
   113     const TInt aEditorCase, const TInt aEditorSCTResID)
       
   114     {
       
   115     CAknFepUiSpellContainer* self = new ( ELeave ) CAknFepUiSpellContainer();
       
   116     CleanupStack::PushL( self );
       
   117     
       
   118     self->SetMopParent(CEikonEnv::Static()->EikAppUi());
       
   119     self->ConstructL(aEditorFlag, aEditorCase, aEditorSCTResID);
       
   120 
       
   121     CleanupStack::Pop();
       
   122     
       
   123     return self;
       
   124     }
       
   125 
       
   126 // ---------------------------------------------------------------------------
       
   127 // CAknFepUiSpellContainer::~CAknFepUiSpellContainer
       
   128 // (other items were commented in a header)
       
   129 // ---------------------------------------------------------------------------
       
   130 // 
       
   131 CAknFepUiSpellContainer::~CAknFepUiSpellContainer()
       
   132     {
       
   133     iEikonEnv->EikAppUi()->RemoveFromStack(this);
       
   134     
       
   135     delete iInputPane;
       
   136     iInputPane = NULL;
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // CAknFepUiSpellContainer::CountComponentControls
       
   141 // (other items were commented in a header)
       
   142 // ---------------------------------------------------------------------------
       
   143 // 
       
   144 TInt CAknFepUiSpellContainer::CountComponentControls() const
       
   145     {
       
   146     return KNumberOfContainerControl; 
       
   147     }
       
   148 
       
   149 // ---------------------------------------------------------------------------
       
   150 // CAknFepUiSpellContainer::ComponentControl
       
   151 // (other items were commented in a header)
       
   152 // ---------------------------------------------------------------------------
       
   153 // 
       
   154 CCoeControl* CAknFepUiSpellContainer::ComponentControl( TInt aIndex ) const
       
   155     {
       
   156     switch ( aIndex )
       
   157         {
       
   158         case EInputPane:
       
   159             {
       
   160             return iInputPane;
       
   161             }
       
   162         default:
       
   163             {
       
   164             return NULL;
       
   165             }
       
   166         }
       
   167     }
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // CAknFepUiSpellContainer::Draw
       
   171 // (other items were commented in a header)
       
   172 // ---------------------------------------------------------------------------
       
   173 // 
       
   174 void CAknFepUiSpellContainer::Draw( const TRect& /*aRect*/ ) const
       
   175     {
       
   176     }
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // CAknFepUiSpellContainer::InputCapabilities
       
   180 // (other items were commented in a header)
       
   181 // ---------------------------------------------------------------------------
       
   182 // 
       
   183 TCoeInputCapabilities CAknFepUiSpellContainer::InputCapabilities() const
       
   184     {
       
   185     if ( iInputPane && iInputPane->IsFocused())
       
   186         {
       
   187         return iInputPane->InputCapabilities();
       
   188         }
       
   189 
       
   190     return ENone;
       
   191     }
       
   192 
       
   193 // ---------------------------------------------------------------------------
       
   194 // CAknFepUiSpellContainer::OfferKeyEventL
       
   195 // (other items were commented in a header)
       
   196 // ---------------------------------------------------------------------------
       
   197 // 
       
   198 TKeyResponse CAknFepUiSpellContainer::OfferKeyEventL( 
       
   199             const TKeyEvent& aKeyEvent, TEventCode aType )
       
   200     {
       
   201     if ( iInputPane && iInputPane->IsFocused())
       
   202         {
       
   203         return iInputPane->OfferKeyEventL( aKeyEvent, aType );
       
   204         }
       
   205     
       
   206     return EKeyWasNotConsumed;
       
   207     }
       
   208 
       
   209 // ---------------------------------------------------------------------------
       
   210 // CAknFepUiSpellContainer::SizeChanged
       
   211 // (other items were commented in a header)
       
   212 // ---------------------------------------------------------------------------
       
   213 // 
       
   214 void CAknFepUiSpellContainer::SizeChanged()
       
   215     {  
       
   216     iInputPane->SetRect(Rect());
       
   217     }
       
   218 
       
   219 // ---------------------------------------------------------------------------
       
   220 // CAknFepUiSpellContainer::SetContainerRect
       
   221 // (other items were commented in a header)
       
   222 // ---------------------------------------------------------------------------
       
   223 // 
       
   224 void CAknFepUiSpellContainer::FocusChanged(TDrawNow aDrawNow)
       
   225     {
       
   226     TBool bFocused = IsFocused() ? ETrue : EFalse;
       
   227     
       
   228     if ( ComponentControl( 0 ) )
       
   229         {
       
   230         ComponentControl( 0 )->SetFocus( bFocused, aDrawNow );
       
   231         }
       
   232     }
       
   233 
       
   234 // ---------------------------------------------------------------------------
       
   235 // CAknFepUiSpellContainer::SetContainerRect
       
   236 // (other items were commented in a header)
       
   237 // ---------------------------------------------------------------------------
       
   238 // 
       
   239 void  CAknFepUiSpellContainer::SetContainerRect()
       
   240     {
       
   241     TAknWindowLineLayout appWnd = AknLayoutScalable_Apps::application_window().LayoutLine();
       
   242     TAknWindowLineLayout mainPane;
       
   243     if ( Layout_Meta_Data::IsLandscapeOrientation())
       
   244         {
       
   245         mainPane = AknLayoutScalable_Apps::main_pane(4).LayoutLine();	
       
   246         }
       
   247     else
       
   248         {
       
   249         mainPane = AknLayoutScalable_Apps::main_pane(0).LayoutLine();		
       
   250         }
       
   251      
       
   252     TAknLayoutRect mainPaneRect;
       
   253     mainPaneRect.LayoutRect(appWnd.Rect(), mainPane);
       
   254 
       
   255     mainPaneRect.Rect();
       
   256     
       
   257     TInt ay = mainPaneRect.Rect().iTl.iY + 
       
   258               ((mainPaneRect.Rect().iBr.iY - mainPaneRect.Rect().iTl.iY) / 5)*4;
       
   259     
       
   260     TRect containerRect(0, ay, mainPaneRect.Rect().iBr.iX, mainPaneRect.Rect().iBr.iY);
       
   261     TRect tempRect = TRect(0,0,1,1);
       
   262     SetRect(tempRect);
       
   263     }
       
   264     
       
   265 // End of File