×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    29

    Smile Anyway to customize the icon drawing method in "CAknSingleGraphicStyleListBox"?

    We want to make the icons displayed in "CAknSingleGraphicStyleListBox" control with various, smaller decoration icon on it according to the status of items.

    So far I have tried two approaches:
    1. Before provide the list box with an icon array, modify the content of the bitmaps in CGulIcon accordingly. I am having bad luck with this way.

    2. Modify the default drawing behavior of the "CAknSingleGraphicStyleListBox". I have checked this wiki:
    http://wiki.forum.nokia.com/index.ph..._a_list_box%3F
    but it seems it can only affect the layout and text drawing of the listbox.

    Any suggestion is welcomed.

  2. #2
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: Anyway to customize the icon drawing method in "CAknSingleGraphicStyleListBox"?

    Hi,
    It is possible to have your own icon displayed in the listbox. I think you are heading in right direction you will need to have cutomized Draw function where you can mention something like
    TSize iconSize(iconRect.Width(),iconRect.Height());
    AknIconUtils::SetSize(icon->iBitmap, iconSize);
    AknIconUtils::SetSize(icon->iMask, iconSize);
    aGc.BitBltMasked(iconRect.iTl, icon->iBitmap, TRect(TPoint(0,0), iconSize), icon->iMask, EFalse);
    This is just an example you can implement it according to your needs.
    Maximus
    S60 Developer
    Impossible is nothing

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    Re: Anyway to customize the icon drawing method in "CAknSingleGraphicStyleListBox"?

    Hi,

    you can override the drawer only (e.g. CDoubleLargeStyleItemDrawer or similar) or provide new set of icons as you have mentioned. All drawers are derived from the CListItemDrawer class, which have the method DrawItem(), which is responsible for drawing the whole line. This could be pretty difficult and you have to care also about the skins, selections, proper colors, etc. I did not find any drawer - in which you can override only the icon rendering...

    I will personally start with providing the new icon array - this should work.

    BR,
    STeN

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    29

    Re: Anyway to customize the icon drawing method in "CAknSingleGraphicStyleListBox"?

    Thanks a lot.

    I have tried further, with the following code, but it doesn't affect the icon drawn on the list.

    //draw a "green donut" circle on the bitmap image.
    CGulIcon *gulIcon = aAppInfo.iIcon;
    CFbsBitmap* appIcon = gulIcon->Bitmap();
    CFbsBitmap* appIconMask = gulIcon->Mask();

    TSize appIconSize = appIcon->SizeInPixels();
    TRect statusAreaRect(appIconSize.iWidth/2, appIconSize.iHeight/2, appIconSize.iWidth, appIconSize.iHeight);
    TPoint statusAreaTopCenter(appIconSize.iWidth*3/4, appIconSize.iHeight/2);

    CFbsBitmapDevice* bitmapDevice = NULL;
    CFbsBitGc* bitmapGc = NULL;

    bitmapDevice = CFbsBitmapDevice::NewL(appIcon);
    bitmapDevice->CreateContext(bitmapGc);
    bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
    bitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
    bitmapGc->SetPenStyle(CGraphicsContext::ESolidPen);
    bitmapGc->SetPenSize(TSize(2, 2));
    bitmapGc->SetPenColor(TRgb(0x0000dd66, 0xff));
    bitmapGc->DrawArc(statusAreaRect, statusAreaTopCenter, statusAreaTopCenter);

    delete bitmapDevice;
    bitmapDevice = NULL;
    delete bitmapGc;
    bitmapGc = NULL;

    bitmapDevice = CFbsBitmapDevice::NewL(appIconMask);
    bitmapDevice->CreateContext(bitmapGc);
    bitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
    bitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
    bitmapGc->SetPenStyle(CGraphicsContext::ESolidPen);
    bitmapGc->SetPenSize(TSize(2, 2));
    bitmapGc->SetPenColor(TRgb(0x00000000, 0xff));
    bitmapGc->DrawArc(statusAreaRect, statusAreaTopCenter, statusAreaTopCenter);

    delete bitmapDevice;
    bitmapDevice = NULL;
    delete bitmapGc;
    bitmapGc = NULL;

    aAppInfo.iIconStatus = true;
    Besides, the icon I try to modify is application's shoutcut icon retrieved by
    AknsUtils::CreateAppIconLC(MAknsSkinInstance *aInstance, TUid aAppUid, TAknsAppIconType aType, CFbsBitmap *&aBitmap, CFbsBitmap *&aMask)
    thus, they are mostly SVG based scalable graphics icon. Is there anything wrong to do with it?

  5. #5
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: Anyway to customize the icon drawing method in "CAknSingleGraphicStyleListBox"?

    I would have opted the approach mentioned by stenlik, I would have a class derived from Item drawer and draw the icons of my size based on condition or set new icons to listbox based on conditions.
    Regards,
    Sriky

Similar Threads

  1. Window always at front and icon transparency problem
    By VilluNikolaiV in forum Symbian User Interface
    Replies: 4
    Last Post: 2008-09-23, 04:38
  2. Context pane icon not visible sometimes.
    By AgaMichalik in forum Symbian User Interface
    Replies: 0
    Last Post: 2008-05-27, 14:36
  3. Application icon does not show on phone
    By hduplessis in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-04-04, 13:56
  4. HOW TO CHAGE DEFAULT FOLDER ICON TO OTHER OUR REQUIRED ICON IN MENU SCREEN???
    By chaudhari_hanuman in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-08-14, 13:11
  5. Icon in column listbox does not appear
    By khanming in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-06-26, 12:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •