textinput/peninputcommonctrls/src/peninputdropdownlist/peninputlistonerowwithouticonwithbubble.cpp
branchRCL_3
changeset 44 ecbabf52600f
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // Include 
       
    20 #include "peninputlistonerowwithouticonwithbubble.h"
       
    21 #include "peninputcandidate.h"
       
    22 
       
    23 #include <peninputdropdownlistcontext.h>
       
    24 #include <peninputdropdownlist.h>
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // Implementation of Class CListOneRowWithoutIconWithBubble 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CListOneRowWithoutIconWithBubble::CListOneRowWithoutIconWithBubble
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave
       
    34 // (other items were commented in a header).
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CListOneRowWithoutIconWithBubble::CListOneRowWithoutIconWithBubble(CListManager* aManager, 
       
    38                                                MFepCtrlDropdownListContext* aOwner)
       
    39 :CListOneRowWithoutIcon(aManager, aOwner)
       
    40     {
       
    41     iIsMultiRows = EFalse;
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CListOneRowWithoutIconWithBubble::NewL
       
    46 // factory function
       
    47 // (other items were commented in a header).
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 CListOneRowWithoutIconWithBubble* CListOneRowWithoutIconWithBubble::NewL(CListManager* aManager,
       
    51                                                      MFepCtrlDropdownListContext* aOwner)
       
    52     {
       
    53     CListOneRowWithoutIconWithBubble* self = new (ELeave) CListOneRowWithoutIconWithBubble(aManager, aOwner);
       
    54     CleanupStack::PushL(self);
       
    55     self->ConstructL();
       
    56     CleanupStack::Pop();
       
    57     return self;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CListOneRowWithoutIconWithBubble::~CListOneRowWithoutIconWithBubble
       
    62 // desstrutor function
       
    63 // (other items were commented in a header).
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 CListOneRowWithoutIconWithBubble::~CListOneRowWithoutIconWithBubble()
       
    67     {   
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CListOneRowWithoutIconWithBubble::HandlePointerDownL
       
    72 // handle pointer down 
       
    73 // (other items were commented in a header).
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 void CListOneRowWithoutIconWithBubble::HandlePointerDownL(const TPoint& aPoint)
       
    77     {    
       
    78     // Pass the event first to the base     
       
    79     CList::HandlePointerDownL(aPoint);
       
    80     
       
    81     TInt index = -1;
       
    82     CCandidate* candidate = FindCandidate(aPoint, index);
       
    83     if(candidate)
       
    84         iOwner->DrawBubble(iClickedRect, candidate->GetCandidate());
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CListOneRowWithoutIconWithBubble::HandlePointerDragL
       
    89 // handle pointer drag function
       
    90 // (other items were commented in a header).
       
    91 // -----------------------------------------------------------------------------
       
    92 //
       
    93 void CListOneRowWithoutIconWithBubble::HandlePointerDragL(const TPoint& aPoint)
       
    94     { 
       
    95     // Pass the event first to the base
       
    96     CList::HandlePointerDragL(aPoint);
       
    97     
       
    98     // If the mouse have click in the area of DDL
       
    99     if ( iIndicateButtonClicked )  
       
   100         {
       
   101         CCandidate* candidate = FindCandidate(aPoint, iClickedCandidateIndex);
       
   102         
       
   103         if ( candidate )
       
   104             {
       
   105             if(iClickedRect != candidate->GetRect())
       
   106                 {
       
   107                 iMoveLatestRect = iClickedRect;
       
   108                 iClickedRect.SetRect(candidate->GetRect().iTl, candidate->GetRect().Size());
       
   109                 
       
   110                 // Compare the two rect, then decide draw it or not
       
   111                 CompareRect(iMoveLatestRect, iClickedRect);               
       
   112                 
       
   113                 iOwner->ClearBubble();
       
   114                 iOwner->DrawBubble(iClickedRect, candidate->GetCandidate());
       
   115                 }
       
   116             }
       
   117         else
       
   118             {
       
   119             iOwner->ClearBubble();
       
   120             
       
   121             iMoveLatestRect = iClickedRect;
       
   122             iClickedRect = KEmptyRect;
       
   123             
       
   124             // Compare the two rect, then decide draw it or not
       
   125             CompareRect(iMoveLatestRect, iClickedRect);
       
   126             }
       
   127         }
       
   128     }
       
   129 
       
   130 // -----------------------------------------------------------------------------
       
   131 // CListOneRowWithoutIconWithBubble::HandlePointerUpL
       
   132 // handle pointer up function
       
   133 // (other items were commented in a header).
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 void CListOneRowWithoutIconWithBubble::HandlePointerUpL(const TPoint& aPoint)
       
   137     {
       
   138     if ( !iClickedRect.IsEmpty() )
       
   139         {
       
   140         iOwner->ClearBubble();
       
   141         // Find out which rectangle was clicked and save it for 
       
   142         // later usage (HandlePointerUpL)
       
   143         if ( iContentRect.Contains( aPoint ) )
       
   144             {
       
   145             if ( iClickedRect.Contains( aPoint ) )
       
   146                 {
       
   147                 if ( iClickedCandidateIndex != KErrNotFound )
       
   148                     {
       
   149                     // Redraw the selection rect  
       
   150                     DrawSelection( iClickedRect, EFalse );
       
   151                     
       
   152                     // We have selected a candidate
       
   153                     // Send message to plugin         
       
   154                     CCandidate* candidate = iOwner->GetCandidate(iClickedCandidateIndex);
       
   155                     if ( candidate )
       
   156                         {
       
   157                         iOwner->ReportCandidateSelectEventL(candidate->GetCandidate(),
       
   158                                                            iClickedCandidateIndex); 
       
   159                         }
       
   160                            
       
   161                     }                
       
   162                }
       
   163                 
       
   164             iIndicateButtonClicked = EFalse;
       
   165             }
       
   166             
       
   167         iClickedRect = KEmptyRect;               
       
   168         }
       
   169     }
       
   170 
       
   171 // -----------------------------------------------------------------------------
       
   172 // CListOneRowWithoutIconWithBubble::HandlePointerLeave
       
   173 // handle pointer leave function
       
   174 // (other items were commented in a header).
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void CListOneRowWithoutIconWithBubble::HandlePointerLeave(const TPoint& /*aPoint*/)
       
   178     {
       
   179     iMoveLatestRect = iClickedRect;
       
   180     iClickedRect = KEmptyRect;
       
   181     DrawSelection( iMoveLatestRect, EFalse );
       
   182     DrawHighightCell(iMoveLatestRect, ETrue);
       
   183     }
       
   184 
       
   185 // -----------------------------------------------------------------------------
       
   186 // CListOneRowWithoutIconWithBubble::CompareRect
       
   187 // Compare src and des rect
       
   188 // (other items were commented in a header).
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 TBool CListOneRowWithoutIconWithBubble::CompareRect(const TRect& aSrcRect, const TRect& aDesRect)
       
   192     {
       
   193     if(aSrcRect != aDesRect)  
       
   194         {
       
   195         DrawSelection(aDesRect, ETrue);
       
   196         DrawSelection(aSrcRect, EFalse);
       
   197         DrawHighightCell(aSrcRect, ETrue);
       
   198         }
       
   199           
       
   200     return EFalse;
       
   201     }
       
   202 
       
   203 // End Of File