uifw/EikStd/dlgsrc/EIKCAPCA.CPP
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 29 a8834a2e9a96
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    22 #include <AknUtils.h>
    22 #include <AknUtils.h>
    23 #include <aknlayoutscalable_avkon.cdl.h>
    23 #include <aknlayoutscalable_avkon.cdl.h>
    24 #include <AknsUtils.h>
    24 #include <AknsUtils.h>
    25 #include <eikedwin.h>
    25 #include <eikedwin.h>
    26 #include "AknPanic.h"
    26 #include "AknPanic.h"
       
    27 #include "akntrace.h"
    27 
    28 
    28 const TInt KVerticalSpacing=-2;  // Avkon form controls overlap by two pixels!
    29 const TInt KVerticalSpacing=-2;  // Avkon form controls overlap by two pixels!
    29 const TInt KVerticalSpacingSquash=0;
    30 const TInt KVerticalSpacingSquash=0;
    30 
    31 
    31 const TInt KAknTopMargin = 0 ;
    32 const TInt KAknTopMargin = 0 ;
    96 	return iExtension;
    97 	return iExtension;
    97 }
    98 }
    98 
    99 
    99 TInt CEikCapCArray::NumberOfTextLines() const
   100 TInt CEikCapCArray::NumberOfTextLines() const
   100 {
   101 {
       
   102 	_AKNTRACE_FUNC_ENTER;
   101 	CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL;
   103 	CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL;
   102 	const CEikDialogPage *dialogPage = firstCapCC ? firstCapCC->DialogPage() : NULL;
   104 	const CEikDialogPage *dialogPage = firstCapCC ? firstCapCC->DialogPage() : NULL;
   103     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
   105     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
   104 	if ( dialogPage )
   106 	if ( dialogPage )
   105 		ret = dialogPage->FormLayout();
   107 		ret = dialogPage->FormLayout();
   121 					TInt h = line->NumberOfLinesForScrollBar();
   123 					TInt h = line->NumberOfLinesForScrollBar();
   122 					num_of_lines = h; // one for title
   124 					num_of_lines = h; // one for title
   123 					}	
   125 					}	
   124 		lines += num_of_lines;
   126 		lines += num_of_lines;
   125 	}
   127 	}
       
   128 	_AKNTRACE( "lines: [%d]", lines );
       
   129 	_AKNTRACE_FUNC_EXIT;
   126 	return lines;
   130 	return lines;
   127 }
   131 }
   128 
   132 
   129 TInt CEikCapCArray::NumberOfTextLinesBeforeLine(TInt aLine) const
   133 TInt CEikCapCArray::NumberOfTextLinesBeforeLine(TInt aLine) const
   130 {
   134 {
       
   135 	_AKNTRACE_FUNC_ENTER;
   131 	CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL;
   136 	CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL;
   132 	const CEikDialogPage *dialogPage = firstCapCC ? firstCapCC->DialogPage() : NULL;
   137 	const CEikDialogPage *dialogPage = firstCapCC ? firstCapCC->DialogPage() : NULL;
   133     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
   138     CEikDialogPage::TFormLayoutSelection ret = CEikDialogPage::ESingle;
   134 	if ( dialogPage )
   139 	if ( dialogPage )
   135 		ret = dialogPage->FormLayout();
   140 		ret = dialogPage->FormLayout();
   151 					TInt h = line->NumberOfLinesForScrollBar();
   156 					TInt h = line->NumberOfLinesForScrollBar();
   152 					num_of_lines = h; // one for title
   157 					num_of_lines = h; // one for title
   153 					}	
   158 					}	
   154 		lines += num_of_lines;
   159 		lines += num_of_lines;
   155 	}
   160 	}
       
   161 	_AKNTRACE( "lines: [%d]", lines );
       
   162 	_AKNTRACE_FUNC_EXIT;
   156 	return lines;
   163 	return lines;
   157 
   164 
   158 }
   165 }
   159 
   166 
   160 TInt CEikCapCArray::FindItemFromTextLine(TInt aTextLine) const
   167 TInt CEikCapCArray::FindItemFromTextLine(TInt aTextLine) const
   193  *  Calculate the size of all the component controls stacked vertically.
   200  *  Calculate the size of all the component controls stacked vertically.
   194  *  For Avkon Forms the controls overlap by 2 pixels (hard coded)
   201  *  For Avkon Forms the controls overlap by 2 pixels (hard coded)
   195  */
   202  */
   196 EXPORT_C TSize CEikCapCArray::MinimumSize()
   203 EXPORT_C TSize CEikCapCArray::MinimumSize()
   197 	{
   204 	{
       
   205 	_AKNTRACE_FUNC_ENTER;
   198 	TSize size(0,0);
   206 	TSize size(0,0);
   199 
   207 
   200 	CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL;
   208 	CEikCaptionedControl *firstCapCC = Count() > 0 ? (*this)[0] : NULL;
   201 	if (firstCapCC && firstCapCC->iIsFormControl)
   209 	if (firstCapCC && firstCapCC->iIsFormControl)
   202 		{ // we're inside form
   210 		{ // we're inside form
   274 		{
   282 		{
   275 		size.iHeight+=( topMargin + bottomMargin ) ;
   283 		size.iHeight+=( topMargin + bottomMargin ) ;
   276 		size.iHeight+=2 ;  // (we have included one too many '-2's)
   284 		size.iHeight+=2 ;  // (we have included one too many '-2's)
   277 		}
   285 		}
   278 	}
   286 	}
       
   287     _AKNTRACE( "The Size : ( %d, %d ) ", size.iHeight, size.iWidth );
       
   288 	_AKNTRACE_FUNC_EXIT;
   279 	return size;
   289 	return size;
   280 	}
   290 	}
   281 
   291 
   282 
   292 
   283 /**
   293 /**
   634 * corrected. Usually, @a aTop and @a aBottom come out of sync with the item sizes
   644 * corrected. Usually, @a aTop and @a aBottom come out of sync with the item sizes
   635 * after the dynamic layout change.
   645 * after the dynamic layout change.
   636 */
   646 */
   637 void CEikCapCArray::SetRect(const TRect& aRect, TInt aTop, TInt /*aMiddle*/, TInt aBottom)
   647 void CEikCapCArray::SetRect(const TRect& aRect, TInt aTop, TInt /*aMiddle*/, TInt aBottom)
   638 	{
   648 	{
       
   649 	_AKNTRACE_FUNC_ENTER;
   639     TAknLayoutRect formtLayoutRect;
   650     TAknLayoutRect formtLayoutRect;
   640     formtLayoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::listscroll_form_pane().LayoutLine());
   651     formtLayoutRect.LayoutRect(aRect, AknLayoutScalable_Avkon::listscroll_form_pane().LayoutLine());
   641     formtLayoutRect.LayoutRect(formtLayoutRect.Rect(), AknLayoutScalable_Avkon::list_form_gen_pane().LayoutLine());
   652     formtLayoutRect.LayoutRect(formtLayoutRect.Rect(), AknLayoutScalable_Avkon::list_form_gen_pane().LayoutLine());
   642     TRect formRect = formtLayoutRect.Rect();
   653     TRect formRect = formtLayoutRect.Rect();
   643 	
   654 	
   653         CEikCaptionedControl* control = (*this)[0];
   664         CEikCaptionedControl* control = (*this)[0];
   654         
   665         
   655         if ( control->DialogPage()->IsForm() )
   666         if ( control->DialogPage()->IsForm() )
   656             {
   667             {
   657             SetRealRect( aRect, aTop, aBottom );
   668             SetRealRect( aRect, aTop, aBottom );
       
   669             _AKNTRACE_FUNC_EXIT;
   658             return;
   670             return;
   659             }
   671             }
   660         }
   672         }
   661         
   673         
   662 	TBool topDefined = EFalse;   // top or bottom number defined?
   674 	TBool topDefined = EFalse;   // top or bottom number defined?
   877     			rect.iTl.iY+=deltaHeight;
   889     			rect.iTl.iY+=deltaHeight;
   878     			deltaHeight=0;
   890     			deltaHeight=0;
   879     			}
   891     			}
   880     		}
   892     		}
   881 		}
   893 		}
       
   894 	_AKNTRACE_FUNC_EXIT;
   882 	}
   895 	}
   883 
   896 
   884 TInt CEikCapCArray::YPosToLine(const TRect &aRect, 
   897 TInt CEikCapCArray::YPosToLine(const TRect &aRect, 
   885 							   TInt aTop, TInt aMiddle, TInt aBottom, 
   898 							   TInt aTop, TInt aMiddle, TInt aBottom, 
   886 							   TInt aYCoord)
   899 							   TInt aYCoord)
   972 // CEikCapCArray::ScrollByPixels
   985 // CEikCapCArray::ScrollByPixels
   973 // ---------------------------------------------------------------------------
   986 // ---------------------------------------------------------------------------
   974 //
   987 //
   975 TInt CEikCapCArray::ScrollByPixels( TInt aDelta )
   988 TInt CEikCapCArray::ScrollByPixels( TInt aDelta )
   976     {
   989     {
       
   990 	_AKNTRACE_FUNC_ENTER;
   977     TInt count = Count();
   991     TInt count = Count();
   978     
   992     
   979     // Top and bottom of lines
   993     // Top and bottom of lines
   980     TInt topY = (*this)[0]->Rect().iTl.iY;
   994     TInt topY = (*this)[0]->Rect().iTl.iY;
   981     TInt bottomY = (*this)[count - 1]->Rect().iBr.iY;
   995     TInt bottomY = (*this)[count - 1]->Rect().iBr.iY;
  1017                 line->DrawDeferred();
  1031                 line->DrawDeferred();
  1018                 //line->DrawNow();
  1032                 //line->DrawNow();
  1019                 }
  1033                 }
  1020             }
  1034             }
  1021         }
  1035         }
  1022 
  1036     _AKNTRACE_FUNC_EXIT;
  1023     return aDelta;
  1037     return aDelta;
  1024     }
  1038     }
  1025 
  1039 
  1026 // ---------------------------------------------------------------------------
  1040 // ---------------------------------------------------------------------------
  1027 // CEikCapCArray::SetRealRect
  1041 // CEikCapCArray::SetRealRect
  1028 // ---------------------------------------------------------------------------
  1042 // ---------------------------------------------------------------------------
  1029 //
  1043 //
  1030 void CEikCapCArray::SetRealRect( 
  1044 void CEikCapCArray::SetRealRect( 
  1031 		const TRect& /*aRect*/, TInt /*aTop*/, TInt /*aBottom*/ )
  1045 		const TRect& /*aRect*/, TInt /*aTop*/, TInt /*aBottom*/ )
  1032     {
  1046     {
       
  1047 	_AKNTRACE_FUNC_ENTER;
  1033     TInt count = Count();
  1048     TInt count = Count();
  1034     const TPoint virtualTl( 1000, 0 );
  1049     const TPoint virtualTl( 1000, 0 );
  1035     TPoint skinLocation( 0, 0 );
  1050     TPoint skinLocation( 0, 0 );
  1036     CEikCaptionedControl* currentLine = (*this)[0]->DialogPage()->CurrentLine();
  1051     CEikCaptionedControl* currentLine = (*this)[0]->DialogPage()->CurrentLine();
  1037     
  1052     
  1054         AknsUtils::RegisterControlPosition( line->iCaption, skinLocation );
  1069         AknsUtils::RegisterControlPosition( line->iCaption, skinLocation );
  1055         AknsUtils::RegisterControlPosition( line->iControl, skinLocation );
  1070         AknsUtils::RegisterControlPosition( line->iControl, skinLocation );
  1056         AknsUtils::RegisterControlPosition( line->iTrailer, skinLocation );
  1071         AknsUtils::RegisterControlPosition( line->iTrailer, skinLocation );
  1057         AknsUtils::RegisterControlPosition( line->iBitmap, skinLocation );
  1072         AknsUtils::RegisterControlPosition( line->iBitmap, skinLocation );
  1058         }
  1073         }
       
  1074     _AKNTRACE_FUNC_EXIT;
  1059     }
  1075     }
  1060 
  1076 
  1061 
  1077 
  1062 // ---------------------------------------------------------------------------
  1078 // ---------------------------------------------------------------------------
  1063 // CEikCapCArray::YPositionToLineIndex
  1079 // CEikCapCArray::YPositionToLineIndex
  1107 // CEikCapCArray::MoveLineToScreen
  1123 // CEikCapCArray::MoveLineToScreen
  1108 // ---------------------------------------------------------------------------
  1124 // ---------------------------------------------------------------------------
  1109 //
  1125 //
  1110 void CEikCapCArray::MoveLineToScreen( TInt aLine, TInt aTopY, TBool aVisible )
  1126 void CEikCapCArray::MoveLineToScreen( TInt aLine, TInt aTopY, TBool aVisible )
  1111     {
  1127     {
       
  1128 	_AKNTRACE_FUNC_ENTER;
       
  1129 	_AKNTRACE( "aLine: [%d], aTopY: [%d], aVisible: [%d]", aLine, aTopY, aVisible );
  1112     if ( aLine != -1 && aLine < Count() )
  1130     if ( aLine != -1 && aLine < Count() )
  1113         {
  1131         {
  1114         CEikCaptionedControl* line = (*this)[aLine];
  1132         CEikCaptionedControl* line = (*this)[aLine];
  1115         TPoint topLeft( 1000, 0 );
  1133         TPoint topLeft( 1000, 0 );
  1116         
  1134         
  1119             topLeft.SetXY( Rect().iTl.iX, LineIndexToYPosition( aLine, aTopY ) );
  1137             topLeft.SetXY( Rect().iTl.iX, LineIndexToYPosition( aLine, aTopY ) );
  1120             }
  1138             }
  1121         
  1139         
  1122         line->SetRect( TRect( topLeft, line->Size() ) );
  1140         line->SetRect( TRect( topLeft, line->Size() ) );
  1123         }
  1141         }
       
  1142     _AKNTRACE_FUNC_EXIT;
  1124     }
  1143     }
  1125 
  1144 
  1126 
  1145 
  1127 // ---------------------------------------------------------------------------
  1146 // ---------------------------------------------------------------------------
  1128 // CEikCapCArray::FocusableLine
  1147 // CEikCapCArray::FocusableLine
  1129 // ---------------------------------------------------------------------------
  1148 // ---------------------------------------------------------------------------
  1130 //
  1149 //
  1131 TInt CEikCapCArray::FocusableLine( TInt aCurrentLine, TInt aTopY )
  1150 TInt CEikCapCArray::FocusableLine( TInt aCurrentLine, TInt aTopY )
  1132     {
  1151     {
       
  1152 	_AKNTRACE_FUNC_ENTER;
       
  1153 	_AKNTRACE( "aCurrentLine: [%d]", aCurrentLine );
  1133     TInt focusableLine = KErrNotFound;
  1154     TInt focusableLine = KErrNotFound;
  1134     
  1155     
  1135     if ( aCurrentLine >= 0 && aCurrentLine < Count() )
  1156     if ( aCurrentLine >= 0 && aCurrentLine < Count() )
  1136         {
  1157         {
  1137         TInt y = LineIndexToYPosition( aCurrentLine, aTopY );
  1158         TInt y = LineIndexToYPosition( aCurrentLine, aTopY );
  1155                 
  1176                 
  1156                 focusableLine = topLine;
  1177                 focusableLine = topLine;
  1157                 }
  1178                 }
  1158             }
  1179             }
  1159         }
  1180         }
  1160     
  1181     _AKNTRACE_FUNC_EXIT;
  1161     return focusableLine;
  1182     return focusableLine;
  1162     }
  1183     }
  1163 
  1184