×

Discussion Board

Results 1 to 7 of 7
  1. #1
    chishti.hameed
    Guest

    problem with: icons->AppendL(iEikonEnv->CreateIconL(........)

    PLZ help me . i dont understand why only ONE icon is displayed instead of different icons as i'm trying to do here:
    ---------------------------------------------------------------------------------
    RSS:

    // ---------------------------------------------------------
    // r_simplegrid_games_grid
    // The games grid
    //
    // ---------------------------------------------------------
    //
    RESOURCE GRID R_SIMPLEGRID_GAMES_GRID
    {
    array_id = r_simplegrid_games_grid_items;
    flags = EAknListBoxSelectionGrid;
    style=r_simplegrid_games_grid_style;
    }

    // ---------------------------------------------------------
    // r_simplegrid_games_grid_items
    // The games grid items
    //
    // ---------------------------------------------------------
    //
    RESOURCE ARRAY r_simplegrid_games_grid_items
    {
    items =
    {
    LBUF
    {
    txt = "0\tSnap";
    },
    LBUF
    {
    txt = "0\tSnap";
    },
    LBUF
    {
    txt = "0\tSnap";
    },
    LBUF
    {
    txt = "0\tSnap";
    },
    LBUF
    {
    txt = "0\tSnap";
    },
    LBUF
    {
    txt = "0\tSnap";
    },
    LBUF
    {
    txt = "0\tSnap";
    }

    };
    }
    RESOURCE GRID_STYLE r_simplegrid_games_grid_style
    {
    layoutflags=EAknGridHorizontalOrientation| EAknGridLeftToRight | EAknGridTopToBottom;
    primaryscroll= EAknGridFollowsItemsAndLoops; // horizontal scroll
    secondaryscroll=EAknGridFollowsItemsAndLoops; // vertical scroll
    itemsinprimaryorient=3; // number of items horizontally per screen
    itemsinsecondaryorient=2; // number of items vertically per screen
    gapwidth=5;
    gapheight=5;
    height = 68;
    width = 50;

    }


    // ---------------------------------------------------------
    //
    // Strings used by the application
    //
    // ---------------------------------------------------------
    //
    RESOURCE TBUF r_icon_file_name
    {
    buf = ICON_FILE_NAME;
    }


    ------------------------------------------------------------------------

  2. #2
    chishti.hameed
    Guest

    mmp

    // Creates Mbm file.
    START BITMAP MobileBuddy.mbm
    HEADER
    TARGETPATH \system\apps\MobileBuddy
    SOURCEPATH ..\bitmaps
    SOURCE C12 Snap.bmp
    SOURCE C12 Golf.bmp
    SOURCE C12 Clock.bmp
    SOURCE C12 Card_mask.bmp
    SOURCE C12 Aces.bmp
    SOURCE C12 Hearts.bmp
    SOURCE C12 Rummy.bmp
    SOURCE C12 Poker.bmp
    END

  3. #3
    chishti.hameed
    Guest

    header for grid

    #ifndef MOBILEBUDDYGRID_H
    #define MOBILEBUDDYGRID_H

    // INCLUDES
    #include <akngrid.h> // CAknGrid

    // CLASS DECLARATION

    class CMobileBuddyGrid : public CAknGrid
    {
    public: // Constructors and destructor

    void ConstructL(TInt aGridResource, TInt aIconFileResource);

    private: // from CoeControl

    void SizeChanged();

    private: // members
    void SetupGrid();
    void SetupGridIconsL(TInt aIconFileResource);

    };

    #endif // #ifndef MOBILEBUDDYGRID_H

    // End of File

  4. #4
    chishti.hameed
    Guest

    cpp for grid

    // INCLUDE FILES

    // Class include
    #include "MobileBuddyGrid.h"

    // System includes
    #include <akniconarray.h> // CAknIconArray
    #include <aknlists.h> // AknListBoxLayouts
    #include <barsread.h> // TResourceReader
    #include <mobilebuddy.mbg> // contains icon enumeration
    #include <stringloader.h> // StringLoader

    // CONSTANTS
    const TInt KNumberOfIcons(7);
    const TInt KGraphicsHeight = 50;
    const TInt KTextColor = 215;


    void CMobileBuddyGrid::ConstructL(TInt aGridResource, TInt aIconFileResource)
    {
    // Construct the grid from resource
    TResourceReader reader;
    CEikonEnv::Static()->CreateResourceReaderLC(reader, aGridResource);
    ConstructFromResourceL(reader);
    CleanupStack::PopAndDestroy(); // reader

    // Set up the icons
    SetupGridIconsL (aIconFileResource);

    // Draw the grid
    SizeChanged();
    }
    void CMobileBuddyGrid::SetupGridIconsL(TInt aIconFileResource)
    {
    // Get the name of the file containing the icons
    HBufC* iconFileName;
    iconFileName = StringLoader::LoadLC(aIconFileResource); // Pushes iconFileName onto the Cleanup Stack.

    // Create an array of icons, reading them from the file
    CArrayPtr<CGulIcon>* icons = new(ELeave) CAknIconArray(KNumberOfIcons);
    CleanupStack::PushL(icons);
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddySnap, EMbmMobilebuddyCard_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddyGolf, EMbmMobilebuddyCard_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddyClock, EMbmMobilebuddyCard_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddyAces, EMbmMobilebuddyCard_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddyHearts, EMbmMobilebuddyCard_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddyRummy, EMbmMobilebuddyCard_mask));
    icons->AppendL(iEikonEnv->CreateIconL(*iconFileName, EMbmMobilebuddyPoker, EMbmMobilebuddyCard_mask));
    CleanupStack::Pop(icons);
    CleanupStack::PopAndDestroy(iconFileName);

    ItemDrawer()->FormattedCellData()->SetIconArray(icons); // passing ownership of icons

    }




    void CMobileBuddyGrid::SetupGrid()
    {

    // Setup text foreground and background colours to default
    AknListBoxLayouts::SetupStandardGrid(*this);


    // Get local copies of data we will need
    CFormattedCellListBoxItemDrawer* itemDrawer = this->ItemDrawer();
    TInt cellWidth = ColumnWidth();
    TInt cellHeight = ItemHeight();


    // Set up graphics subcells
    AknListBoxLayouts::SetupFormGfxCell(*this, //the grid
    itemDrawer, // the grid's drawer
    0, // index of the graphic within item strings
    0, // left position
    0, // top position
    0, // right - unused
    0, // bottom - unused
    cellWidth, // width of graphic
    KGraphicsHeight, // height of graphic
    TPoint (0, 0), // start position
    TPoint (cellWidth , KGraphicsHeight)); // end position

    // Set up text subcells
    const CFont* KFont = LatinBold12();
    TInt baseline = cellHeight - KFont->DescentInPixels() - 1;

    AknListBoxLayouts::SetupFormTextCell(*this, // the grid
    itemDrawer, // the grid's drawer
    1, // index of text within item strings
    KFont, // the font for the text
    KTextColor, // the color of the text - N.B. although commented out in the header file, this is still used!
    0, // left margin
    0, // right margin - unused
    baseline, // Baseline
    cellWidth, // text width (would need to take margin into account if set, i.e. - lm)
    CGraphicsContext::ECenter, // Alignment
    TPoint (0, KGraphicsHeight), // start position
    TPoint(cellWidth, cellHeight)); // end position

    }



    void CMobileBuddyGrid::SizeChanged()
    {
    CAknGrid::SizeChanged();
    SetupGrid();
    }

  5. #5
    chishti.hameed
    Guest

    in Appcontainer.cpp

    // INCLUDE FILES
    #include "MobileBuddyContainer.h"

    // System includes
    #include <MobileBuddy.rsg>

    // User includes
    #include "MobileBuddyGrid.h"

    // CONSTANTS

    // #defined as DLL cannot contain writable static data
    #define KGridPosition TPoint(0,0)


    void CMobileBuddyContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    // Construct the grid
    iMobileGrid = new (ELeave)CMobileBuddyGrid;
    iMobileGrid->SetContainerWindowL(*this);
    iMobileGrid->ConstructL(R_SIMPLEGRID_GAMES_GRID, R_ICON_FILE_NAME);

    // Observe the grid
    iMobileGrid->SetListBoxObserver(this);


    SetRect(aRect);
    ActivateL();
    }



    void CMobileBuddyContainer::SizeChanged()
    {
    // Do not use MinimumSize() here as it does not work when scrolling
    // through the grid
    if (iMobileGrid)
    {
    iMobileGrid->SetExtent (KGridPosition,Rect().Size());
    }

    }

  6. #6
    chishti.hameed
    Guest

    AppContainer.h

    #ifndef MOBILEBUDDYCONTAINER_H
    #define MOBILEBUDDYCONTAINER_H

    // INCLUDES
    #include <coecntrl.h>
    #include <eiklbo.h> // MEikListBoxObserver

    // FORWARD DECLARATIONS
    class CMobileBuddyGrid;


    // CLASS DECLARATION

    /**
    * CMobileBuddyContainer container control class.
    *
    */
    class CMobileBuddyContainer : public CCoeControl, MEikListBoxObserver
    {
    public: // Constructors and destructor

    static CMobileBuddyContainer* NewL(const TRect& aRect);
    static CMobileBuddyContainer* NewLC(const TRect& aRect);


    /**
    * EPOC default constructor.
    * @param aRect Frame rectangle for container.
    */
    void ConstructL(const TRect& aRect);

    /**
    * Destructor.
    */
    ~CMobileBuddyContainer();

    public: // New functions

    public: // Functions from base classes

    private: // from MEikListBoxObserver

    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aListBoxEvent);

    private: // from CoeControl
    /**
    * From CoeControl,SizeChanged.
    */
    void SizeChanged();

    /**
    * From CoeControl,CountComponentControls.
    */
    TInt CountComponentControls() const;

    /**
    * From CCoeControl,ComponentControl.
    */
    CCoeControl* ComponentControl(TInt aIndex) const;

    /**
    * From CCoeControl,Draw.
    */
    void Draw(const TRect& aRect) const;

    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);


    private: //data
    void StartSelectedApp();

    CMobileBuddyGrid* iMobileGrid; // the games grid

    };

    #endif

    // End of File

  7. #7
    chishti.hameed
    Guest

    icon file name def

    #define ICON_FILE_NAME "\\system\\apps\\mobilebuddy\\MobileBuddy.mbm"

Posting Permissions

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