190 transApi->StopDrawing(); |
190 transApi->StopDrawing(); |
191 } |
191 } |
192 #endif |
192 #endif |
193 aGc.DrawRect( gridRect ); |
193 aGc.DrawRect( gridRect ); |
194 }; |
194 }; |
195 |
195 |
196 // CLASS DECLARATION |
|
197 |
|
198 /** |
|
199 * CMainTextArray |
|
200 * |
|
201 * |
|
202 * |
|
203 * @lib avkon |
|
204 * @since 2.0 |
|
205 */ |
|
206 |
|
207 NONSHARABLE_CLASS(CMainTextArray) : public MDesCArray, public CBase |
|
208 { |
|
209 public: |
|
210 |
|
211 /** |
|
212 * C++ default constructor. |
|
213 */ |
|
214 CMainTextArray(TBool &aNoneExist); |
|
215 /** |
|
216 * Destructor. |
|
217 */ |
|
218 ~CMainTextArray(); |
|
219 |
|
220 /** |
|
221 * MdcaCount |
|
222 * @since 2.0 |
|
223 * @return |
|
224 */ |
|
225 virtual TInt MdcaCount() const; |
|
226 |
|
227 /** |
|
228 * MdcaPoint |
|
229 * @since 2.0 |
|
230 * @param aIndex |
|
231 * @return |
|
232 */ |
|
233 virtual TPtrC MdcaPoint(TInt aIndex) const; |
|
234 |
|
235 /** |
|
236 * ConstructL |
|
237 * @since 2.0 |
|
238 * @param aColours Array of colours to be in grid |
|
239 */ |
|
240 void ConstructL(CArrayFixFlat<TRgb>* aColours); |
|
241 |
|
242 /** |
|
243 * ReSizeIcons |
|
244 * @since 5.2 |
|
245 * @param aWidth the width of icon |
|
246 * @param aheight the height of icon |
|
247 */ |
|
248 void ReSizeIcons( TInt aWidth, TInt aHeight ); |
|
249 |
|
250 public: // Data |
|
251 CGulIcon* iIcon[16]; |
|
252 |
|
253 private: // Data |
|
254 mutable TInt iIndex; |
|
255 TInt iColourNmbr; |
|
256 TBool iNoneExist; |
|
257 CArrayFixFlat<TRgb>* iColours; |
|
258 CFbsBitmap* iBitmap[16]; |
|
259 CFbsBitmapDevice* iBmpDevice[16]; |
|
260 HBufC *iString; |
|
261 |
|
262 }; |
|
263 |
|
264 // --------------------------------------------------------- |
|
265 // CMainTextArray::CMainTextArray() |
|
266 // |
|
267 // --------------------------------------------------------- |
|
268 // |
|
269 CMainTextArray::CMainTextArray(TBool &aNoneExist) |
|
270 : iNoneExist(aNoneExist) |
|
271 { |
|
272 } |
|
273 // --------------------------------------------------------- |
|
274 // CMainTextArray::~CMainTextArray() |
|
275 // |
|
276 // --------------------------------------------------------- |
|
277 // |
|
278 CMainTextArray::~CMainTextArray() |
|
279 { |
|
280 for (TInt i = 0;i<iColourNmbr;i++) |
|
281 { |
|
282 delete iBitmap[i]; |
|
283 delete iBmpDevice[i]; |
|
284 } |
|
285 delete iString; |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------- |
|
289 // CMainTextArray::ConstructL() |
|
290 // |
|
291 // --------------------------------------------------------- |
|
292 // |
|
293 void CMainTextArray::ConstructL(CArrayFixFlat<TRgb>* aColours) |
|
294 { |
|
295 |
|
296 this->iColours = aColours; |
|
297 iColourNmbr = aColours->Count(); |
|
298 if (iColourNmbr > 16) |
|
299 { |
|
300 iColourNmbr = 16; |
|
301 } |
|
302 TAknLayoutRect r; |
|
303 TAknLayoutRect rectPane; |
|
304 rectPane.LayoutRect( TRect( 0, 0, 0, 0 ), |
|
305 AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane( |
|
306 iNoneExist, |
|
307 0, |
|
308 0).LayoutLine()); |
|
309 r.LayoutRect( rectPane.Rect(), |
|
310 AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane_g1().LayoutLine()); |
|
311 TSize bmpsize( r.Rect().Width(), r.Rect().Height() ); |
|
312 for ( TInt i = 0; i < iColourNmbr; i++ ) |
|
313 { |
|
314 iBitmap[i] = new (ELeave) CFbsBitmap(); |
|
315 iBitmap[i]->Create(bmpsize,EColor4K); |
|
316 iIcon[i] = CGulIcon::NewL(iBitmap[i]); |
|
317 iIcon[i]->SetBitmapsOwnedExternally(ETrue); |
|
318 iBmpDevice[i] = CFbsBitmapDevice::NewL(iBitmap[i]); |
|
319 iBmpDevice[i]->Resize(iBitmap[i]->SizeInPixels()); |
|
320 } |
|
321 iString = HBufC::NewL(10); |
|
322 } |
|
323 |
|
324 // --------------------------------------------------------- |
|
325 // CMainTextArray::ReSizeIcons() |
|
326 // |
|
327 // --------------------------------------------------------- |
|
328 // |
|
329 void CMainTextArray::ReSizeIcons( TInt aWidth, TInt aHeight ) |
|
330 { |
|
331 TSize bmpsize( aWidth, aHeight ); |
|
332 for ( TInt i = 0; i < iColourNmbr; i++ ) |
|
333 { |
|
334 if ( iBitmap[i] ) |
|
335 { |
|
336 iBitmap[i]->Resize( bmpsize ); |
|
337 } |
|
338 if ( iBmpDevice[i] ) |
|
339 { |
|
340 iBmpDevice[i]->Resize( iBitmap[i]->SizeInPixels() ); |
|
341 } |
|
342 } |
|
343 } |
|
344 |
|
345 // --------------------------------------------------------- |
|
346 // CMainTextArray::MdcaCount() |
|
347 // |
|
348 // --------------------------------------------------------- |
|
349 // |
|
350 TInt CMainTextArray::MdcaCount() const |
|
351 { |
|
352 return(iColourNmbr); |
|
353 } |
|
354 |
|
355 // --------------------------------------------------------- |
|
356 // CMainTextArray::MdcaPoint() |
|
357 // |
|
358 // --------------------------------------------------------- |
|
359 // |
|
360 TPtrC CMainTextArray::MdcaPoint(TInt aIndex) const |
|
361 { |
|
362 TRAP_IGNORE( |
|
363 { |
|
364 |
|
365 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
366 CleanupStack::PushL( fbsBitGc ); |
|
367 |
|
368 fbsBitGc->Activate(iBmpDevice[aIndex]); |
|
369 |
|
370 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
371 if (aIndex < iColourNmbr) |
|
372 { |
|
373 fbsBitGc->SetBrushColor(iColours->At(aIndex)); |
|
374 } |
|
375 fbsBitGc->Clear(); |
|
376 |
|
377 CleanupStack::PopAndDestroy(); // fbsBitGc |
|
378 }); |
|
379 //fix for TSW error AJUA-7MTAXE |
|
380 iString->Des().Num(aIndex); |
|
381 |
|
382 return *iString; |
|
383 } |
|
384 |
|
385 // CLASS DECLARATION |
196 // CLASS DECLARATION |
386 |
197 |
387 /** |
198 /** |
388 * CColorGridView |
199 * CColorGridView |
389 * |
200 * |
581 colourCellSize.LayoutRect(gridRect, AknLayoutScalable_Avkon::aid_size_cell_colour_1_pane(1)); |
392 colourCellSize.LayoutRect(gridRect, AknLayoutScalable_Avkon::aid_size_cell_colour_1_pane(1)); |
582 } |
393 } |
583 |
394 |
584 TInt cellWidth = colourCellSize.Rect().Width() - 1; |
395 TInt cellWidth = colourCellSize.Rect().Width() - 1; |
585 TInt cellHeight = colourCellSize.Rect().Height() - 1; |
396 TInt cellHeight = colourCellSize.Rect().Height() - 1; |
586 |
|
587 TAknLayoutRect r; |
|
588 TAknLayoutRect rectPane; |
|
589 rectPane.LayoutRect( gridRect, |
|
590 AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane( |
|
591 iNoneExist, |
|
592 0, |
|
593 0 ).LayoutLine() ); |
|
594 r.LayoutRect( rectPane.Rect(), |
|
595 AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane_g1().LayoutLine() ); |
|
596 MDesCArray* iconArray = Model()->ItemTextArray(); |
|
597 static_cast<CMainTextArray*>(iconArray)->ReSizeIcons( r.Rect().Width(), r.Rect().Height() ); |
|
598 |
397 |
599 // Define the overall size of the cell |
398 // Define the overall size of the cell |
600 AknListBoxLayouts::SetupGridPos(*this, 0, 0, 0, 0, cellWidth, cellHeight); |
399 AknListBoxLayouts::SetupGridPos(*this, 0, 0, 0, 0, cellWidth, cellHeight); |
601 |
400 |
602 TPoint pointLT(0,0); |
401 TPoint pointLT(0,0); |
936 CFeedbackSpec* fbSpec = CFeedbackSpec::New(); |
735 CFeedbackSpec* fbSpec = CFeedbackSpec::New(); |
937 if ( fbSpec ) |
736 if ( fbSpec ) |
938 { |
737 { |
939 // on down event list basic feedback + audio |
738 // on down event list basic feedback + audio |
940 fbSpec->AddFeedback( ETouchEventStylusDown, |
739 fbSpec->AddFeedback( ETouchEventStylusDown, |
941 ETouchFeedbackList ); |
740 ETouchFeedbackBasicItem ); |
942 |
741 |
943 // on up event list basic feedback, no audio |
742 // on up event list basic feedback, no audio |
944 fbSpec->AddFeedback( ETouchEventStylusUp, |
743 fbSpec->AddFeedback( ETouchEventStylusUp, |
945 ETouchFeedbackList, |
744 ETouchFeedbackBasicItem, |
946 ETouchFeedbackVibra ); |
745 ETouchFeedbackVibra ); |
947 |
746 |
948 feedback->SetFeedbackArea( this, |
747 feedback->SetFeedbackArea( this, |
949 0, |
748 0, |
950 Rect(), |
749 Rect(), |
1537 } |
1336 } |
1538 _AKNTRACE_FUNC_EXIT; |
1337 _AKNTRACE_FUNC_EXIT; |
1539 } |
1338 } |
1540 |
1339 |
1541 |
1340 |
1542 |
1341 // CLASS DECLARATION |
|
1342 |
|
1343 /** |
|
1344 * CMainTextArray |
|
1345 * |
|
1346 * |
|
1347 * |
|
1348 * @lib avkon |
|
1349 * @since 2.0 |
|
1350 */ |
|
1351 |
|
1352 NONSHARABLE_CLASS(CMainTextArray) : public MDesCArray, public CBase |
|
1353 { |
|
1354 public: |
|
1355 |
|
1356 /** |
|
1357 * C++ default constructor. |
|
1358 */ |
|
1359 CMainTextArray(TBool &aNoneExist); |
|
1360 /** |
|
1361 * Destructor. |
|
1362 */ |
|
1363 ~CMainTextArray(); |
|
1364 |
|
1365 /** |
|
1366 * MdcaCount |
|
1367 * @since 2.0 |
|
1368 * @return |
|
1369 */ |
|
1370 virtual TInt MdcaCount() const; |
|
1371 |
|
1372 /** |
|
1373 * MdcaPoint |
|
1374 * @since 2.0 |
|
1375 * @param aIndex |
|
1376 * @return |
|
1377 */ |
|
1378 virtual TPtrC MdcaPoint(TInt aIndex) const; |
|
1379 |
|
1380 /** |
|
1381 * ConstructL |
|
1382 * @since 2.0 |
|
1383 * @param aColours Array of colours to be in grid |
|
1384 */ |
|
1385 void ConstructL(CArrayFixFlat<TRgb>* aColours); |
|
1386 |
|
1387 public: // Data |
|
1388 CGulIcon* iIcon[16]; |
|
1389 |
|
1390 private: // Data |
|
1391 mutable TInt iIndex; |
|
1392 TInt iColourNmbr; |
|
1393 TBool iNoneExist; |
|
1394 CArrayFixFlat<TRgb>* iColours; |
|
1395 CFbsBitmap* iBitmap[16]; |
|
1396 CFbsBitmapDevice* iBmpDevice[16]; |
|
1397 HBufC *iString; |
|
1398 |
|
1399 }; |
|
1400 |
|
1401 // --------------------------------------------------------- |
|
1402 // CMainTextArray::CMainTextArray() |
|
1403 // |
|
1404 // --------------------------------------------------------- |
|
1405 // |
|
1406 CMainTextArray::CMainTextArray(TBool &aNoneExist) |
|
1407 : iNoneExist(aNoneExist) |
|
1408 { |
|
1409 } |
|
1410 // --------------------------------------------------------- |
|
1411 // CMainTextArray::~CMainTextArray() |
|
1412 // |
|
1413 // --------------------------------------------------------- |
|
1414 // |
|
1415 CMainTextArray::~CMainTextArray() |
|
1416 { |
|
1417 for (TInt i = 0;i<iColourNmbr;i++) |
|
1418 { |
|
1419 delete iBitmap[i]; |
|
1420 delete iBmpDevice[i]; |
|
1421 } |
|
1422 delete iString; |
|
1423 } |
|
1424 |
|
1425 // --------------------------------------------------------- |
|
1426 // CMainTextArray::ConstructL() |
|
1427 // |
|
1428 // --------------------------------------------------------- |
|
1429 // |
|
1430 void CMainTextArray::ConstructL(CArrayFixFlat<TRgb>* aColours) |
|
1431 { |
|
1432 |
|
1433 this->iColours = aColours; |
|
1434 iColourNmbr = aColours->Count(); |
|
1435 if (iColourNmbr > 16) |
|
1436 { |
|
1437 iColourNmbr = 16; |
|
1438 } |
|
1439 |
|
1440 TAknLayoutRect r; |
|
1441 TAknLayoutRect r_pane; |
|
1442 TInt w, h; |
|
1443 r_pane.LayoutRect(TRect(0,0,0,0), AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane(iNoneExist, 0, 0).LayoutLine()); |
|
1444 r.LayoutRect(r_pane.Rect(), AknLayoutScalable_Avkon::cell_large_graphic_colour_popup_pane_g1().LayoutLine()); |
|
1445 w = r.Rect().Width(); |
|
1446 h = r.Rect().Height(); |
|
1447 TSize bmpsize(w,h); |
|
1448 |
|
1449 for (TInt i = 0;i<iColourNmbr;i++) |
|
1450 { |
|
1451 iBitmap[i] = new (ELeave) CFbsBitmap(); |
|
1452 iBitmap[i]->Create(bmpsize,EColor4K); |
|
1453 iIcon[i] = CGulIcon::NewL(iBitmap[i]); |
|
1454 iIcon[i]->SetBitmapsOwnedExternally(ETrue); |
|
1455 iBmpDevice[i] = CFbsBitmapDevice::NewL(iBitmap[i]); |
|
1456 iBmpDevice[i]->Resize(iBitmap[i]->SizeInPixels()); |
|
1457 } |
|
1458 |
|
1459 iString = HBufC::NewL(10); |
|
1460 } |
|
1461 |
|
1462 |
|
1463 // --------------------------------------------------------- |
|
1464 // CMainTextArray::MdcaCount() |
|
1465 // |
|
1466 // --------------------------------------------------------- |
|
1467 // |
|
1468 TInt CMainTextArray::MdcaCount() const |
|
1469 { |
|
1470 return(iColourNmbr); |
|
1471 } |
|
1472 |
|
1473 // --------------------------------------------------------- |
|
1474 // CMainTextArray::MdcaPoint() |
|
1475 // |
|
1476 // --------------------------------------------------------- |
|
1477 // |
|
1478 TPtrC CMainTextArray::MdcaPoint(TInt aIndex) const |
|
1479 { |
|
1480 TRAP_IGNORE( |
|
1481 { |
|
1482 |
|
1483 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
1484 CleanupStack::PushL( fbsBitGc ); |
|
1485 |
|
1486 fbsBitGc->Activate(iBmpDevice[aIndex]); |
|
1487 |
|
1488 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1489 if (aIndex < iColourNmbr) |
|
1490 { |
|
1491 fbsBitGc->SetBrushColor(iColours->At(aIndex)); |
|
1492 } |
|
1493 |
|
1494 fbsBitGc->Clear(); |
|
1495 |
|
1496 CleanupStack::PopAndDestroy(); // fbsBitGc |
|
1497 }); |
|
1498 //fix for TSW error AJUA-7MTAXE |
|
1499 iString->Des().Num(aIndex); |
|
1500 |
|
1501 return *iString; |
|
1502 } |
1543 |
1503 |
1544 // ============================ MEMBER FUNCTIONS =============================== |
1504 // ============================ MEMBER FUNCTIONS =============================== |
1545 |
1505 |
1546 // ---------------------------------------------------------------------------- |
1506 // ---------------------------------------------------------------------------- |
1547 // Extension class |
1507 // Extension class |
1721 { |
1681 { |
1722 _AKNTRACE_FUNC_ENTER; |
1682 _AKNTRACE_FUNC_ENTER; |
1723 // close the color grid: |
1683 // close the color grid: |
1724 // if the NGA effects are off, use “pop-up”. |
1684 // if the NGA effects are off, use “pop-up”. |
1725 // If NGA effects are on, use “pop-up closed”. |
1685 // If NGA effects are on, use “pop-up closed”. |
1726 if( AknLayoutUtils::PenEnabled() ) |
1686 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1727 { |
1687 if ( feedback ) |
1728 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1688 { |
1729 if ( feedback ) |
1689 if( AknLayoutUtils::PenEnabled() ) |
1730 { |
1690 { |
1731 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
1691 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
1732 { |
1692 { |
1733 feedback->InstantFeedback( this, |
1693 feedback->InstantFeedback( ETouchFeedbackPopupClose ); |
1734 ETouchFeedbackIncreasingPopUp, |
|
1735 ETouchFeedbackVibra, |
|
1736 TPointerEvent() ); |
|
1737 } |
1694 } |
1738 else |
1695 else |
1739 { |
1696 { |
1740 feedback->InstantFeedback( this, |
1697 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
1741 ETouchFeedbackPopUp, |
|
1742 ETouchFeedbackVibra, |
|
1743 TPointerEvent() ); |
|
1744 } |
1698 } |
1745 } |
1699 } |
1746 } |
1700 } |
|
1701 |
1747 switch (aButton) |
1702 switch (aButton) |
1748 { |
1703 { |
1749 case EAknSoftkeyInsert: |
1704 case EAknSoftkeyInsert: |
1750 case EEikBidOk: |
1705 case EEikBidOk: |
1751 { |
1706 { |
1827 { |
1781 { |
1828 _AKNTRACE_FUNC_ENTER; |
1782 _AKNTRACE_FUNC_ENTER; |
1829 // open the color grid: |
1783 // open the color grid: |
1830 // if the NGA effects are off, use “pop-up”. |
1784 // if the NGA effects are off, use “pop-up”. |
1831 // If NGA effects are on, use “increasing long touch”. |
1785 // If NGA effects are on, use “increasing long touch”. |
1832 if( AknLayoutUtils::PenEnabled() ) |
|
1833 { |
|
1834 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1786 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
1835 if ( feedback ) |
1787 if ( feedback ) |
|
1788 { |
|
1789 if( AknLayoutUtils::PenEnabled() ) |
1836 { |
1790 { |
1837 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
1791 if ( CAknTransitionUtils::TransitionsEnabled( AknTransEffect::EComponentTransitionsOff ) ) |
1838 { |
1792 { |
1839 feedback->InstantFeedback( this, |
1793 feedback->InstantFeedback( ETouchFeedbackPopupOpen ); |
1840 ETouchFeedbackIncreasingPopUp, |
|
1841 ETouchFeedbackVibra, |
|
1842 TPointerEvent() ); |
|
1843 } |
1794 } |
1844 else |
1795 else |
1845 { |
1796 { |
1846 feedback->InstantFeedback( this, |
1797 feedback->InstantFeedback( ETouchFeedbackPopUp ); |
1847 ETouchFeedbackPopUp, |
|
1848 ETouchFeedbackVibra, |
|
1849 TPointerEvent() ); |
|
1850 } |
1798 } |
1851 } |
1799 } |
1852 } |
1800 } |
1853 |
1801 |
1854 // Create the grid control. CAknDialog will CreateFromResourceL() it |
1802 // Create the grid control. CAknDialog will CreateFromResourceL() it |