--- a/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidatePane.cpp Wed Sep 15 12:34:44 2010 +0300
+++ b/fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/src/AknFepUiAvkonCtrlCandidatePane.cpp Wed Oct 13 14:55:58 2010 +0300
@@ -35,31 +35,24 @@
#include <AknBidiTextUtils.h>
#include <AknsUtils.h>
#include <AknIconUtils.h>
-#include <coecntrl.h>
+
#include <aknfepuictrls.mbg>
-#include <skinlayout.cdl.h>
-#include <aknlayoutscalable_avkon.cdl.h>
-
#include "AknFepUiInterfacePanic.h"
#include "AknFepUIAvkonCtrlCandidatePane.h"
+#include "AknFepUIAvkonCtrlCandidateSelected.h"
#include "aknfepchineseuidataconv.h"
#include "aknfepuilayoutdatamgr.h"
-#include "AknFepUiInputStateBase.h"
-#include "AknFepUIAvkonCtrlCandidateCharacter.h"
+
+
#include "data_caging_path_literals.hrh"
const TInt CandidateCountLeft = 10;
-const TInt DibertHeight = 480;
-const TInt ShowAboveCharacter = -1;
-const TInt ShowBellowCharacter = 1;
_LIT(KFepUiControlsBitmapFile, "aknfepuictrls.mbm");
-CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL( RWindow& aParent,
- CAknFepUiLayoutDataMgr* aLafDataMgr,
- MAknFepChineseUiMgr* aMgr )
+CAknFepUICtrlCandidatePane* CAknFepUICtrlCandidatePane::NewL(RWindow& aParent, CAknFepUiLayoutDataMgr* aLafDataMgr)
{
- CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr, aMgr );
+ CAknFepUICtrlCandidatePane* self = new(ELeave) CAknFepUICtrlCandidatePane( aLafDataMgr );
CleanupStack::PushL(self);
self->ConstructL(aParent);
CleanupStack::Pop();
@@ -68,14 +61,22 @@
CAknFepUICtrlCandidatePane::~CAknFepUICtrlCandidatePane()
{
- delete iCtrlScroll;
- delete iPreview;
+ delete iCandidateSelected;
+ delete iNaviArrowBitmapLeft;
+ delete iNaviArrowBitmapLeftMask;
+ delete iNaviArrowBitmapRight;
+ delete iNaviArrowBitmapRightMask;
+ delete iNaviArrowBitmapUp;
+ delete iNaviArrowBitmapUpMask;
+ delete iNaviArrowBitmapDown;
+ delete iNaviArrowBitmapDownMask;
if(iCandidateArray)
{
iCandidateArray->Reset();
delete iCandidateArray;
}
iCandidateLabelArray.ResetAndDestroy();
+ iOrdinalLabelArray.ResetAndDestroy();
iCandidateModeArray.Reset();
iPages.Reset();
}
@@ -98,7 +99,7 @@
// as far as the client is concerned, they have removed the character that was selected
// therefore we must now hide the selected candidate, although the highlighting
// state remains unchanged
- iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
+ iCandidateSelected->MakeVisible(EFalse);
}
else
{
@@ -107,7 +108,7 @@
// make sure that the candidate is visible, as the selection is now
// within a visible range (it might have been hidden last time
// the buffer was set)
- iCandidateLabelArray[iSelected]->SetHighlight( ETrue );
+ iCandidateSelected->MakeVisible(ETrue);
}
}
@@ -131,12 +132,27 @@
if(valueChanged)
{
// we have already allocated enough memory for this
- CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
- candidateLabel->SetText( newChar );
+ CEikLabel* candidateLabel = iCandidateLabelArray[i];
+ TRAP_IGNORE(candidateLabel->SetTextL(newChar));
+
+ // need to update the character if it is in the current selected candidate
+ if(i == iSelected)
+ {
+ iCandidateSelected->SetText(newChar);
+ iCandidateSelected->SetOrdinal(i + 1);
+ DrawDeferred();
+ }
+ if(i < iVisibleCount)
+ {
+ // only redraw characters that are visible
+ TRect rect = candidateLabel->Rect();
+ Window().Invalidate(rect);
+ }
}
}
ptr.Copy(newText);
LayoutLabels();
+ LayoutCandidateSelected();
iVisibleCount = newLength;
UpdateLabelVisibility();
}
@@ -158,13 +174,13 @@
if(iVisibleCount - 1 < iSelected)
{
- iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
+ iCandidateSelected->MakeVisible(EFalse);
}
else
{
if(iHighlighted)
{
- iCandidateLabelArray[iSelected]->SetHighlight( ETrue );
+ iCandidateSelected->MakeVisible(ETrue);
}
}
@@ -173,24 +189,32 @@
for(TInt i = 0; i < iVisibleCount; i ++)
{
- CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
+ CEikLabel* candidateLabel = iCandidateLabelArray[i];
const TDesC* txtLabel = candidateLabel->Text();
newText = (*iCandidateArray)[curPage.iStartIndex + i];
- if (( txtLabel->Compare(newText) != 0 ))
+ if((txtLabel->Compare(newText) != 0) )
{
// we have already allocated enough memory for this
- TRAP_IGNORE( candidateLabel->SetText( newText ));
+ TRAP_IGNORE( candidateLabel->SetTextL(newText));
}
-
- if ( i < iVisibleCount )
- {
- // only redraw labels that are visible
- TRect rect = candidateLabel->Rect();
- Window().Invalidate( rect );
+
+ // need to update the character if it is in the current selected candidate
+ if(i == iSelected)
+ {
+ iCandidateSelected->SetText(newText);
+ iCandidateSelected->SetOrdinal(i + 1);
+ DrawDeferred();
+ }
+ if(i < iVisibleCount)
+ {
+ // only redraw labels that are visible
+ TRect rect = candidateLabel->Rect();
+ Window().Invalidate(rect);
}
}
LayoutLabels();
+ LayoutCandidateSelected();
DrawDeferred();
UpdateLabelVisibility();
}
@@ -200,7 +224,9 @@
if(!COMPARE_BOOLS(iHighlighted, aHighlighted))
{
iHighlighted = aHighlighted;
- iCandidateLabelArray[iSelected]->SetHighlight( aHighlighted );
+ iCandidateSelected->MakeVisible(aHighlighted);
+
+ iCandidateSelected->DrawDeferred();
}
}
@@ -218,17 +244,21 @@
if(oldMode != aMode)
{
iCandidateModeArray[aIndex] = aMode;
-
+ if(iSelected == aIndex)
+ {
+ LayoutCandidateSelected();
+ }
// only do drawing if visible
if(aIndex < iVisibleCount)
{
LayoutLabel(aIndex);
if(iSelected == aIndex && iHighlighted)
{
+ iCandidateSelected->DrawDeferred();
}
else
{
- CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[aIndex];
+ CEikLabel* candidateLabel = iCandidateLabelArray[aIndex];
TRect rect = candidateLabel->Rect();
Window().Invalidate(rect);
}
@@ -248,41 +278,89 @@
void CAknFepUICtrlCandidatePane::ShowHorizontalScrollArrows(TBool /*aValue*/)
{
- // Left & right arrow are not need, so do nothing.
+ // If the state is changed, the arrows will be redrawn in the new state.
+ // if(!COMPARE_BOOLS(iShowHorizontalScrollArrows, aValue))
+ // {
+ // iShowHorizontalScrollArrows = aValue;
+ // TRect rect = iIndiFepArrowLeft.Rect();
+ // Window().Invalidate(rect);
+ // rect = iIndiFepArrowRight.Rect();
+ // Window().Invalidate(rect);
+ // }
}
void CAknFepUICtrlCandidatePane::ShowUpScrollArrows(TBool aValue)
{
- // call function of scroll pane to show/hide up arrow.
- iCtrlScroll->ShowUpScrollArrows( aValue );
+ if (iShowUpScrollArrows != aValue)
+ {
+ iShowUpScrollArrows = aValue;
+ TRect rect = iIndiFepArrowUp.Rect();
+ Window().Invalidate(rect);
+ }
}
void CAknFepUICtrlCandidatePane::ShowDownScrollArrows(TBool aValue)
{
- // call function of scroll pane to show/hide down arrow.
- iCtrlScroll->ShowDownScrollArrows( aValue );
+ if (iShowDownScrollArrows != aValue)
+ {
+ iShowDownScrollArrows = aValue;
+ TRect rect = iIndiFepArrowDown.Rect();
+ Window().Invalidate(rect);
+ }
+
}
void CAknFepUICtrlCandidatePane::ShowLeftScrollArrows(TBool /*aValue*/)
{
- // Left arrow is not need, so do nothing.
+ // if (iShowLeftScrollArrows != aValue)
+ // {
+ // iShowLeftScrollArrows = aValue;
+ // TRect rect = iIndiFepArrowLeft.Rect();
+ // Window().Invalidate(rect);
+ // }
}
void CAknFepUICtrlCandidatePane::ShowRightScrollArrows(TBool /*aValue*/)
{
- // Right arrow is not need, so do nothing.
+ // if (iShowRightScrollArrows != aValue)
+ // {
+ // iShowRightScrollArrows = aValue;
+ // TRect rect = iIndiFepArrowRight.Rect();
+ // Window().Invalidate(rect);
+ // }
}
TBool CAknFepUICtrlCandidatePane::IsShowVerticalScrollArrows() const
{
- // call function of scroll pane to get scroll state
- return iCtrlScroll->IsShowVerticalScrollArrows();
+ return iShowVerticalScrollArrows;
}
void CAknFepUICtrlCandidatePane::ShowVerticalScrollArrows(TBool aValue)
{
- // call function of scroll pane to set scroll state
- iCtrlScroll->ShowVerticalScrollArrows( aValue );
+ // If the state is changed, the arrows will be redrawn in the new state.
+ if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue))
+ {
+ iShowVerticalScrollArrows = aValue;
+ TRect rect = iIndiFepArrowUp.Rect();
+ Window().Invalidate(rect);
+ rect = iIndiFepArrowDown.Rect();
+ Window().Invalidate(rect);
+ }
+ }
+
+void CAknFepUICtrlCandidatePane::ShowCandidateOrdinals(TBool aValue)
+ {
+ if(!COMPARE_BOOLS(iShowCandidateOrdinals, aValue))
+ {
+ iShowCandidateOrdinals = aValue;
+ iCandidateSelected->ShowOrdinal(aValue);
+ UpdateLabelVisibility();
+ }
+ }
+
+TBool CAknFepUICtrlCandidatePane::IsShowCandidateOrdinals() const
+ {
+ return iShowCandidateOrdinals;
}
TInt CAknFepUICtrlCandidatePane::VisibleCandidateCount() const
@@ -363,10 +441,6 @@
{
return SelectIndex(iSelected + 1);
}
- else if( iSelected == iVisibleCount - 1 )
- {
- return SelectIndex(0);
- }
else
{
return EFalse;
@@ -379,35 +453,41 @@
{
return SelectIndex(iSelected - 1);
}
- else if( iSelected == 0 )
- {
- return SelectIndex( iVisibleCount - 1 );
- }
else
{
return EFalse;
}
}
-TBool CAknFepUICtrlCandidatePane::SelectIndex(TInt aIndex, TBool /*selected*/ )
+TBool CAknFepUICtrlCandidatePane::SelectIndex(TInt aIndex, TBool selected)
{
- if( aIndex + 1 > iVisibleCount || aIndex < 0 )
+ if(aIndex + 1 > iVisibleCount || aIndex < 0)
{
return EFalse;
}
+ if(iSelected != aIndex)
+ {
+ if(iSelected + 1 > iVisibleCount && iHighlighted)
+ {
+ // candidate selection is currently hidden, as the current
+ // selection is outside the range of valid candidates, therefore
+ // show it again
+ iCandidateSelected->MakeVisible(ETrue);
+ }
+ iSelected = aIndex;
+ // move and repopulate the selected candidate control
+ const TDesC* txtLabel = iCandidateLabelArray[aIndex]->Text();
+ iCandidateSelected->SetText(*txtLabel);
+ iCandidateSelected->SetOrdinal(iSelected + 1);
+
+ LayoutCandidateSelected();
+ if( selected )
+ {
- if ( iSelected != aIndex )
- {
- iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
- }
-
- if ( iPointDown || iHighlighted )
- {
- iCandidateLabelArray[aIndex]->SetHighlight( ETrue );
-
- }
- iSelected = aIndex;
-
+ DrawDeferred();
+ }
+
+ }
return ETrue;
}
@@ -446,7 +526,7 @@
{
TAknLayoutText layoutText;
TAknTextLineLayout candidatePaneLayoutText =
- CAknFepChineseUIDataConv::AnyToTextLine(iLafDataMgr->RequestData( ECharacterTextLayout ));
+ CAknFepChineseUIDataConv::AnyToTextLine(iLafDataMgr->RequestData( ECandidatePaneTextLine ));
layoutText.LayoutText(Rect(), candidatePaneLayoutText);
@@ -509,7 +589,6 @@
// the previous page of the last page. And then select the last character of
// the previous page of the last page, and select next page. First of the last
// page is not refreshed.
- iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
iSelected = 0;
}
@@ -527,6 +606,7 @@
void CAknFepUICtrlCandidatePane::SizeChanged()
{
+ LayoutRects();
LayoutContainedControls();
}
@@ -534,11 +614,11 @@
{
TInt count = 0;
count += iCandidateLabelArray.Count();
+ count += iOrdinalLabelArray.Count();
CCoeControl* controls[] =
{
- iCtrlScroll,
- iPreview
+ iCandidateSelected
} ;
for (TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
@@ -554,21 +634,29 @@
CCoeControl* CAknFepUICtrlCandidatePane::ComponentControl(TInt aIndex) const
{
TInt candidateCount = iCandidateLabelArray.Count();
+ TInt ordinalCount = iOrdinalLabelArray.Count();
if(aIndex < candidateCount)
{
// because this method is const, the const [] operator is selected
// which means that the pointer is const, so have to cast away constness
// - a possible alternative is to make the array mutable?
- return CONST_CAST(CAknFepUICtrlCandidateCharacter*, iCandidateLabelArray[aIndex]);
+ return CONST_CAST(CEikLabel*, iCandidateLabelArray[aIndex]);
}
aIndex -= candidateCount;
+ if(aIndex < ordinalCount)
+ {
+ // because this method is const, the const [] operator is selected
+ // which means that the pointer is const, so have to cast away constness
+ // - a possible alternative is to make the array mutable?
+ return CONST_CAST(CEikLabel*, iOrdinalLabelArray[aIndex]);
+ }
+ aIndex -= ordinalCount;
+
CCoeControl* controls[] =
{
- // iCandidateSelected,
- iCtrlScroll,
- iPreview
+ iCandidateSelected
} ;
for (TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)) ; ii++)
@@ -582,48 +670,182 @@
return NULL ;
}
+void CAknFepUICtrlCandidatePane::Draw(const TRect& /* aRect */) const
+ {
+ CWindowGc& gc = SystemGc();
+
+ if(iShowHorizontalScrollArrows)
+ {
+ if (iShowLeftScrollArrows)
+ {
+ iIndiFepArrowLeft.DrawImage(gc,
+ iNaviArrowBitmapLeft,
+ iNaviArrowBitmapLeftMask);
+ }
+
+ if (iShowRightScrollArrows)
+ {
+ iIndiFepArrowRight.DrawImage(gc,
+ iNaviArrowBitmapRight,
+ iNaviArrowBitmapRightMask);
+ }
+ }
+ if(iShowVerticalScrollArrows)
+ {
+ if (iShowUpScrollArrows)
+ {
+ iIndiFepArrowUp.DrawImage(gc,
+ iNaviArrowBitmapUp,
+ iNaviArrowBitmapUpMask);
+ }
+
+ if (iShowDownScrollArrows)
+ {
+ iIndiFepArrowDown.DrawImage(gc,
+ iNaviArrowBitmapDown,
+ iNaviArrowBitmapDownMask);
+ }
+ }
+ }
+
void CAknFepUICtrlCandidatePane::ConstructL(RWindow& aParent)
{
SetContainerWindowL(aParent);
+ ConstructBitmapsL();
TBuf<EOneCandidate> ordinal;
for(TInt i = 0; i < EMaxCandidates; i++)
{
- CAknFepUICtrlCandidateCharacter* candidateLabel = CAknFepUICtrlCandidateCharacter::NewL( aParent, this );
+ CEikLabel* candidateLabel = new(ELeave) CEikLabel;
CleanupStack::PushL(candidateLabel);
candidateLabel->SetContainerWindowL(aParent);
+ candidateLabel->SetBufferReserveLengthL(EPhraseLength);
// ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack
User::LeaveIfError(iCandidateLabelArray.Append(candidateLabel));
CleanupStack::Pop(); // candidateLabel
+ CEikLabel* ordinalLabel = new(ELeave) CEikLabel;
+ CleanupStack::PushL(ordinalLabel);
+ ordinalLabel->SetContainerWindowL(aParent);
+ ordinalLabel->SetBufferReserveLengthL(EOneCandidate);
+ ordinal.Num((i+1)%10); // digits are [1, 2,,, 9, 0] - only want the last digit in the case of 10!
+ ordinalLabel->SetTextL(ordinal);
+ // ownership is passed, unless allocation is unsuccessful, in which case we still have it on the stack
+ User::LeaveIfError(iOrdinalLabelArray.Append(ordinalLabel));
+ CleanupStack::Pop(); // ordinalLabel
+
User::LeaveIfError(iCandidateModeArray.Append(ECandidateModeNormal));
}
+ iCandidateSelected = CAknFepUICtrlCandidateSelected::NewL(aParent);
+ iCandidateSelected->MakeVisible(iHighlighted);
+ iCandidateSelected->SetMopParent(this);
iCandidateArray = new(ELeave) CDesCArrayFlat(1);
-
- // scroll part
- iCtrlScroll = CAknFepUICtrlCandidateScroll::NewL( aParent, this );
- iCtrlScroll->SetMopParent(this);
-
- // character preview
- iPreview = CAknFepPreview::NewL( aParent );
}
-CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr, MAknFepChineseUiMgr* aMgr )
+void CAknFepUICtrlCandidatePane::ConstructBitmapsL()
+ {
+ MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+ TFileName bmpFile;
+ bmpFile.Copy(_L("z:"));
+ bmpFile.Append(KDC_BITMAP_DIR);
+ bmpFile.Append(KFepUiControlsBitmapFile);
+
+ AknsUtils::CreateColorIconL( skin,
+ KAknsIIDQgnIndiFepArrowLeft,
+ KAknsIIDQsnIconColors,
+ EAknsCIQsnIconColorsCG20,
+ iNaviArrowBitmapLeft,
+ iNaviArrowBitmapLeftMask,
+ bmpFile,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_left,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_left_mask,
+ AKN_LAF_COLOR( 0 )
+ );
+ AknsUtils::CreateColorIconL( skin,
+ KAknsIIDQgnIndiFepArrowRight,
+ KAknsIIDQsnIconColors,
+ EAknsCIQsnIconColorsCG20,
+ iNaviArrowBitmapRight,
+ iNaviArrowBitmapRightMask,
+ bmpFile,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_right,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_right_mask,
+ AKN_LAF_COLOR( 0 )
+ );
+
+ AknsUtils::CreateColorIconL( skin,
+ KAknsIIDQgnIndiFepArrowUp,
+ KAknsIIDQsnIconColors,
+ EAknsCIQsnIconColorsCG20,
+ iNaviArrowBitmapUp,
+ iNaviArrowBitmapUpMask,
+ bmpFile,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_up,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask,
+ AKN_LAF_COLOR( 0 )
+ );
+ AknsUtils::CreateColorIconL( skin,
+ KAknsIIDQgnIndiFepArrowDown,
+ KAknsIIDQsnIconColors,
+ EAknsCIQsnIconColorsCG20,
+ iNaviArrowBitmapDown,
+ iNaviArrowBitmapDownMask,
+ bmpFile,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_down,
+ EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask,
+ AKN_LAF_COLOR( 0 )
+ );
+ }
+
+CAknFepUICtrlCandidatePane::CAknFepUICtrlCandidatePane(CAknFepUiLayoutDataMgr* aLafDataMgr)
:
iPaneLayout(CAknFepUICtrlContainerChinese::ELayoutCandidate),
iHighlighted(EFalse),
+ iShowHorizontalScrollArrows(EFalse),
+ iShowVerticalScrollArrows(EFalse),
+ iShowUpScrollArrows(ETrue),
+ iShowDownScrollArrows(ETrue),
+ iShowLeftScrollArrows(ETrue),
+ iShowRightScrollArrows(ETrue),
+ iShowCandidateOrdinals(ETrue),
iCurDisplayPage(0),
- iChineseUiMgr(aMgr),
- iPointDown( EFalse )
+ iOrdinalLableWidth(0)
{
iLafDataMgr = aLafDataMgr;
}
+void CAknFepUICtrlCandidatePane::LayoutRects()
+ {
+ TRect rect = Rect();
+
+ TAknWindowLineLayout candidateWindowLine1 =
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine1));
+ TAknWindowLineLayout candidateWindowLine2 =
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine2));
+ TAknWindowLineLayout candidateWindowLine3 =
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine3));
+ TAknWindowLineLayout candidateWindowLine4 =
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECandidateWindowLine4));
+
+ iIndiFepArrowLeft.LayoutRect(rect, candidateWindowLine1);
+ AknIconUtils::SetSize(iNaviArrowBitmapLeft, iIndiFepArrowLeft.Rect().Size());
+
+ iIndiFepArrowRight.LayoutRect(rect, candidateWindowLine2);
+ AknIconUtils::SetSize(iNaviArrowBitmapRight, iIndiFepArrowRight.Rect().Size());
+
+ iIndiFepArrowUp.LayoutRect(rect, candidateWindowLine3);
+ AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size());
+
+ iIndiFepArrowDown.LayoutRect(rect, candidateWindowLine4);
+ AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size() );
+ }
+
void CAknFepUICtrlCandidatePane::LayoutContainedControls()
{
LayoutLabels();
- LayoutScroll();
+ LayoutCandidateSelected();
}
void CAknFepUICtrlCandidatePane::LayoutLabel(TInt aIndex)
@@ -631,43 +853,80 @@
__ASSERT_DEBUG(aIndex >= 0, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount));
__ASSERT_DEBUG(aIndex < iVisibleCount, AknFepUiInterfacePanic(EAknFepUiInterfacePanicAttemptedLayoutOutsideVisibleCount));
TRect rect = Rect();
- CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[aIndex];
+ CEikLabel* candidateLabel = iCandidateLabelArray[aIndex];
+ CEikLabel* ordinalLabel = iOrdinalLabelArray[aIndex];
TAknWindowLineLayout layoutCandidateItem =
- CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECharacterLayout));
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem));
TAknTextLineLayout candidateLayout =
- CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECharacterTextLayout));
+ CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine));
// layout candidate label
TAknLayoutRect layoutRectCandidateItem;
- layoutRectCandidateItem.LayoutRect( rect,layoutCandidateItem );
+ layoutRectCandidateItem.LayoutRect(rect,layoutCandidateItem);
TRect rectCandidateItem = layoutRectCandidateItem.Rect();
- if ( aIndex > 0 )
+
+ if(aIndex > 0)
{
rectCandidateItem.iTl.iX = iCandidateLabelArray[aIndex - 1]->Rect().iBr.iX;
}
+ TAknLayoutText layoutText;
+ layoutText.LayoutText(rectCandidateItem,candidateLayout);
+ TRect rectText = layoutText.TextRect();
+ rectText.SetWidth(LabelTextWidthInPixels(aIndex));
- TAknLayoutText layoutText;
- layoutText.LayoutText( rectCandidateItem, candidateLayout );
- TInt interval = candidateLayout.il + candidateLayout.ir;
+ candidateLabel->SetRect(rectText);
+ candidateLabel->SetFont(layoutText.Font());
- TInt width = LabelTextWidthInPixels( aIndex );
- TInt minwidth = layoutRectCandidateItem.Rect().Width() - interval ;
- if ( width < minwidth )
- {
- width = minwidth;
- }
- rectCandidateItem.SetWidth( width + interval );
- candidateLabel->SetRect( rectCandidateItem );
+ // layout ordinal label
+ TAknTextLineLayout ordinalLayout =
+ CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout));
+ TBufC16<1> buf;
+ TAknLayoutText layoutOrdinal;
+ TPtr16 ptr = buf.Des();
+ ptr = (*(ordinalLabel->Text())).Left(EOneCandidate);
+
+ layoutOrdinal.LayoutText(rectCandidateItem,ordinalLayout);
+
+ const CFont* font = layoutOrdinal.Font();
+
+ TRect rectOrdinal = layoutOrdinal.TextRect();
+ // align ordinal label and candidate label
+
+ /* removed in 2006.03.29
+ rectOrdinal.iTl.iY = rectText.iTl.iY;
+ rectOrdinal.SetWidth(font->TextWidthInPixels(ptr));
+ rectOrdinal.SetHeight(font->HeightInPixels());
+ */
+
+ // inserted in 2006.03.29
+ TPoint ordinalPosition;
+ TInt ordinalWidth = font->TextWidthInPixels(ptr);
+ ordinalPosition.iX = rectText.iTl.iX - ordinalWidth;
+ ordinalPosition.iY = rectText.iTl.iY;
+
+ rectOrdinal = TRect(ordinalPosition,
+ TPoint(ordinalPosition.iX + rectOrdinal.Width(),
+ ordinalPosition.iY + rectOrdinal.Height()));
+ // end inserting
+
+ ordinalLabel->SetRect(rectOrdinal);
+ ordinalLabel->SetFont(font);
+ iOrdinalLableWidth = rectOrdinal.Width();
// override colours if skin data present
MAknsSkinInstance* skin = AknsUtils::SkinInstance();
TRgb candidateLabelTextColor = layoutText.Color();
+ TRgb ordinalLabelTextColor = layoutOrdinal.Color();
AknsUtils::GetCachedColor(skin, candidateLabelTextColor,
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19);
+ AknsUtils::GetCachedColor(skin, ordinalLabelTextColor,
+ KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG19);
+
TRAP_IGNORE(
candidateLabel->OverrideColorL(EColorLabelText, candidateLabelTextColor);
+ ordinalLabel->OverrideColorL(EColorLabelText, ordinalLabelTextColor);
);
}
@@ -678,10 +937,32 @@
LayoutLabel(i);
}
}
-void CAknFepUICtrlCandidatePane::LayoutScroll()
+
+void CAknFepUICtrlCandidatePane::LayoutCandidateSelected()
{
- TAknWindowLineLayout scrolllayout = CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(EScrollLayout));
- AknLayoutUtils::LayoutControl( iCtrlScroll, Rect(), scrolllayout );
+ TCandidateMode candidateMode = iCandidateModeArray[iSelected];
+ iCandidateSelected->SetCandidateMode(candidateMode);
+ iCandidateSelected->SetLayout(iPaneLayout);
+
+ TRect ordinalRect = iOrdinalLabelArray[iSelected]->Rect();
+
+ TAknLayoutRect layoutRect;
+ TAknWindowLineLayout layoutCandidateItem =
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem));
+ layoutRect.LayoutRect(Rect(),layoutCandidateItem);
+
+ TRect rectLayoutCandidateItem = layoutRect.Rect();
+ rectLayoutCandidateItem.iTl.iX = ordinalRect.iTl.iX;
+
+ TAknTextLineLayout candidateLayout =
+ CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine));
+ TAknTextLineLayout ordinalLayout =
+ CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(EOrdinalCandidateTextLayout));
+ rectLayoutCandidateItem.SetWidth(iCandidateLabelArray[iSelected]->Rect().Width() + candidateLayout.il - ordinalLayout.il);
+
+ rectLayoutCandidateItem.SetHeight(rectLayoutCandidateItem.Height() - 1);
+
+ iCandidateSelected->SetRect(rectLayoutCandidateItem);
}
void CAknFepUICtrlCandidatePane::UpdateLabelVisibility()
@@ -703,14 +984,17 @@
}
for(TInt i = 0; i < EMaxCandidates; i++)
{
- CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
+ CEikLabel* candidateLabel = iCandidateLabelArray[i];
+ CEikLabel* ordinalLabel = iOrdinalLabelArray[i];
if(i < number)
{
candidateLabel->MakeVisible(ETrue);
+ ordinalLabel->MakeVisible(iShowCandidateOrdinals); // only show if needed
}
else
{
candidateLabel->MakeVisible(EFalse);
+ ordinalLabel->MakeVisible(EFalse); // don't show it as there is no character to go with it
}
}
}
@@ -743,7 +1027,7 @@
TPage curPage;
TInt index = iUnpagedIndex;
- CAknFepUICtrlCandidateCharacter* candidateLabel;
+ CEikLabel* candidateLabel;
curPage.iStartIndex = index;
curPage.iEndIndex = index;
@@ -751,24 +1035,23 @@
EMaxCandidates : phraseCandidateNum - index;
TAknWindowLineLayout layoutCandidateItem =
- CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ECharacterLayout));
- TAknWindowLineLayout candidateRect =
- CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(EScrollLayout));
+ CAknFepChineseUIDataConv::AnyToWindowLine( iLafDataMgr->RequestData(ELayoutCandidateItem));
+ TAknTextLineLayout candidateLayout =
+ CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECandidatePaneTextLine));
- TAknTextLineLayout candidateLayout =
- CAknFepChineseUIDataConv::AnyToTextLine( iLafDataMgr->RequestData(ECharacterTextLayout));
-
- TInt interval = candidateLayout.il + candidateLayout.ir;
// avoid accessing layout data member
TAknLayoutRect layoutRect;
layoutRect.LayoutRect(Rect(),layoutCandidateItem);
TRect rectLayoutCandidateItem = layoutRect.Rect();
+
TAknLayoutText layoutText;
layoutText.LayoutText(rectLayoutCandidateItem,candidateLayout);
- TRect rectText = Rect();
- TInt distance = rectText.iTl.iX - rectLayoutCandidateItem.iTl.iX + rectText.iBr.iX - rectLayoutCandidateItem.iBr.iX;
- rectLayoutCandidateItem.iBr.iX += distance - candidateRect.iW;
+ TRect rectText = layoutText.TextRect();
+
+ TInt distance = rectText.iTl.iX - rectLayoutCandidateItem.iTl.iX + rectLayoutCandidateItem.iBr.iX - rectText.iBr.iX;
+ rectLayoutCandidateItem.iTl.iX += distance;
+ TInt width = 0;
TInt i = 0;
const TInt candidateWidth = rectLayoutCandidateItem.Width();
@@ -780,7 +1063,6 @@
const CFont* font = layoutText.Font();
TPtrC newText = (*iCandidateArray)[iUnpagedIndex + i];
TInt labelWidth = font->TextWidthInPixels( newText );
- labelWidth = interval + ( labelWidth > layoutText.TextRect().Width() ? labelWidth : layoutText.TextRect().Width());
if ( labelWidth > candidateWidth )
{
TBufC<EPhraseLength+10> buf1;
@@ -794,16 +1076,17 @@
TRAP_IGNORE(
{
iCandidateArray->InsertL( iUnpagedIndex + i, text );
- candidateLabel->SetText(text);
+ candidateLabel->SetTextL(text);
});
}
else
{
- TRAP_IGNORE( candidateLabel->SetText(newText));
- rectLayoutCandidateItem.iTl.iX += labelWidth;
+ TRAP_IGNORE( candidateLabel->SetTextL(newText));
+ width = LabelTextWidthInPixels(i)+ iOrdinalLableWidth;
+ rectLayoutCandidateItem.iTl.iX += width;
}
- if (rectLayoutCandidateItem.iTl.iX > rectLayoutCandidateItem.iBr.iX)
+ if (rectLayoutCandidateItem.iTl.iX >= rectLayoutCandidateItem.iBr.iX)
{
if (index>0)
{
@@ -847,11 +1130,7 @@
TBool CAknFepUICtrlCandidatePane::IsLastPage()
{
- if( iPages.Count() == 0 )
- {
- return ETrue;
- }
- else if( iCandidateArray->Count() == iUnpagedIndex )
+ if( iCandidateArray->Count() == iUnpagedIndex )
{
return iCurDisplayPage == iPages.Count() - 1;
}
@@ -860,13 +1139,14 @@
void CAknFepUICtrlCandidatePane::SetInVisiable()
{
- iCandidateLabelArray[iSelected]->SetHighlight( EFalse );
- TRAP_IGNORE( iPreview->HideL());
for (TInt i = 0; i < EMaxCandidates; i ++)
{
- CAknFepUICtrlCandidateCharacter* candidateLabel = iCandidateLabelArray[i];
+ CEikLabel* candidateLabel = iCandidateLabelArray[i];
+ CEikLabel* ordinalLabel = iOrdinalLabelArray[i];
candidateLabel->MakeVisible(EFalse);
+ ordinalLabel->MakeVisible(EFalse);
}
+ iCandidateSelected->MakeVisible(EFalse);
}
TBool CAknFepUICtrlCandidatePane::NeedGetNewCandidatePage()
@@ -881,515 +1161,11 @@
{
for (TInt i=0; i<iVisibleCount; i++)
{
- iCandidateLabelArray[i]->SetText( KNullDesC );
+ TRAP_IGNORE(iCandidateLabelArray[i]->SetTextL(KNullDesC));
}
- TRAP_IGNORE( HidePreviewL();)
iCandidateArray->Reset();
iVisibleCount = 0;
DrawNow();
}
}
-
-void CAknFepUICtrlCandidatePane::FepUIClosePressed()
- {
- // Click close to close container
- if ( iChineseUiMgr )
- {
- iChineseUiMgr->CloseContainer();
- }
- }
-
-void CAknFepUICtrlCandidatePane::SetFepUiState( MAknFepUiStateCtrl* aFepUiState )
- {
- iFepUiState = aFepUiState;
- }
-
-void CAknFepUICtrlCandidatePane::HidePreviewL()
- {
- if( iPreview && iPreview->IsVisible())
- {
- iPreview->HideL();
- }
- }
-void CAknFepUICtrlCandidatePane::HandlePointerEventL( const TPointerEvent & aPointerEvent )
- {
- CCoeControl::HandlePointerEventL( aPointerEvent );
- // Press will pop up preview
- if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
- {
- for ( TInt i = 0; i < iVisibleCount; i++ )
- {
- if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition ))
- {
- iPointDown = ETrue;
- SelectIndex( i );
- const TDesC* txtLabel = iCandidateLabelArray[i]->Text();
- TPoint point = iCandidateLabelArray[i]->PositionRelativeToScreen();
- TRect rect( point, iCandidateLabelArray[i]->Size());
- // if container is show on top, the preview should show bellow the character
- // else the preview should show above the character.
- TInt bottom = ShowAboveCharacter;
- if ( point.iY < iCandidateLabelArray[i]->Rect().iBr.iY )
- {
- bottom = ShowBellowCharacter;
- }
- rect.Move( 0, (iCandidateLabelArray[i]->Size().iHeight ) * bottom );
- iPreview->ShowL( rect, *txtLabel );
- break;
- }
- }
- }
- // Up will submit text
- else if ( aPointerEvent.iType == TPointerEvent::EButton1Up && iPointDown )
- {
- iPointDown = EFalse;
- for ( TInt i = 0; i < iVisibleCount; i++ )
- {
- if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition ))
- {
- if ( iChineseUiMgr )
- {
- const TDesC* text = iCandidateLabelArray[i]->Text();
- iChineseUiMgr->SubmitSelectedTextL( *text );
- }
- break;
- }
- }
- if( iPreview->IsVisible())
- {
- iPreview->HideL();
- }
-
- if( !iHighlighted )
- {
- iCandidateLabelArray[iSelected]->SetHighlight( iHighlighted );
- }
- }
- // Drag out of candidate pane, hide preview
- else if ( aPointerEvent.iType == TPointerEvent::EDrag && iPointDown )
- {
- TBool bContain = EFalse;
- for ( TInt i = 0; ( !bContain ) && ( i < iVisibleCount ); i++ )
- {
- if ( iCandidateLabelArray[i]->Rect().Contains( aPointerEvent.iPosition ))
- {
- TBool bSameIndex = ( i == iSelected );
- SelectIndex( i );
- if ( !bSameIndex )
- {
- const TDesC* txtLabel = iCandidateLabelArray[i]->Text();
- TPoint point = iCandidateLabelArray[i]->PositionRelativeToScreen();
- TRect rect( point, iCandidateLabelArray[i]->Size());
- TInt bottom = ShowAboveCharacter;
- // If container is moved to top,
- // then pop up preview below the character
- if ( point.iY < iCandidateLabelArray[i]->Rect().iBr.iY )
- {
- bottom = ShowBellowCharacter;
- }
- rect.Move( 0, (iCandidateLabelArray[i]->Size().iHeight ) * bottom );
- iPreview->ShowL( rect, *txtLabel );
- }
- bContain = ETrue;
- break;
- }
- }
- if ( !bContain )
- {
- iPreview->HideL();
- iCandidateLabelArray[iSelected]->SetHighlight( iHighlighted );
- if( !iHighlighted )
- {
- iSelected = 0;
- }
- }
- else if( bContain && !iPreview->IsVisible())
- {
- const TDesC* txtLabel = iCandidateLabelArray[iSelected]->Text();
- TPoint point = iCandidateLabelArray[iSelected]->PositionRelativeToScreen();
- TRect rect( point, iCandidateLabelArray[iSelected]->Size());
- TInt bottom = ShowAboveCharacter;
- // If container is moved to top,
- // then pop up preview below the character
- if ( point.iY < iCandidateLabelArray[iSelected]->Rect().iBr.iY )
- {
- bottom = ShowBellowCharacter;
- }
- rect.Move( 0, (iCandidateLabelArray[iSelected]->Size().iHeight ) * bottom );
- iPreview->ShowL( rect, *txtLabel );
- }
- }
- else
- {
- // do nothing
- }
- }
-
-CAknFepPreview* CAknFepPreview::NewL( RWindowTreeNode& aParent )
- {
- CAknFepPreview* self = new(ELeave) CAknFepPreview;
- CleanupStack::PushL(self);
- self->ConstructL( aParent );
- CleanupStack::Pop();
- return self;
- }
-
-CAknFepPreview::~CAknFepPreview()
- {
- delete iPreviewLabel;
- }
-
-void CAknFepPreview::Draw( const TRect& /*aRect*/ ) const
- {
- CWindowGc& gc = SystemGc();
-
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
- TRect outerRect;
- TRect innerRect;
- CalculateFrameRects( outerRect, innerRect );
- gc.SetBrushColor( KRgbGray );
- // draw the whole frame background according to the containing context, which in this case
- // is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre
- MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
- AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
- KAknsIIDQsnFrInputCharPreview, KAknsIIDDefault );
- }
-
-void CAknFepPreview::SizeChanged()
- {
- TRect rect = Rect();
- TAknTextLineLayout candidateLayout = AknLayoutScalable_Avkon::cell_hyb_candi_pane_t1(0);
- // Get preview rect and font.
- TAknLayoutText layoutText;
- layoutText.LayoutText( rect, candidateLayout );
- TRect rectText = layoutText.TextRect();
- const CFont* font = layoutText.Font();
-
- iPreviewLabel->SetRect( rectText );
- iPreviewLabel->SetFont( font );
- // override with skin text color
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-
- TRgb labelTextColor;
- AknsUtils::GetCachedColor( skin, labelTextColor,
- KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
-
- TRAP_IGNORE(
- iPreviewLabel->OverrideColorL(EColorLabelText, labelTextColor); )
- }
-
-void CAknFepPreview::ShowL( TRect& aRect, const TDesC& aCharacter )
- {
- SetRect( aRect );
-
- iPreviewLabel->SetTextL( aCharacter );
- MakeVisible( ETrue );
- RWindow& window = Window();
- window.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 100 );
- DrawNow();
- }
-
-void CAknFepPreview::HideL()
- {
- MakeVisible( EFalse );
- iPreviewLabel->SetTextL( KNullDesC );
- DrawNow();
- }
-
-TInt CAknFepPreview::CountComponentControls() const
- {
- CCoeControl* controls[] =
- {
- iPreviewLabel
- };
- TInt count = 0;
- for ( TUint ii = 0 ; ii < (sizeof(controls) / sizeof(CCoeControl*)); ii++ )
- {
- if ( controls[ii] )
- {
- count++;
- }
- }
-
- return count ;
- }
-
-CCoeControl* CAknFepPreview::ComponentControl(TInt aIndex) const
- {
- CCoeControl* controls[] =
- {
- iPreviewLabel
- };
-
- for ( TUint ii = 0; (ii < sizeof(controls) / sizeof(CCoeControl*)); ii++ )
- {
- if ( controls[ii] && aIndex-- == 0 )
- {
- return controls[ii];
- }
- }
- // shouldn't be called while no components.
- return NULL ;
- }
-
-CAknFepPreview::CAknFepPreview()
- {
- }
-
-void CAknFepPreview::ConstructL( RWindowTreeNode& /*aParent */)
- {
- RWindowGroup& wg = CCoeEnv::Static()->RootWin();
- CreateWindowL( wg );
- RWindow& window = Window();
- iPreviewLabel = new( ELeave ) CEikLabel;
- iPreviewLabel->SetContainerWindowL( window );
- iPreviewLabel->SetLabelAlignment( ELayoutAlignCenter );
- iPreviewLabel->SetMopParent( this );
- window.SetRequiredDisplayMode( EColor16MA );
- window.SetTransparencyAlphaChannel();
- window.SetOrdinalPosition( 0, ECoeWinPriorityAlwaysAtFront + 100 );
- window.SetFaded( EFalse, RWindowTreeNode::EFadeIncludeChildren );
- // Enable receive drag event.
- Window().PointerFilter( EPointerFilterDrag, 0 );
- MakeVisible( EFalse );
- ActivateL();
- }
-
-void CAknFepPreview::CalculateFrameRects(TRect& aOuterRect, TRect& aInnerRect) const
- {
- TRect windowRect = Rect();
-
- TAknLayoutRect topLeft;
- topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2());
-
- TAknLayoutRect bottomRight;
- bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5());
-
- aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
- aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
- }
-
-CAknFepUICtrlCandidateScroll* CAknFepUICtrlCandidateScroll::NewL(
- RWindowTreeNode& aParent, MAknFepUIEventObserver* aObserver )
- {
- CAknFepUICtrlCandidateScroll* self = new(ELeave) CAknFepUICtrlCandidateScroll;
- CleanupStack::PushL(self);
- self->ConstructL( aParent, aObserver );
- CleanupStack::Pop();
- return self;
- }
-
-CAknFepUICtrlCandidateScroll::~CAknFepUICtrlCandidateScroll()
- {
- // delete bitmaps
- delete iScrollCloseBitmap;
- delete iScrollCloseBitmapMask;
- delete iNaviArrowBitmapUp;
- delete iNaviArrowBitmapUpMask;
- delete iNaviArrowBitmapDown;
- delete iNaviArrowBitmapDownMask;
- }
-
-void CAknFepUICtrlCandidateScroll::SizeChanged()
- {
- LayoutIcon();
- }
-
-void CAknFepUICtrlCandidateScroll::Draw( const TRect& /*aRect*/ ) const
- {
- CWindowGc& gc = SystemGc();
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-
- // draw the whole frame background according to the containing context, which in this case
- // is the candidate pane, to avoid corner drawing mess and to cope with masked grid frame centre
- MAknsControlContext* cc = AknsDrawUtils::ControlContext(this);
- TRect rect = Rect();
-
- // Draw scroll background
- AknsDrawUtils::DrawBackground( skin, cc, this, gc,
- rect.iTl, rect, KAknsDrawParamDefault );
-
- // Draw close Rects
- if ( iShowClose )
- {
- TRect outerRect;
- TRect innerRect;
- CalculateCloseRects( outerRect, innerRect );
- AknsDrawUtils::DrawFrame( skin, gc, outerRect, innerRect,
- KAknsIIDQsnFrKeypadButtonFrNormal, KAknsIIDDefault );
- // Draw close bitmap
- iIndiFepClose.DrawImage( gc,
- iScrollCloseBitmap,
- iScrollCloseBitmapMask );
- }
-
- // Draw Up arrow & Down arrow
- if ( iShowVerticalScrollArrows )
- {
- if ( iShowUpScrollArrows )
- {
- iIndiFepArrowUp.DrawImage( gc,
- iNaviArrowBitmapUp,
- iNaviArrowBitmapUpMask );
- }
-
- if ( iShowDownScrollArrows )
- {
- iIndiFepArrowDown.DrawImage( gc,
- iNaviArrowBitmapDown,
- iNaviArrowBitmapDownMask );
- }
- }
- }
-
-void CAknFepUICtrlCandidateScroll::HandlePointerEventL( const TPointerEvent & aPointerEvent )
- {
- // Close area is click will close the container
- if ( iObServer != NULL && iIndiFepClose.Rect().Contains( aPointerEvent.iPosition ))
- {
- iObServer->FepUIClosePressed();
- }
- }
-
-void CAknFepUICtrlCandidateScroll::ShowUpScrollArrows(TBool aValue)
- {
- // Update the up arrow if needed
- if ( iShowUpScrollArrows != aValue )
- {
- iShowUpScrollArrows = aValue;
- TRect rect = iIndiFepArrowUp.Rect();
- Window().Invalidate(rect);
- }
- }
-
-void CAknFepUICtrlCandidateScroll::ShowDownScrollArrows( TBool aValue )
- {
- // Update the down arrow if needed
- if ( iShowDownScrollArrows != aValue )
- {
- iShowDownScrollArrows = aValue;
- TRect rect = iIndiFepArrowDown.Rect();
- Window().Invalidate(rect);
- }
- }
-
-void CAknFepUICtrlCandidateScroll::ShowVerticalScrollArrows( TBool aValue )
- {
- // If the state is changed, the arrows will be redrawn in the new state.
- if(!COMPARE_BOOLS(iShowVerticalScrollArrows, aValue))
- {
- iShowVerticalScrollArrows = aValue;
- //TRect rect = iIndiFepArrowUp.Rect();
- DrawDeferred();
- //rect = iIndiFepArrowDown.Rect();
- //Window().Invalidate(rect);
- }
- }
-
-TBool CAknFepUICtrlCandidateScroll::IsShowVerticalScrollArrows() const
- {
- return iShowVerticalScrollArrows;
- }
-
-void CAknFepUICtrlCandidateScroll::ConstructL( RWindowTreeNode& aParent,
- MAknFepUIEventObserver* aObserver )
- {
- CreateWindowL( aParent );
- ConstructBitmapsL();
- iObServer = aObserver;
-
- TRect rect;
- AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, rect );
- // Dibert will not need close button
- iShowClose = rect.Height() == DibertHeight ? EFalse : ETrue;
-
- }
-
-void CAknFepUICtrlCandidateScroll::ConstructBitmapsL()
- {
- MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-
- TFileName bmpFile;
- bmpFile.Copy(_L("z:"));
- bmpFile.Append( KDC_BITMAP_DIR );
- bmpFile.Append( KFepUiControlsBitmapFile );
-
- // Create close bitmap
- AknsUtils::CreateColorIconL( skin,
- KAknsIIDQgnGrafFepCandiListClose,
- KAknsIIDQsnIconColors,
- EAknsCIQsnIconColorsCG20,
- iScrollCloseBitmap,
- iScrollCloseBitmapMask,
- bmpFile,
- EMbmAknfepuictrlsQgn_indi_input_candi_list_close,
- EMbmAknfepuictrlsQgn_indi_input_candi_list_close_mask,
- AKN_LAF_COLOR( 0 ));
-
- // Create Up bitmap
- AknsUtils::CreateColorIconL( skin,
- KAknsIIDQgnIndiFepArrowUp,
- KAknsIIDQsnIconColors,
- EAknsCIQsnIconColorsCG20,
- iNaviArrowBitmapUp,
- iNaviArrowBitmapUpMask,
- bmpFile,
- EMbmAknfepuictrlsQgn_indi_fep_arrow_up,
- EMbmAknfepuictrlsQgn_indi_fep_arrow_up_mask,
- AKN_LAF_COLOR( 0 ));
-
- // Create Down bitmap
- AknsUtils::CreateColorIconL( skin,
- KAknsIIDQgnIndiFepArrowDown,
- KAknsIIDQsnIconColors,
- EAknsCIQsnIconColorsCG20,
- iNaviArrowBitmapDown,
- iNaviArrowBitmapDownMask,
- bmpFile,
- EMbmAknfepuictrlsQgn_indi_fep_arrow_down,
- EMbmAknfepuictrlsQgn_indi_fep_arrow_down_mask,
- AKN_LAF_COLOR( 0 ));
- }
-
-CAknFepUICtrlCandidateScroll::CAknFepUICtrlCandidateScroll()
-: iShowVerticalScrollArrows(EFalse),
- iShowUpScrollArrows(ETrue),
- iShowDownScrollArrows(ETrue),
- iShowClose(ETrue)
- {
- }
-
-void CAknFepUICtrlCandidateScroll::LayoutIcon()
- {
- TRect rect = Rect();
- // layout arrow up
- TAknWindowLineLayout arrowUpLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g1(0);
- iIndiFepArrowUp.LayoutRect( rect, arrowUpLayout );
- AknIconUtils::SetSize(iNaviArrowBitmapUp, iIndiFepArrowUp.Rect().Size());
-
- // layout arrow down
- TAknWindowLineLayout arrowDownLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g2(0);
- iIndiFepArrowDown.LayoutRect( rect, arrowDownLayout );
- AknIconUtils::SetSize( iNaviArrowBitmapDown, iIndiFepArrowDown.Rect().Size());
-
- // layout close
- TAknWindowLineLayout closeLayout = AknLayoutScalable_Avkon::cell_hyb_candi_scroll_pane_g3(0);
- iIndiFepClose.LayoutRect( rect, closeLayout );
- AknIconUtils::SetSize( iScrollCloseBitmap, iIndiFepClose.Rect().Size());
- }
-
-void CAknFepUICtrlCandidateScroll::CalculateCloseRects(TRect& aOuterRect, TRect& aInnerRect) const
- {
- TRect windowRect = iIndiFepClose.Rect();
-
- TAknLayoutRect topLeft;
- topLeft.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_2());
-
- TAknLayoutRect bottomRight;
- bottomRight.LayoutRect( windowRect, SkinLayout::Highlight_skin_placing__grid__Line_5());
-
- aOuterRect = TRect( topLeft.Rect().iTl, bottomRight.Rect().iBr );
- aInnerRect = TRect( topLeft.Rect().iBr, bottomRight.Rect().iTl );
- }
-
// End of file