×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jun 2008
    Posts
    55

    show two icons for enable and disabled the app respectively

    Hi friends,

    I have two icons in svg format in my applications gfx folder,
    i have to display one icon when my app is enabled and if my app is disabled then i have to display 2nd one.
    i am using following code for display the icon on the phone

    #include <akncontext.h>
    #include <fbs.h>
    #include <eikenv.h>

    #include <avkon.mbg>
    #include <akniconutils.h>
    #include "IndicatorIcon.h"

    // CONSTANTS
    const TInt KIndicatorPosX = 175;
    const TInt KIndicatorPosY = 6;

    _LIT(KSysIconFile, "\\resource\\apps\\SwiftnetDialer_0xE5740320.mif");

    // ================= MEMBER FUNCTIONS =======================

    // ----------------------------------------------------------------------------
    // CIndicatorIcon::NewL()
    // Two-phased constructor.
    // ----------------------------------------------------------------------------
    //
    CIndicatorIcon* CIndicatorIcon::NewL()
    {
    CIndicatorIcon* self = CIndicatorIcon::NewLC();
    CleanupStack::Pop(self);
    return self;
    }

    // ----------------------------------------------------------------------------
    // CIndicatorIcon::NewLC()
    // Two-phased constructor.
    // ----------------------------------------------------------------------------
    //
    CIndicatorIcon* CIndicatorIcon::NewLC()
    {
    CIndicatorIcon* self = new (ELeave) CIndicatorIcon();
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

    // ----------------------------------------------------------
    // CIndicatorIcon::CIndicatorIcon()
    //
    // C++ default constructor can NOT contain any code, that
    // might leave.
    // ----------------------------------------------------------
    //
    CIndicatorIcon::CIndicatorIcon()
    {
    }

    // ----------------------------------------------------------
    // CIndicatorIcon::ConstructL(const TRect& aRect)
    //
    // EPOC default constructor can leave.
    // ----------------------------------------------------------
    //
    void CIndicatorIcon::ConstructL()
    {
    iWs.Connect();
    iMyWindowGroup = RWindowGroup(iCoeEnv->WsSession());
    User::LeaveIfError(iMyWindowGroup.Construct((TUint32)&iMyWindowGroup));

    iMyWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
    // iMyWindowGroup.SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront);

    iMyWindowGroup.EnableReceiptOfFocus(EFalse);
    iMyWindowGroup.EnableFocusChangeEvents();
    iMyWindowGroup.EnableGroupChangeEvents();
    CreateWindowL(&iMyWindowGroup);

    // by default setting the indicator icon to inactive
    SetIndicatorIconL();



    ActivateL();



    }

    // ----------------------------------------------------------
    // CIndicatorIcon::~CIndicatorIcon()
    //
    // Destructor
    // ----------------------------------------------------------
    //
    CIndicatorIcon::~CIndicatorIcon()
    {
    if (iIndicator)
    {
    delete iIndicator;
    iIndicator = NULL;
    } // if (iIndicator)

    if (iIndicatorMask)
    {
    delete iIndicatorMask;
    iIndicatorMask = NULL;
    } // if (iIndicatorMask)

    iMyWindowGroup.Close();
    }

    // ---------------------------------------------------------
    // CIndicatorIcon::SetIndicatorIconL(TInt aIconType)
    //
    // Set the indicator icon.
    // ---------------------------------------------------------
    //
    void CIndicatorIcon::SetIndicatorIconL()
    {


    // TBuf<200> iAppPath;
    // iAppPath.Copy(_L("C:\\Data\\Images\\temp.mif"));//z\resource\apps
    // TFileName filename(iAppPath);

    //CFbsBitmap* filename=iEngine->iVPlayer->GetBmp();
    AknIconUtils::CreateIconL(iIndicator, iIndicatorMask, KSysIconFile,
    16384,16385);

    // Set size for the bitmap and mask
    AknIconUtils::SetSize(iIndicator, TSize(10,10));
    AknIconUtils::SetSize(iIndicatorMask, TSize(10,10));

    // AknIconUtils::CreateIconL( iBitmap,iIndicator,filename, 16384,16385);
    // TSize iconSize(100,22);
    // TInt err = AknIconUtils::SetSize(iBitmap,iconSize);
    // err = AknIconUtils::SetSize(iMask,iconSize);
    // /*switch(aIndicatorIconType)
    // {
    // case EIndicatorIconEmpty:
    // iIndicator = CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_prop_empty);
    // iIndicatorMask = CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_prop_empty_mask);
    // break;
    //
    // case EIndicatorIconAppActive:
    // iIndicator = CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_bt_connect_on);
    // iIndicatorMask = CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_bt_connect_on_mask);
    CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_prop_bt_audio);
    // iIndicatorMask = CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_prop_bt_audio_mask);
    CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_prop_empty);
    // iIndicatorMask = CEikonEnv::Static()->CreateBitmapL(KSysIconFile, EMbmAvkonQgn_prop_empty_mask);
    SetRect(TRect(TPoint(KIndicatorPosX, KIndicatorPosY),iIndicator->SizeInPixels()));

    // if aRedraw == ETrue just draw the canvas again.
    DrawNow();

    }


    void CIndicatorIcon:raw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();

    gc.Clear();
    gc.SetBrushStyle(CGraphicsContext::ENullBrush);

    gc.BitBltMasked(TPoint(aRect.iTl.iX, aRect.iTl.iY), iIndicator, aRect, iIndicatorMask, ETrue);
    }

    // End of File


    i thought if i write # define in Icons_scalable_dc.mk then it should be work fine ,if i am right then can anyone tell me how i can write the # define in this file,or thete is another way to do the same task

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: show two icons for enable and disabled the app respectively

    what is it that goes wrong with the code ?

    I assume that you are just making your own window and drawing the icon into it, thus changing the icon should be bacially, just changing the index of the bitmap you are reading into it.

Similar Threads

  1. KEYPAD DISABLED w/ APP RUNNING
    By jb2323 in forum Symbian
    Replies: 0
    Last Post: 2003-07-08, 15:43

Posting Permissions

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