phoneuis/BubbleManager/Src/BMConfPane.cpp
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Conf Pane
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "BMConfPane.h"  //definition
       
    21 #include    "BMLayout.h" //coordinates
       
    22 #include    "BMLayout2.h" //coordinates
       
    23 #include    "BMLayout4.h" //coordinates
       
    24 #include    "BMUtils.h"     //utility functions
       
    25 
       
    26 #include    <eiklabel.h>    //CEikLabel
       
    27 #include    <eikimage.h>    //CEikImage
       
    28 #include    <eikenv.h>      //environment
       
    29 #include    <AknsDrawUtils.h>
       
    30 #include    <AknsConstants.h>
       
    31 #include    <skinlayout.cdl.h>
       
    32 
       
    33 // ========================= MEMBER FUNCTIONS ================================
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CBubbleConfPane::ConstructL( )
       
    37 // Symbian OS two phased constructor
       
    38 // 
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 void CBubbleConfPane::ConstructL( TBool aTouchCallHandling )
       
    42     {
       
    43     iTouchCallHandling = aTouchCallHandling;
       
    44     iFullText.Set( NULL , 0 );
       
    45     
       
    46     iIsHighlighted = EFalse;
       
    47     ActivateL();
       
    48     }
       
    49 
       
    50 
       
    51 // Destructor
       
    52 CBubbleConfPane::~CBubbleConfPane()
       
    53     {
       
    54     Reset();
       
    55     }
       
    56 
       
    57 
       
    58 // ---------------------------------------------------------------------------
       
    59 // CBubbleConfPane::SizeChanged
       
    60 // called by framework when the view size is changed
       
    61 //  
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 void CBubbleConfPane::SizeChanged()
       
    65     { 
       
    66     AknsUtils::RegisterControlPosition( this );
       
    67 
       
    68     if ( iTouchCallHandling )
       
    69         {
       
    70         DoCall4Layout();                
       
    71         }
       
    72     else if ( !iCallObjectDisplay )
       
    73         {
       
    74         DoCall1Layout();            
       
    75         }
       
    76     else
       
    77         {
       
    78         DoCall2Layout();                
       
    79         }        
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CBubbleConfPane::PositionChanged
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 void CBubbleConfPane::PositionChanged()
       
    87     {
       
    88     AknsUtils::RegisterControlPosition( this );
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CBubbleConfPane::CountComponentControls
       
    93 //
       
    94 //  
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 TInt CBubbleConfPane::CountComponentControls() const
       
    98     {
       
    99     TInt amount = 0;
       
   100     if ( iCallIndication ) 
       
   101         {
       
   102         amount++;
       
   103         }
       
   104     if ( iCyphOffImage ) 
       
   105         {
       
   106         amount++;
       
   107         }
       
   108     if ( iTextLine )
       
   109         {
       
   110         amount++;
       
   111         }
       
   112     return amount;
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // CBubbleConfPane::ComponentControl
       
   117 //
       
   118 //  
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 CCoeControl* CBubbleConfPane::ComponentControl( TInt aIndex ) const
       
   122     {
       
   123     TInt amount = -1;
       
   124     if ( iCallIndication )
       
   125         {
       
   126         amount++;
       
   127         }
       
   128     if ( aIndex == amount ) 
       
   129         {
       
   130         return iCallIndication;
       
   131         }
       
   132     if ( iCyphOffImage )
       
   133         {
       
   134         amount++;
       
   135         }
       
   136     if ( aIndex == amount ) 
       
   137         {
       
   138         return iCyphOffImage;
       
   139         }
       
   140     if ( iTextLine ) 
       
   141         {
       
   142         amount++;
       
   143         }
       
   144     if ( aIndex == amount ) 
       
   145         {
       
   146         return iTextLine;
       
   147         }
       
   148     return NULL;
       
   149     }
       
   150 
       
   151 // ---------------------------------------------------------------------------
       
   152 // CBubbleConfPane::Draw
       
   153 // 
       
   154 //  
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 void CBubbleConfPane::Draw( const TRect& /*aRect*/ ) const
       
   158     {
       
   159     
       
   160     CWindowGc& gc = SystemGc( );
       
   161     gc.SetBrushColor( AKN_LAF_COLOR( BubbleLayout::LayoutColourWhite() ) );
       
   162     
       
   163     // Set texts to fit.
       
   164     BubbleUtils::ClipToLabel( iFullText , iTextLine , iTextClipDirection );
       
   165 
       
   166     // draw hightlight rectangles if needed
       
   167     if ( iIsHighlighted ) 
       
   168         {      
       
   169         TBool highlightDrawn = EFalse;
       
   170         TAknLayoutRect topLeft;
       
   171         topLeft.LayoutRect(
       
   172             iHighlight.Rect(), 
       
   173             SkinLayout::List_highlight_skin_placing__general__Line_2() );
       
   174 
       
   175         TAknLayoutRect bottomRight;
       
   176         bottomRight.LayoutRect(
       
   177             iHighlight.Rect(), 
       
   178             SkinLayout::List_highlight_skin_placing__general__Line_5() );
       
   179 
       
   180         TRect outerRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
       
   181         TRect innerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
       
   182         
       
   183         MAknsSkinInstance *skin = AknsUtils::SkinInstance();
       
   184         gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   185         highlightDrawn = AknsDrawUtils::DrawFrame( skin, gc, 
       
   186                                                    outerRect,
       
   187                                                    innerRect,
       
   188                                                    KAknsIIDQsnFrList, 
       
   189                                                    KAknsIIDQsnFrListCenter );
       
   190 
       
   191         if ( !highlightDrawn )
       
   192             {
       
   193             iShadow.DrawRect( gc );
       
   194             iHighlight.DrawRect( gc );
       
   195             }
       
   196         }
       
   197     }
       
   198 
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CBubbleConfPane::Reset
       
   202 //  
       
   203 // Put member variables to initial state.
       
   204 // ---------------------------------------------------------------------------
       
   205 //
       
   206 void CBubbleConfPane::Reset( )
       
   207     {
       
   208     BubbleUtils::AddTextToEikLabel( iTextLine , KNullDesC );
       
   209     iFullText.Set( NULL , 0 );
       
   210     iIsHighlighted = EFalse;
       
   211     }
       
   212 
       
   213 // ---------------------------------------------------------------------------
       
   214 // CBubbleConfPane::SetHighlight
       
   215 //  
       
   216 //  
       
   217 // ---------------------------------------------------------------------------
       
   218 //
       
   219 void CBubbleConfPane::SetHighlight( const TBool& aIsHighlighted )
       
   220     {
       
   221     iIsHighlighted = aIsHighlighted;
       
   222     }
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // CBubbleConfPane::GetCallIndicationHandle
       
   226 //  
       
   227 //  Returns pointer to image so that bubble outlook can attach bitmap to it
       
   228 // ---------------------------------------------------------------------------
       
   229 //
       
   230 CEikImage*& CBubbleConfPane::CallIndicationHandle( )
       
   231     {
       
   232     return iCallIndication;
       
   233     } 
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // CBubbleConfPane::SetText
       
   237 //  
       
   238 //  
       
   239 // ---------------------------------------------------------------------------
       
   240 //
       
   241 void CBubbleConfPane::SetText( TPtrC aText , 
       
   242                         const CBubbleManager::TPhoneClippingDirection& aDir )
       
   243     {
       
   244     iFullText.Set( aText );
       
   245     iTextClipDirection = aDir;
       
   246     }
       
   247 
       
   248 // ---------------------------------------------------------------------------
       
   249 // CBubbleConfPane::DoCall1Layout
       
   250 // ---------------------------------------------------------------------------
       
   251 //    
       
   252 void CBubbleConfPane::DoCall1Layout()
       
   253     {
       
   254     // Deprecated
       
   255     }
       
   256 
       
   257 // ---------------------------------------------------------------------------
       
   258 // CBubbleConfPane::DoCall2Layout
       
   259 // ---------------------------------------------------------------------------
       
   260 //
       
   261 void CBubbleConfPane::DoCall2Layout()
       
   262     {
       
   263     BubbleUtils::LayoutImage( 
       
   264         iCallIndication, 
       
   265         Rect() , 
       
   266         BubbleLayout2::popup_call2_conf_single_list_pane_call_status_icon() );
       
   267 
       
   268     BubbleUtils::LayoutImage( 
       
   269         iCyphOffImage, 
       
   270         Rect() , 
       
   271         BubbleLayout2::popup_call2_conf_single_list_pane_ciphering_icon() );
       
   272 
       
   273     BubbleUtils::LayoutLabel( 
       
   274         iTextLine, 
       
   275         Rect(), 
       
   276         BubbleLayout2::popup_call2_conf_single_list_pane_cli_text());
       
   277 
       
   278     iShadow.LayoutRect( 
       
   279         Rect() , 
       
   280         BubbleLayout2::popup_call2_conf_single_list_highlight_pane() );
       
   281 
       
   282     iHighlight.LayoutRect( 
       
   283         Rect() ,
       
   284         BubbleLayout2::popup_call2_conf_single_list_highlight_pane() ); 
       
   285     }
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CBubbleConfPane::DoCall4Layout
       
   289 // ---------------------------------------------------------------------------
       
   290 //
       
   291 void CBubbleConfPane::DoCall4Layout()
       
   292     {
       
   293     BubbleUtils::LayoutImage( 
       
   294         iCallIndication, 
       
   295         Rect() , 
       
   296         BubbleLayout4::popup_call4_conf_single_list_pane_call_status_icon() );
       
   297 
       
   298     BubbleUtils::LayoutImage( 
       
   299         iCyphOffImage, 
       
   300         Rect() , 
       
   301         BubbleLayout4::popup_call4_conf_single_list_pane_ciphering_icon() );
       
   302 
       
   303     BubbleUtils::LayoutLabel( 
       
   304         iTextLine, 
       
   305         Rect(), 
       
   306         BubbleLayout4::popup_call4_conf_single_list_pane_cli_text());
       
   307 
       
   308     iShadow.LayoutRect( 
       
   309         Rect() , 
       
   310         BubbleLayout4::popup_call4_conf_single_list_highlight_pane() );
       
   311 
       
   312     iHighlight.LayoutRect( 
       
   313         Rect() ,
       
   314         BubbleLayout4::popup_call4_conf_single_list_highlight_pane() ); 
       
   315     }
       
   316     
       
   317 // End of File