idlehomescreen/examples/mcsexample/inc/MCSExampleAppView.h
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
child 103 966d119a7e67
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __MCSEXAMPLEAPPVIEW_h__
       
    19 #define __MCSEXAMPLEAPPVIEW_h__
       
    20 
       
    21 // INCLUDES
       
    22 #include <coecntrl.h>
       
    23 #include <aknform.h>
       
    24 #include <gulicon.h>
       
    25 #include <aknlists.h>
       
    26 #include <eiklbo.h> // MEikListBoxObserver
       
    27 #include <mcsmenu.h>
       
    28 
       
    29 class CMCSExampleWatcher;
       
    30 
       
    31 struct TMyData
       
    32     {
       
    33 public:     // data
       
    34     TBuf<256> majorID;
       
    35     TBuf<256> minorID;
       
    36     TBuf<256> iconFile;
       
    37     TBuf<256> iconID;
       
    38     TBuf<256> maskID;
       
    39     TBuf<256> statusIcon;
       
    40     TBool updated;
       
    41     };
       
    42 
       
    43 class CMyForm : public CAknForm
       
    44     {
       
    45 public:     // construction
       
    46     CMyForm( TMyData& aData );
       
    47     virtual ~CMyForm();
       
    48 public:     // from CAknForm
       
    49     //void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane );
       
    50     //void ProcessCommandL( TInt aCommandId );
       
    51     TBool SaveFormDataL();
       
    52     void DoNotSaveFormDataL();
       
    53     //void AddItemL() ;
       
    54     void PreLayoutDynInitL();
       
    55     //MEikDialogPageObserver::TFormControlTypes
       
    56     //    ConvertCustomControlTypeToBaseControlType( TInt aControlType ) const;
       
    57 protected:
       
    58     TBool OkToExitL( TInt aButtonId );
       
    59     
       
    60 private:
       
    61     void LoadFormDataL();
       
    62 private:    // data
       
    63     TMyData& iData;
       
    64     };
       
    65 
       
    66 
       
    67 
       
    68 // CLASS DECLARATION
       
    69 class CMCSExampleAppView : public CCoeControl, public MEikListBoxObserver
       
    70     {
       
    71 public:
       
    72     // New methods
       
    73 
       
    74     /**
       
    75      * NewL.
       
    76      * Two-phased constructor.
       
    77      * Create a CMCSExampleAppView object, which will draw itself to aRect.
       
    78      * @param aRect The rectangle this view will be drawn to.
       
    79      * @return a pointer to the created instance of CMCSExampleAppView.
       
    80      */
       
    81     static CMCSExampleAppView* NewL(const TRect& aRect);
       
    82 
       
    83     /**
       
    84      * NewLC.
       
    85      * Two-phased constructor.
       
    86      * Create a CMCSExampleAppView object, which will draw itself
       
    87      * to aRect.
       
    88      * @param aRect Rectangle this view will be drawn to.
       
    89      * @return A pointer to the created instance of CMCSExampleAppView.
       
    90      */
       
    91     static CMCSExampleAppView* NewLC(const TRect& aRect);
       
    92 
       
    93     /**
       
    94      * ~CMCSExampleAppView
       
    95      * Virtual Destructor.
       
    96      */
       
    97     virtual ~CMCSExampleAppView();
       
    98 
       
    99     void ListAllItemsL();
       
   100     
       
   101 public:
       
   102     // Functions from base classes
       
   103 
       
   104     /**
       
   105      * From CCoeControl, Draw
       
   106      * Draw this CMCSExampleAppView to the screen.
       
   107      * @param aRect the rectangle of this view that needs updating
       
   108      */
       
   109     void Draw(const TRect& aRect) const;
       
   110 
       
   111     /**
       
   112      * From CoeControl, SizeChanged.
       
   113      * Called by framework when the view size is changed.
       
   114      */
       
   115     virtual void SizeChanged();
       
   116 
       
   117     /**
       
   118      * From CoeControl, HandlePointerEventL.
       
   119      * Called by framework when a pointer touch event occurs.
       
   120      * Note: although this method is compatible with earlier SDKs, 
       
   121      * it will not be called in SDKs without Touch support.
       
   122      * @param aPointerEvent the information about this event
       
   123      */
       
   124     virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
       
   125     
       
   126     CCoeControl* ComponentControl( TInt aIndex) const;
       
   127     
       
   128     TInt CountComponentControls() const;
       
   129     
       
   130     void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
       
   131 
       
   132 private:
       
   133     // Constructors
       
   134 
       
   135     /**
       
   136      * ConstructL
       
   137      * 2nd phase constructor.
       
   138      * Perform the second phase construction of a
       
   139      * CMCSExampleAppView object.
       
   140      * @param aRect The rectangle this view will be drawn to.
       
   141      */
       
   142     void ConstructL(const TRect& aRect);
       
   143 
       
   144     /**
       
   145      * CMCSExampleAppView.
       
   146      * C++ default constructor.
       
   147      */
       
   148     CMCSExampleAppView();
       
   149     
       
   150     CDesCArray* GetArrayL(CArrayPtr<CGulIcon>* aIcons);
       
   151     void MakeListBoxL(void);
       
   152     void UpdateScrollBar(CEikListBox* aListBox);
       
   153     void ShowFormL( TInt aItemIndex);
       
   154     
       
   155     RMenu iMCSMenu;
       
   156     CAknSingleLargeStyleListBox* iListBox;
       
   157     RArray<TMenuItem> iItemArray;
       
   158     /** MCS asynchronous operation watcher, owned */
       
   159     CMCSExampleWatcher* iWatcher;
       
   160     };
       
   161 
       
   162 #endif // __MCSEXAMPLEAPPVIEW_h__
       
   163 // End of File