phonebookui/Phonebook2/UIControls/inc/MPbk2NamesListState.h
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Phonebook 2 names list state interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MPBK2NAMESLISTSTATE_H
       
    20 #define MPBK2NAMESLISTSTATE_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <MPbk2ContactUiControl.h>
       
    24 #include <MPbk2ContactUiControl2.h>
       
    25 #include <MPbk2PointerEventInspector.h>
       
    26 #include "cpbk2filteredviewstack.h"
       
    27 #include <w32std.h>
       
    28 #include <coedef.h>
       
    29 #include <coecobs.h>
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CCoeControl;
       
    33 class CWindowGc;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38  * Interface for names list control states.
       
    39  */
       
    40 class MPbk2NamesListState :
       
    41         public MPbk2ContactUiControl,
       
    42         public MPbk2ContactUiControl2,
       
    43         public MPbk2PointerEventInspector,
       
    44         public MPbk2FilteredViewStackObserver
       
    45     {
       
    46     public: // Interface
       
    47         /**
       
    48          * Destructor.
       
    49          */
       
    50         virtual ~MPbk2NamesListState() { }
       
    51 
       
    52         /**
       
    53          * Performs the operations required when the state is
       
    54          * being activated.
       
    55          */
       
    56         virtual void ActivateStateL() = 0;
       
    57 
       
    58         /**
       
    59          * Performs the operations required when the state is
       
    60          * being deactivated.
       
    61          */
       
    62         virtual void DeactivateState() = 0;
       
    63 
       
    64         /**
       
    65          * Returns the number of component controls of the state.
       
    66          *
       
    67          * @see CCoeControl::CountComponentControls()
       
    68          * @return  Number of component controls.
       
    69          */
       
    70         virtual TInt CountComponentControls() const = 0;
       
    71 
       
    72         /**
       
    73          * Returns the control at given index.
       
    74          *
       
    75          * @see CCoeControl::ComponentControl()
       
    76          * @param aIndex    The index to inspect.
       
    77          * @return  Control at given index.
       
    78          */
       
    79         virtual CCoeControl* ComponentControl( TInt aIndex ) const = 0;
       
    80 
       
    81         /**
       
    82          * Handles size changed events.
       
    83          *
       
    84          * @see CCoeControl::SizeChanged()
       
    85          */
       
    86         virtual void SizeChanged() = 0;
       
    87 
       
    88         /**
       
    89          * Makes the components visible/invisible.
       
    90          *
       
    91          * @param aVisible  ETrue if components are to be shown,
       
    92          *                  EFalse otherwise.
       
    93          */
       
    94         virtual void MakeComponentsVisible( TBool aVisible ) = 0;
       
    95 
       
    96         /**
       
    97          * @see CCoeControl::ActivateL
       
    98          */
       
    99         virtual void ActivateL() = 0;
       
   100 
       
   101         /**
       
   102          * @see CCoeControl::Draw
       
   103          */
       
   104         virtual void Draw( const TRect& aRect, CWindowGc& aGc ) const = 0;
       
   105 
       
   106         /**
       
   107          * @see CCoeControl::OfferKeyEventL
       
   108          */
       
   109         virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
       
   110                 TEventCode aType ) = 0;
       
   111 
       
   112         /**
       
   113          * @see CCoeControl::HandlePointerEventL
       
   114          */
       
   115         virtual void HandlePointerEventL(
       
   116                 const TPointerEvent& aPointerEvent ) = 0;
       
   117 
       
   118         /**
       
   119          * Returns the type of the state.
       
   120          *
       
   121          * @see TPbk2NamesListState
       
   122          * @return  A state enumeration.
       
   123          */
       
   124         virtual TInt NamesListState() const = 0;
       
   125 
       
   126         /**
       
   127          * Handles contact view event.
       
   128          *
       
   129          * @see TPbk2StateUpdateEvent
       
   130          * @param aEvent    Indicates what event took place.
       
   131          * @param aIndex    Index of the view contact, where the
       
   132          *                  event took place.
       
   133          */
       
   134         virtual void HandleContactViewEventL( TInt aEvent, TInt aIndex ) = 0;
       
   135 
       
   136         /**
       
   137          * Returns the CCoeControl instance.
       
   138          *
       
   139          * @return  CCoeControl instance of this control.
       
   140          */
       
   141         virtual CCoeControl& CoeControl() = 0;
       
   142 
       
   143         /**
       
   144          * For forwarding control events to state. States
       
   145          * shouldn't be MCoeControlObservers themselves.
       
   146          *
       
   147          * @see MCoeControlObserver::HandleControlEventL
       
   148          * @param aParam used to pass special parameters.
       
   149          */
       
   150         virtual void HandleControlEventL( CCoeControl* aControl,
       
   151             MCoeControlObserver::TCoeEvent aEventType, TInt aParam ) = 0;
       
   152 
       
   153         /**
       
   154          * Return the top contact in the names list or NULL
       
   155          *
       
   156          * @return The top contact in the names list or NULL
       
   157          */
       
   158         virtual const MVPbkViewContact* TopContactL() = 0;
       
   159 
       
   160         /**
       
   161          * Implements handling of command item addition & removal
       
   162          * in state objects. The state object needs to inform
       
   163          * listbox accordingly & take actions on focus etc.
       
   164          *
       
   165          * @param aEvent: Refer to TPbk2StateUpdateEvent
       
   166          * @param aCmdIndex: The command item index to be added/removed
       
   167          */           
       
   168         virtual void HandleCommandEventL(TInt aEvent, TInt aCmdIndex) = 0;
       
   169 
       
   170     public: // Types
       
   171         /// The state update events we are interested in.
       
   172         enum TPbk2StateUpdateEvent
       
   173             {
       
   174             /// Item added
       
   175             EItemAdded = 0,
       
   176             /// Item removed
       
   177             EItemRemoved,
       
   178             /// Sort order changed
       
   179             ESortOrderChanged,
       
   180             // Called when contact view is updated. 
       
   181             EContactViewUpdated
       
   182             };
       
   183     };
       
   184 
       
   185 #endif // MPBK2NAMESLISTSTATE_H
       
   186 
       
   187 // End of File