Search code examples
c++symbianiconss60carbide

Carbide / Symbian C++ - Change Application Icon


I am using Carbide (just upgraded to 2.0) to develop an S60 3rd Edition application.

I would like to know the easiest way to change the icon (both the application icon on the device menu and the icon at the top left of the main view) because I have the need to skin my application in many different ways as easily as possible.

All my efforts with messing around with .mif files have so far failed. I have a 44x44 .svg icon I made with Illustrator, could someone please help me in the right direction?

Thanks!


Solution

  • To change the app icon when you run your app use (in the status bar):

    CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
    CAknContextPane* cp=(CAknContextPane *)sp->ControlL(TUid::Uid(EEikStatusPaneUidContext));
    _LIT(KContextBitMapFile, "my_bitmap_file.mbm");
    CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(KContextBitMapFile, EMbmBitmap);
    CleanupStack::PushL(bitmap);
    CFbsBitmap*  bitmapmask = iEikonEnv->CreateBitmapL(KContextBitMapFile, EMbmBitmapMask);
    CleanupStack::PushL(bitmapmask);
    cp->SetPicture(bitmap, bitmapmask);
    CleanupStack::Pop(); // bitmapmask
    CleanupStack::Pop(); // bitmap
    DrawNow();
    

    I'm not aware of any possibility of changing the app icon in the menu list programmatically, other than reinstalling the app with different mif file.