stifui/stifui/inc/ShowStartedCasesContainer.h
branchRCL_3
changeset 14 404ad6c9bc20
parent 13 87e9ebfbe96a
child 18 454d022d514b
equal deleted inserted replaced
13:87e9ebfbe96a 14:404ad6c9bc20
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains CStartedTestsListBoxModel class
       
    15 * declaration.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef CSHOWSTARTEDCASESCONTAINER_H
       
    20 #define CSHOWSTARTEDCASESCONTAINER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "Container.h"
       
    24 
       
    25 #include <coecntrl.h>
       
    26 #include <eiklbo.h>
       
    27 #include <bamdesca.h> // MDesCArray
       
    28 
       
    29 //#include "RRefArray.h" 
       
    30 #include <stifinternal/RRefArray.h>
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CEikTextListBox;
       
    36 class CAknSingleGraphicStyleListBox;
       
    37 class CDesC16ArrayFlat;
       
    38 class CStartedTestCase;
       
    39 class CUIStore;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 class CStartedTestsListBoxModel : public CTestCaseListBoxModel //public CBase, public MDesCArray
       
    44     {
       
    45     public:
       
    46         /**
       
    47         * Destructor.
       
    48         */
       
    49         ~CStartedTestsListBoxModel();
       
    50         
       
    51         /**
       
    52         * Two-phased constructor.
       
    53         * @param aTestsInView Array of test cases in view.
       
    54         * @return Pointer to created list box model.
       
    55         */
       
    56         static CStartedTestsListBoxModel* NewL(
       
    57                             RRefArray<CStartedTestCase>* aTestsInView);
       
    58 
       
    59     public: // Functions from base classes
       
    60         
       
    61         /**
       
    62         * Returns the number of descriptor elements in the array.
       
    63         * @return The number of descriptor elements.
       
    64         */
       
    65         TInt MdcaCount() const;
       
    66         
       
    67         /**
       
    68         * Indexes into a descriptor array.
       
    69         * @param aIndex The position of the descriptor element within the
       
    70         *               array. The position is relative to zero; i.e. zero
       
    71         *               implies the first descriptor element in the array. 
       
    72         *               This value must be non-negative and less than the 
       
    73         *               number of descriptors currently within the array 
       
    74         *               otherwise the operator panics with 
       
    75         *               EArrayIndexOutOfRange. 
       
    76         * @return A non-modifiable pointer descriptor representing the 
       
    77         *         descriptor element located at position aIndex within 
       
    78         *         the array.
       
    79         */
       
    80         TPtrC MdcaPoint(TInt aIndex) const;
       
    81 
       
    82     private:
       
    83 
       
    84         /**
       
    85         * Symbian OS two phased constructor.
       
    86         * Completes the construction of the object.
       
    87         */
       
    88         void ConstructL();
       
    89 
       
    90     private: //data
       
    91         RRefArray<CStartedTestCase>*        iTestCasesInView;
       
    92     };
       
    93 
       
    94 /**
       
    95 *  CShowStartedCasesContainer  container control class.
       
    96 *  
       
    97 */
       
    98 class CShowStartedCasesContainer : public CContainer //public CCoeControl /*, MEikListBoxObserver */ /* MCoeControlObserver */
       
    99     {
       
   100     public: // Constructors and destructor
       
   101         
       
   102         /**
       
   103         * Symbian OS default constructor.
       
   104         * @param aRect Frame rectangle for container.
       
   105         * @return Observer for list box.
       
   106         */
       
   107         void ConstructL(const TRect& aRect, MEikListBoxObserver* aListBoxObserver);
       
   108 
       
   109         /**
       
   110         * Destructor.
       
   111         */
       
   112         ~CShowStartedCasesContainer();
       
   113 
       
   114     public: // New functions
       
   115         
       
   116         /**
       
   117         * Show only testcases which are defined is specified module.
       
   118         * @param aModuleName Module which test cases are shown.
       
   119         */
       
   120         void FilterCasesByModuleL(TName aModuleName);
       
   121         
       
   122         /**
       
   123         * Show only testcases which are defined in specified test case file.
       
   124         * @param aTestCaseFileName Test cases file name.
       
   125         */
       
   126         void FilterCasesByTCFileNameL(TFileName aTestCaseFileName);
       
   127         
       
   128         /**
       
   129         * Remove possible filtering of test cases -> show all test cases.
       
   130         */
       
   131         void NoFilteringL();
       
   132         
       
   133         /**
       
   134         * Returns reference to currently selected test case in view (listbox).
       
   135         * @return Currently selected test case.
       
   136         */
       
   137         CStartedTestCase* SelectedTestCase();
       
   138         
       
   139         /**
       
   140         * Constructs list box model without any filtering.
       
   141         */
       
   142         void ConstructListBoxModelL();
       
   143         
       
   144         /**
       
   145         * Draws the list box.
       
   146         */
       
   147         void DrawListBox();
       
   148         
       
   149         /**
       
   150         * Returns count of test cases in view.
       
   151         * @return Count of test cases in view.
       
   152         */
       
   153         TInt TestsInViewCount();
       
   154         
       
   155         /**
       
   156         * Handles the addition of an item to the model.
       
   157         */
       
   158         void HandleItemAdditionL();
       
   159         
       
   160         /**
       
   161         * Handles the removal of an item from the model.
       
   162         */
       
   163         void HandleItemRemovalL();
       
   164         
       
   165         /**
       
   166         * Returns pointer to currently selected test case.
       
   167         * @param Current test case.
       
   168         */
       
   169         CStartedTestCase* CurrentTestCase();
       
   170         
       
   171         /**
       
   172         * Sets the current item.
       
   173         * @param aIndex Index of the item to make current.
       
   174         */
       
   175         void SetCurrentItemIndex(TInt aIndex);
       
   176         
       
   177         /**
       
   178         * Resets the selection indices, top and current item indices,
       
   179         * the selection, and the horizontal scroll offset of this list box.
       
   180         * This function does not redraw the list box.
       
   181         */
       
   182         void ResetListBox();
       
   183         
       
   184         /**
       
   185         * Removes items from list box.
       
   186         */
       
   187         void RemoveSelectedExecutionsL();
       
   188         
       
   189         /**
       
   190         * Removes all started test cases from list box.
       
   191         */
       
   192         void RemoveAllExecutionsInViewL();
       
   193         
       
   194         /**
       
   195          * Stores current position of focus of iListBox to the CAppUiAppUi object
       
   196          */
       
   197         void SaveActiveLine();
       
   198 
       
   199     private: // New functions
       
   200 
       
   201     public: // Functions from base classes
       
   202 
       
   203     private: // Functions from base classes
       
   204 
       
   205         /**
       
   206         * From CoeControl,SizeChanged.
       
   207         * Called by framework when the view size is changed.
       
   208         */
       
   209         void SizeChanged();
       
   210 
       
   211         /**
       
   212         * From CoeControl,CountComponentControls.
       
   213         * Gets a count of the component controls of this list box control.
       
   214         * This information is used for DrawNow().
       
   215         */
       
   216         TInt CountComponentControls() const;
       
   217 
       
   218         /**
       
   219         * From CCoeControl,ComponentControl.
       
   220         * Gets a pointer to the specified component control.
       
   221         * @param aIndex Index of the component control to look up.
       
   222         * @return The control at aIndex.
       
   223         */
       
   224         CCoeControl* ComponentControl(TInt aIndex) const;
       
   225 
       
   226         /**
       
   227         * From CCoeControl,Draw.
       
   228         * Draw a control, called by window server.
       
   229         * @param aRect The region of the control to be redrawn. Co-ordinates
       
   230         *              are relative to the control's origin (top left corner).
       
   231         */
       
   232         void Draw(const TRect& aRect) const;
       
   233 
       
   234         /**
       
   235         * From CCoeControl,OfferKeyEventL
       
   236         * Handles key events.
       
   237         * @param aKeyEvent The key event.
       
   238         * @param aType The type of key event.
       
   239         * @return Indicates whether or not the key event was used 
       
   240         *         by this control.
       
   241         */
       
   242 		TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
       
   243 	
       
   244     private: //data
       
   245         
       
   246         CStartedTestsListBoxModel*  iListBoxModel;    
       
   247         RRefArray<CStartedTestCase> iStartedTestsPtrs;
       
   248     };
       
   249 
       
   250 #endif // CSHOWSTARTEDCASESCONTAINER_H
       
   251 
       
   252 // End of File