uifw/uiklaf/src/lafbtpan.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 1998-1999 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "lafbtpan.h"
       
    20 #include <lafpanic.h>
       
    21 #include "LAFSTD.H"
       
    22 
       
    23 const TInt8 KLafButtonPanelTopMargin		=2;
       
    24 const TInt8 KLafButtonPanelBottomMargin		=2;
       
    25 const TInt8 KLafButtonPanelLeftMargin		=4;
       
    26 const TInt8 KLafButtonPanelRightMargin		=4;
       
    27 
       
    28 /**
       
    29  * The ButtonsAllSameSize() function should return ETrue if all dialog buttons are to be
       
    30  * the same size, or EFalse if they should only be their MinimumSize().
       
    31  */
       
    32 EXPORT_C TBool LafButtonPanel::ButtonsAllSameSize()
       
    33 	{//static 
       
    34 	return ETrue; 
       
    35 	}
       
    36 
       
    37 
       
    38 /**
       
    39  * Shares out the length aExcess
       
    40  * between aShiftLeft and aShiftRight in order to align the button panel within the dialog.
       
    41  * This function is only used for horizontal buttons.
       
    42  */
       
    43 EXPORT_C void LafButtonPanel::TranslateForExcessSpace(TInt aExcess, TInt& aShiftLeft, TInt& aShiftRight)
       
    44 	{//static 
       
    45 	aShiftLeft=aExcess/2;
       
    46 	aShiftRight=(aShiftLeft-aExcess);
       
    47 	}
       
    48 
       
    49 /**
       
    50  * The ReduceMarginsToFit() function should reduce aHorizontalBorder and aGapBetweenButtons
       
    51  * until all of the lines of buttons in aArray fit into the available space. This function
       
    52  * should only be implemented by devices supporting dynamic margin adjustments when not 
       
    53  * enough space is provided.
       
    54  */
       
    55 EXPORT_C void LafButtonPanel::ReduceMarginsToFit(
       
    56 	const TFixedArray<TDimensions,KLafButPanMaxLinesOfDlgButtons>& /*aArray*/,
       
    57 	TInt8& /*aLeftBorder*/, TInt8& /*aRightBorder*/, TInt& /*aGapBetweenButtons*/)
       
    58 	{//static 
       
    59 	}
       
    60 
       
    61 /**
       
    62  * Return the margins for the button panel, packaged in a TMargins8 object
       
    63  *
       
    64  * @since App-Framework_6.1
       
    65  */
       
    66 EXPORT_C TMargins8 LafButtonPanel::Margins()
       
    67  	{
       
    68  	TMargins8 margins;
       
    69  	margins.iLeft = KLafButtonPanelLeftMargin;
       
    70  	margins.iRight = KLafButtonPanelRightMargin;
       
    71  	margins.iTop = KLafButtonPanelTopMargin;
       
    72  	margins.iBottom = KLafButtonPanelBottomMargin;
       
    73  	return margins;
       
    74  	}
       
    75 
       
    76 EXPORT_C TInt LafButtonPanel::Constant(TConstantType aConstant)
       
    77 	{//static
       
    78 	TInt retVal=0;
       
    79 	switch (aConstant)
       
    80 		{
       
    81 	case EStartCorner:
       
    82 		retVal=SLafControlGroup::EFromTopLeft;
       
    83 		break;
       
    84 	case EOrientation:
       
    85 		retVal=SLafControlGroup::ELayVertically;
       
    86 		break;
       
    87 	case EInterRowMargin:
       
    88 		retVal=2;
       
    89 		break;
       
    90 	case EVerticalGap:
       
    91 		retVal=5;
       
    92 		break;
       
    93 	case EHorizontalGap:
       
    94 		retVal=12;
       
    95 		break;
       
    96 	case EMinWidth:
       
    97 		retVal=50;
       
    98 		break;
       
    99 	default:
       
   100 		__ASSERT_DEBUG(EFalse,Panic(ELafPanicConstantNotKnown)); // should never be reached
       
   101 		break;
       
   102 		}
       
   103 	return retVal;
       
   104 	};