userdict/inc/UdictContainer.h
branchRCL_3
changeset 13 261ff9819be3
parent 0 9a3a17bfeb67
equal deleted inserted replaced
12:e9f0e1110077 13:261ff9819be3
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:     Japanese user dictionary View container control. It contains
       
    15 *                a single style list box to show the registered words.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef UDICTCONTAINER_H
       
    25 #define UDICTCONTAINER_H
       
    26 
       
    27 //  INCLUDES
       
    28 #include <coecntrl.h>
       
    29 #include <AknWaitNoteWrapper.h> 
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CAknSingleStyleListBox;
       
    33 class CEikListBox;
       
    34 class CGulIcon;
       
    35 class CAknView;
       
    36 class CUserDictModel;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 /**
       
    40 *  Japanese user dictionary Container class.
       
    41 *  It contains a single style list box to show the registered words.
       
    42 *  CUserDictView controls this class.
       
    43 *  @since 2.6
       
    44 */
       
    45 class CUserDictContainer : public CCoeControl, public MAknBackgroundProcess
       
    46     {
       
    47     public:  // Constructors and destructor
       
    48       
       
    49         /**
       
    50         * C++ default constructor.
       
    51         * @param aModel
       
    52         * @param aView
       
    53         */
       
    54         CUserDictContainer(CUserDictModel& aModel, CAknView& aView);
       
    55 
       
    56         /**
       
    57         * 2nd phase constructor.
       
    58         */
       
    59         void ConstructL();
       
    60         
       
    61         /**
       
    62         * Destructor.
       
    63         */
       
    64         virtual ~CUserDictContainer();
       
    65 
       
    66     public: // New functions
       
    67 
       
    68         /**
       
    69         * It sets the focus to the item which is located at aIndex and redraws 
       
    70         * the Listbox.
       
    71         * @param aIndex is set to the Listbox's current item. 
       
    72         */
       
    73         void SetFocusL(TInt aIndex) const;
       
    74 
       
    75         /**
       
    76         * Deletes the selected items in the Listbox.
       
    77         * If the Listbox has marked items, it deletes the all marked items.
       
    78         * If it doesn't have any marked item, it deletes the focused item.  
       
    79         */
       
    80         void DeleteItemL();
       
    81 
       
    82         /**
       
    83         * Gets the Listbox object.
       
    84         * @return the Listbox object.
       
    85         */
       
    86         inline CEikListBox* ListBox() const;
       
    87  
       
    88     private:  // New functions
       
    89 
       
    90         /**
       
    91         * Sets a marking icon array to the Listbox.
       
    92         */
       
    93         void SetGraphicIconL();
       
    94 
       
    95         /**
       
    96         * It shows a Wait Note during deleting the marked items.
       
    97         */
       
    98         void ShowWaitNoteL();
       
    99 
       
   100         /**
       
   101         * Creates the icon and adds it to the array if it was successful
       
   102         *  @since 2.8
       
   103         */
       
   104         void CUserDictContainer::CreateIconAndAddToArrayL(
       
   105                                     CArrayPtr<CGulIcon>*& aIconsArray,
       
   106                                     const TDesC& aIconFile,
       
   107                                     TInt aBitmap, TInt aMask = -1);
       
   108 
       
   109 
       
   110     private:  // Functions from base classes
       
   111 
       
   112         /**
       
   113         * From CCoeControl
       
   114         * Handles size changed.
       
   115         */
       
   116         void SizeChanged();
       
   117 
       
   118         /**
       
   119         * From CCoeControl
       
   120         * Gets a number of the component controls.
       
   121         * @return a number of the component control.
       
   122         */
       
   123         TInt CountComponentControls() const;
       
   124 
       
   125         /**
       
   126         * From CCoeControl
       
   127         * Gets the component control.
       
   128         * @param aIndex is index of the component control
       
   129         * @return the component control
       
   130         */
       
   131         CCoeControl* ComponentControl(TInt aIndex) const;
       
   132 
       
   133         /**
       
   134         * From CCoeControl
       
   135         * Handles key events.
       
   136         * @param aKeyEvent
       
   137         * @param aType
       
   138         * @return EKeyWasConsumed, when it handles the event. 
       
   139         */
       
   140         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
       
   141                                     TEventCode aType);
       
   142           
       
   143         /**
       
   144         * From CCoeContro, gets help context.
       
   145         * @param aContext
       
   146         */ 
       
   147         void GetHelpContext(TCoeHelpContext& aContext) const;
       
   148         
       
   149         /**
       
   150         * From MAknBackgroundProcess,
       
   151         * It has the actual process in the wait note's loop.
       
   152         * It deletes the selected words by descending order of list index.
       
   153         * This function is called repeatedly until all selected words are
       
   154         * deleted.
       
   155         */
       
   156         void StepL();
       
   157         
       
   158         /**
       
   159         * From MAknBackgroundProcess, tests whether Wait Note process is done.
       
   160         * When iWaitNoteCounter is under zero, it finishes the process.
       
   161         * @return ETrue, when the process is done.
       
   162         */
       
   163         TBool IsProcessDone() const;
       
   164 
       
   165     private:    // Data 
       
   166 
       
   167         // The ListBox showing registered words 
       
   168         CAknSingleStyleListBox* iListBox; // own
       
   169         
       
   170         // Japanese user dictionary Model
       
   171         CUserDictModel& iModel;
       
   172 
       
   173         // View, the controller of this class
       
   174         CAknView& iView;
       
   175 
       
   176         // The counter for the Wait Note process.
       
   177         // It's used for count of deleting words
       
   178         TInt iWaitNoteCounter;
       
   179       
       
   180     };
       
   181 
       
   182 #endif      // UDICTCONTAINER_H   
       
   183             
       
   184 // End of File