--- a/uifw/AvKon/src/akncolourselectiongrid.cpp Fri Mar 12 15:43:43 2010 +0200
+++ b/uifw/AvKon/src/akncolourselectiongrid.cpp Mon Mar 15 12:41:34 2010 +0200
@@ -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<TRgb>* 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<TRgb>* 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<iColourNmbr;i++)
+ {
+ delete iBitmap[i];
+ delete iBmpDevice[i];
+ }
+ delete iString;
+ }
+
+// ---------------------------------------------------------
+// CMainTextArray::ConstructL()
+//
+// ---------------------------------------------------------
+//
+void CMainTextArray::ConstructL(CArrayFixFlat<TRgb>* 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<CMainTextArray*>(iconArray)->ReSizeIcons( r.Rect().Width(), r.Rect().Height() );
+
// Define the overall size of the cell
AknListBoxLayouts::SetupGridPos(*this, 0, 0, 0, 0, cellWidth, cellHeight);
@@ -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<TRgb>* aColours);
-
- public: // Data
- CGulIcon* iIcon[16];
-
- private: // Data
- mutable TInt iIndex;
- TInt iColourNmbr;
- TBool iNoneExist;
- CArrayFixFlat<TRgb>* 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<iColourNmbr;i++)
- {
- delete iBitmap[i];
- delete iBmpDevice[i];
- }
- delete iString;
- }
-
-// ---------------------------------------------------------
-// CMainTextArray::ConstructL()
-//
-// ---------------------------------------------------------
-//
-void CMainTextArray::ConstructL(CArrayFixFlat<TRgb>* 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;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::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 ===============================