uifw/EikStd/coctlsrc/AknButton.cpp
branchRCL_3
changeset 15 c52421ed5f07
parent 12 941195f2d488
child 17 a1caeb42b3a3
equal deleted inserted replaced
13:a8834a2e9a96 15:c52421ed5f07
     1 /*
     1 /*
     2 * Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   288     //Previous touch down or drag position, valid only with pressed state. 
   288     //Previous touch down or drag position, valid only with pressed state. 
   289     TPoint iPrePointerPos;
   289     TPoint iPrePointerPos;
   290     CAknsFrameBackgroundControlContext* iHighlightContext;  
   290     CAknsFrameBackgroundControlContext* iHighlightContext;  
   291     // buffer for visually ordered text
   291     // buffer for visually ordered text
   292     TBuf<255 + KAknBidiExtraSpacePerLine> iVisualText; 
   292     TBuf<255 + KAknBidiExtraSpacePerLine> iVisualText; 
   293     TBool iFeedbackEnabled; 
   293     TBool iFeedbackEnabled;
       
   294     TAknsItemID iBackgroundSkinIID;
       
   295     TRect iBgFrameRect;
   294     };
   296     };
   295 
   297 
   296 // ============================ MEMBER FUNCTIONS ===============================
   298 // ============================ MEMBER FUNCTIONS ===============================
   297 
   299 
   298 // -----------------------------------------------------------------------------
   300 // -----------------------------------------------------------------------------
  1034 // Sets state flags.
  1036 // Sets state flags.
  1035 // -----------------------------------------------------------------------------
  1037 // -----------------------------------------------------------------------------
  1036 //
  1038 //
  1037 EXPORT_C void CAknButtonState::SetFlags( const TInt aFlags )
  1039 EXPORT_C void CAknButtonState::SetFlags( const TInt aFlags )
  1038     {
  1040     {
  1039     if ( iFlags & KAknButtonStateHasLatchedFrame != 
  1041     if ( ( iFlags & KAknButtonStateHasLatchedFrame ) != 
  1040         aFlags & KAknButtonStateHasLatchedFrame )
  1042         ( aFlags & KAknButtonStateHasLatchedFrame ) )
  1041         {
  1043         {
  1042         iExtension->iFlagsChanged = ETrue; 
  1044         iExtension->iFlagsChanged = ETrue; 
  1043         }
  1045         }
  1044     iFlags = aFlags;
  1046     iFlags = aFlags;
  1045     }
  1047     }
  4576             {
  4578             {
  4577             // dimmed frame
  4579             // dimmed frame
  4578             frameIdIndex = KDimmedFrameId;
  4580             frameIdIndex = KDimmedFrameId;
  4579             }
  4581             }
  4580 
  4582 
  4581         if ( SkinIID( frameIdIndex ) != KAknsIIDNone )
  4583         TAknsItemID skinIID( SkinIID( frameIdIndex ) );
  4582             {
  4584 
  4583             iBgContext->SetFrame( SkinIID( frameIdIndex ) );
  4585         // Only change the background frame graphics if necessary.
       
  4586         if ( skinIID != KAknsIIDNone &&
       
  4587              skinIID != iExtension->iBackgroundSkinIID )
       
  4588             {
       
  4589             iBgContext->SetFrame( skinIID );
  4584             iBgContext->SetCenter( SkinIID( ++frameIdIndex) );
  4590             iBgContext->SetCenter( SkinIID( ++frameIdIndex) );
       
  4591             iExtension->iBackgroundSkinIID = skinIID;
  4585             }
  4592             }
  4586         }
  4593         }
  4587     if ( state )
  4594     if ( state )
  4588         {
  4595         {
  4589         state->ResetFlagsChanged(); 
  4596         state->ResetFlagsChanged(); 
  4595 // -----------------------------------------------------------------------------
  4602 // -----------------------------------------------------------------------------
  4596 //
  4603 //
  4597 void CAknButton::SetFrameRects()
  4604 void CAknButton::SetFrameRects()
  4598     {
  4605     {
  4599     TRect rect( Rect() );
  4606     TRect rect( Rect() );
  4600     TAknLayoutRect centerLayout;
  4607 
  4601     centerLayout.LayoutRect( rect,
  4608     // Only change the frame rects is the button rectangle is valid and the
  4602         AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine() );
  4609     // button size has changed.
  4603     TRect innerRect( centerLayout.Rect() );
  4610     if ( !rect.IsEmpty() && iExtension->iBgFrameRect != rect )
  4604 
  4611         {
  4605     iBgContext->SetFrameRects( rect, innerRect ); 
  4612         TAknLayoutRect centerLayout;
  4606     iExtension->iHighlightContext->SetFrameRects( rect, innerRect ); 
  4613         centerLayout.LayoutRect( rect,
       
  4614             AknLayoutScalable_Avkon::toolbar_button_pane_g1().LayoutLine() );
       
  4615         TRect innerRect( centerLayout.Rect() );
       
  4616 
       
  4617         iBgContext->SetFrameRects( rect, innerRect );
       
  4618         iExtension->iHighlightContext->SetFrameRects( rect, innerRect );
       
  4619         iExtension->iBgFrameRect = rect;
       
  4620         }
  4607     }
  4621     }
  4608 
  4622 
  4609 // -----------------------------------------------------------------------------
  4623 // -----------------------------------------------------------------------------
  4610 // CAknButton::ConvertTextToVisualAndClip
  4624 // CAknButton::ConvertTextToVisualAndClip
  4611 // -----------------------------------------------------------------------------
  4625 // -----------------------------------------------------------------------------