⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shoppinglistappview.h

📁 Symbian 的购物程序 shoppinglist-vc
💻 H
字号:
/*  Copyright (c) 2004, Nokia. All rights reserved */

#ifndef __SHOPPINGLIST_APPVIEW_H__
#define __SHOPPINGLIST_APPVIEW_H__

// INCLUDES
#include <aknlists.h>
#include <coecntrl.h>

// CONSTANTS
const TInt KGranularityOfArray = 10;
_LIT( KTab,"\t" );
_LIT( KMark,"|\t" );

// FORWARD DECLARATIONS
class CShoppingListDocument;
class CShoppingItem;

// CLASS DECLARATION

/** 
* CShoppingListAppView
* An instance of CShoppingListAppView is the Application View object
*  for the ShoppingList example application
*/
class CShoppingListAppView : public CCoeControl
    {
    public:

        /**
        * NewL
        * Create a CShoppingListAppView object, which will draw itself to aRect
        * @param aRect The rectangle this view will be drawn to
        * @param aDocument The application document that the view is of.
        * @return A pointer to the created instance of CShoppingListAppView
        */
        static CShoppingListAppView* NewL( const TRect& aRect, 
                                            CShoppingListDocument* aDocument );

        /**
        * NewLC
        * Create a CShoppingListAppView object, which will draw itself to aRect
        * @param aRect The rectangle this view will be drawn to.
        * @param aDocument The application document that the veiew is of.
        * @return A pointer to the created instance of CShoppingListAppView
        */
        static CShoppingListAppView* NewLC( const TRect& aRect, 
                                            CShoppingListDocument* aDocument );

        /**
        * ~CShoppingListAppView
        * Destroy the object
        */
        virtual ~CShoppingListAppView();

        /**
        * UpdateL
        * Update this view so that it corresponds to the Document
        */
        void UpdateL();

        /**
        * ListBox
        * Get the ListBox that is displaying the shopping list
        * @return the ListBox that is displaying the shopping list
        */
        CAknSingleStyleListBox* ListBox();

        /**
        * CurrentItemIndex
        * Return the index number of the current item in the view.
        * @return the index number of the current item in the view.
        */
        TInt CurrentItemIndex() const;

        /**
        * SetCurrentItemIndex
        * Set the current item in the view to aIndex.
        * @param aIndex the index of the item to be set as the current item
        */
        void SetCurrentItemIndex( TInt aIndex );

        /**
        * PrependLC
        * Create a new HBufC string by prepending aString1 to aString2
        * @param aString1 the first string
        * @param aString2 the second string
        * @return a new HBufC string comprising aString1 prepended to aString2
        */
        HBufC* PrependLC( const TDesC& aString1, TDesC& aString2 );

    public:  // from CCoeControl

        /**
        * Draw
        * Draw this CShoppingListAppView to the screen
        * @param aRect The rectangle of this view that needs updating
        */
        void Draw( const TRect& aRect ) const;

        /**
        * OfferKeyEventL
        * Handle key events.
        * @param aKeyEvent The key event.
        * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown.
        * @return Was the key event used by this control.
        */
        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );

        /**
        * CountComponentControls
        * Get the number of controls contained in a compound control.
        * @return The number of component controls contained by this control.
        */
        TInt CountComponentControls() const;

        /**
        * ComponentControl
        * Get the specified component of a compound control.
        * @param aIndex the index of the control to return.
        * @return The component control with an index of aIndex.
        */
        CCoeControl* ComponentControl( TInt aIndex ) const;

    private:

        /**
        * ConstructL
        * Perform the second phase construction of a CShoppingListAppView object
        * @param aRect The rectangle this view will be drawn to
        */
        void ConstructL( const TRect& aRect );

        /**
        * CShoppingListAppView
        * Perform the first phase of two phase construction
        * @param aDocument The document containing the list of shopping items
        */
        CShoppingListAppView( CShoppingListDocument* aDocument );

    private:

        /**
        * iDocument the document containing the list of shopping items 
        * Does not own
        */
        CShoppingListDocument* const iDocument;

        /**
        * iListBox the ListBox displaying the shopping list
        * Owned by CShoppingListAppView object.
        */ 
        CAknSingleStyleListBox* iListBox;

        /**
        * iListBoxRows the contents of the ListBox
        * Owned by CShoppingListAppView object.
        */
        CDesCArrayFlat* iListBoxRows;
    };

#endif // __SHOPPINGLIST_APPVIEW_H__

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -