diff -r aecbbf00d063 -r d48ab3b357f1 uifw/AvKon/src/akncolourselectiongrid.cpp --- a/uifw/AvKon/src/akncolourselectiongrid.cpp Tue Aug 31 15:28:30 2010 +0300 +++ b/uifw/AvKon/src/akncolourselectiongrid.cpp Wed Sep 01 12:16:19 2010 +0100 @@ -192,7 +192,196 @@ #endif aGc.DrawRect( gridRect ); }; - + +// CLASS DECLARATION + +/** +* CMainTextArray +* +* +* +* @lib avkon +* @since 2.0 +*/ + +NONSHARABLE_CLASS(CMainTextArray) : public MDesCArray, public CBase + { + public: + + /** + * C++ default constructor. + */ + CMainTextArray(TBool &aNoneExist); + /** + * Destructor. + */ + ~CMainTextArray(); + + /** + * MdcaCount + * @since 2.0 + * @return + */ + virtual TInt MdcaCount() const; + + /** + * MdcaPoint + * @since 2.0 + * @param aIndex + * @return + */ + virtual TPtrC MdcaPoint(TInt aIndex) const; + + /** + * ConstructL + * @since 2.0 + * @param aColours Array of colours to be in grid + */ + void ConstructL(CArrayFixFlat* aColours); + + /** + * ReSizeIcons + * @since 5.2 + * @param aWidth the width of icon + * @param aheight the height of icon + */ + void ReSizeIcons( TInt aWidth, TInt aHeight ); + + public: // Data + CGulIcon* iIcon[16]; + + private: // Data + mutable TInt iIndex; + TInt iColourNmbr; + TBool iNoneExist; + CArrayFixFlat* iColours; + CFbsBitmap* iBitmap[16]; + CFbsBitmapDevice* iBmpDevice[16]; + HBufC *iString; + + }; + +// --------------------------------------------------------- +// CMainTextArray::CMainTextArray() +// +// --------------------------------------------------------- +// +CMainTextArray::CMainTextArray(TBool &aNoneExist) + : iNoneExist(aNoneExist) + { + } +// --------------------------------------------------------- +// CMainTextArray::~CMainTextArray() +// +// --------------------------------------------------------- +// +CMainTextArray::~CMainTextArray() + { + for (TInt i = 0;i* aColours) + { + + this->iColours = aColours; + iColourNmbr = aColours->Count(); + if (iColourNmbr > 16) + { + iColourNmbr = 16; + } + TAknLayoutRect r; + TAknLayoutRect rectPane; + rectPane.LayoutRect( TRect( 0, 0, 0, 0 ), + AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane( + iNoneExist, + 0, + 0).LayoutLine()); + r.LayoutRect( rectPane.Rect(), + AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane_g1().LayoutLine()); + TSize bmpsize( r.Rect().Width(), r.Rect().Height() ); + for ( TInt i = 0; i < iColourNmbr; i++ ) + { + iBitmap[i] = new (ELeave) CFbsBitmap(); + iBitmap[i]->Create(bmpsize,EColor4K); + iIcon[i] = CGulIcon::NewL(iBitmap[i]); + iIcon[i]->SetBitmapsOwnedExternally(ETrue); + iBmpDevice[i] = CFbsBitmapDevice::NewL(iBitmap[i]); + iBmpDevice[i]->Resize(iBitmap[i]->SizeInPixels()); + } + iString = HBufC::NewL(10); + } + +// --------------------------------------------------------- +// CMainTextArray::ReSizeIcons() +// +// --------------------------------------------------------- +// +void CMainTextArray::ReSizeIcons( TInt aWidth, TInt aHeight ) + { + TSize bmpsize( aWidth, aHeight ); + for ( TInt i = 0; i < iColourNmbr; i++ ) + { + if ( iBitmap[i] ) + { + iBitmap[i]->Resize( bmpsize ); + } + if ( iBmpDevice[i] ) + { + iBmpDevice[i]->Resize( iBitmap[i]->SizeInPixels() ); + } + } + } + +// --------------------------------------------------------- +// CMainTextArray::MdcaCount() +// +// --------------------------------------------------------- +// +TInt CMainTextArray::MdcaCount() const + { + return(iColourNmbr); + } + +// --------------------------------------------------------- +// CMainTextArray::MdcaPoint() +// +// --------------------------------------------------------- +// +TPtrC CMainTextArray::MdcaPoint(TInt aIndex) const + { + TRAP_IGNORE( + { + + CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); + CleanupStack::PushL( fbsBitGc ); + + fbsBitGc->Activate(iBmpDevice[aIndex]); + + fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); + if (aIndex < iColourNmbr) + { + fbsBitGc->SetBrushColor(iColours->At(aIndex)); + } + fbsBitGc->Clear(); + + CleanupStack::PopAndDestroy(); // fbsBitGc + }); + //fix for TSW error AJUA-7MTAXE + iString->Des().Num(aIndex); + + return *iString; + } + // CLASS DECLARATION /** @@ -395,6 +584,18 @@ TInt cellWidth = colourCellSize.Rect().Width() - 1; TInt cellHeight = colourCellSize.Rect().Height() - 1; + TAknLayoutRect r; + TAknLayoutRect rectPane; + rectPane.LayoutRect( gridRect, + AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane( + iNoneExist, + 0, + 0 ).LayoutLine() ); + r.LayoutRect( rectPane.Rect(), + AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane_g1().LayoutLine() ); + MDesCArray* iconArray = Model()->ItemTextArray(); + static_cast(iconArray)->ReSizeIcons( r.Rect().Width(), r.Rect().Height() ); + // Define the overall size of the cell AknListBoxLayouts::SetupGridPos(*this, 0, 0, 0, 0, cellWidth, cellHeight); @@ -737,11 +938,11 @@ { // on down event list basic feedback + audio fbSpec->AddFeedback( ETouchEventStylusDown, - ETouchFeedbackBasicItem ); + ETouchFeedbackList ); // on up event list basic feedback, no audio fbSpec->AddFeedback( ETouchEventStylusUp, - ETouchFeedbackBasicItem, + ETouchFeedbackList, ETouchFeedbackVibra ); feedback->SetFeedbackArea( this, @@ -1338,168 +1539,7 @@ } -// CLASS DECLARATION -/** -* CMainTextArray -* -* -* -* @lib avkon -* @since 2.0 -*/ - -NONSHARABLE_CLASS(CMainTextArray) : public MDesCArray, public CBase - { - public: - - /** - * C++ default constructor. - */ - CMainTextArray(TBool &aNoneExist); - /** - * Destructor. - */ - ~CMainTextArray(); - - /** - * MdcaCount - * @since 2.0 - * @return - */ - virtual TInt MdcaCount() const; - - /** - * MdcaPoint - * @since 2.0 - * @param aIndex - * @return - */ - virtual TPtrC MdcaPoint(TInt aIndex) const; - - /** - * ConstructL - * @since 2.0 - * @param aColours Array of colours to be in grid - */ - void ConstructL(CArrayFixFlat* aColours); - - public: // Data - CGulIcon* iIcon[16]; - - private: // Data - mutable TInt iIndex; - TInt iColourNmbr; - TBool iNoneExist; - CArrayFixFlat* iColours; - CFbsBitmap* iBitmap[16]; - CFbsBitmapDevice* iBmpDevice[16]; - HBufC *iString; - - }; - -// --------------------------------------------------------- -// CMainTextArray::CMainTextArray() -// -// --------------------------------------------------------- -// -CMainTextArray::CMainTextArray(TBool &aNoneExist) - : iNoneExist(aNoneExist) - { - } -// --------------------------------------------------------- -// CMainTextArray::~CMainTextArray() -// -// --------------------------------------------------------- -// -CMainTextArray::~CMainTextArray() - { - for (TInt i = 0;i* aColours) - { - - this->iColours = aColours; - iColourNmbr = aColours->Count(); - if (iColourNmbr > 16) - { - iColourNmbr = 16; - } - - TAknLayoutRect r; - TAknLayoutRect r_pane; - TInt w, h; - r_pane.LayoutRect(TRect(0,0,0,0), AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane(iNoneExist, 0, 0).LayoutLine()); - r.LayoutRect(r_pane.Rect(), AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane_g1().LayoutLine()); - w = r.Rect().Width(); - h = r.Rect().Height(); - TSize bmpsize(w,h); - - for (TInt i = 0;iCreate(bmpsize,EColor4K); - iIcon[i] = CGulIcon::NewL(iBitmap[i]); - iIcon[i]->SetBitmapsOwnedExternally(ETrue); - iBmpDevice[i] = CFbsBitmapDevice::NewL(iBitmap[i]); - iBmpDevice[i]->Resize(iBitmap[i]->SizeInPixels()); - } - - iString = HBufC::NewL(10); - } - - -// --------------------------------------------------------- -// CMainTextArray::MdcaCount() -// -// --------------------------------------------------------- -// -TInt CMainTextArray::MdcaCount() const - { - return(iColourNmbr); - } - -// --------------------------------------------------------- -// CMainTextArray::MdcaPoint() -// -// --------------------------------------------------------- -// -TPtrC CMainTextArray::MdcaPoint(TInt aIndex) const - { - TRAP_IGNORE( - { - - CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); - CleanupStack::PushL( fbsBitGc ); - - fbsBitGc->Activate(iBmpDevice[aIndex]); - - fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); - if (aIndex < iColourNmbr) - { - fbsBitGc->SetBrushColor(iColours->At(aIndex)); - } - - fbsBitGc->Clear(); - - CleanupStack::PopAndDestroy(); // fbsBitGc - }); - //fix for TSW error AJUA-7MTAXE - iString->Des().Num(aIndex); - - return *iString; - } // ============================ MEMBER FUNCTIONS =============================== @@ -1683,22 +1723,27 @@ // close the color grid: // if the NGA effects are off, use “pop-up”. // If NGA effects are on, use “pop-up closed”. - MTouchFeedback* feedback = MTouchFeedback::Instance(); - if ( feedback ) + if( AknLayoutUtils::PenEnabled() ) { - if( AknLayoutUtils::PenEnabled() ) + MTouchFeedback* feedback = MTouchFeedback::Instance(); + if ( feedback ) { if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) { - feedback->InstantFeedback( ETouchFeedbackPopupClose ); + feedback->InstantFeedback( this, + ETouchFeedbackIncreasingPopUp, + ETouchFeedbackVibra, + TPointerEvent() ); } else { - feedback->InstantFeedback( ETouchFeedbackPopUp ); + feedback->InstantFeedback( this, + ETouchFeedbackPopUp, + ETouchFeedbackVibra, + TPointerEvent() ); } } } - switch (aButton) { case EAknSoftkeyInsert: @@ -1719,6 +1764,7 @@ } default: { + break; } } @@ -1783,18 +1829,24 @@ // open the color grid: // if the NGA effects are off, use “pop-up”. // If NGA effects are on, use “increasing long touch”. + if( AknLayoutUtils::PenEnabled() ) + { MTouchFeedback* feedback = MTouchFeedback::Instance(); if ( feedback ) - { - if( AknLayoutUtils::PenEnabled() ) { if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) { - feedback->InstantFeedback( ETouchFeedbackPopupOpen ); + feedback->InstantFeedback( this, + ETouchFeedbackIncreasingPopUp, + ETouchFeedbackVibra, + TPointerEvent() ); } else { - feedback->InstantFeedback( ETouchFeedbackPopUp ); + feedback->InstantFeedback( this, + ETouchFeedbackPopUp, + ETouchFeedbackVibra, + TPointerEvent() ); } } } @@ -1977,13 +2029,6 @@ if ( !Rect().Contains( aPointerEvent.iPosition ) ) { - if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) - { - TryExitL( EAknSoftkeyCancel ); - _AKNTRACE_FUNC_EXIT; - return; - } - if ( aPointerEvent.iType == TPointerEvent::EDrag ) { iExtension->iIsDragged = ETrue;