uifw/EikStd/coctlsrc/aknstyluspopupmenu.cpp
branchRCL_3
changeset 18 fcdfafb36fe7
parent 17 a1caeb42b3a3
child 19 aecbbf00d063
equal deleted inserted replaced
17:a1caeb42b3a3 18:fcdfafb36fe7
    44 // Default constructor
    44 // Default constructor
    45 // ---------------------------------------------------------------------------
    45 // ---------------------------------------------------------------------------
    46 //
    46 //
    47 CAknStylusPopUpMenu::CAknStylusPopUpMenu( MEikMenuObserver* aObserver, 
    47 CAknStylusPopUpMenu::CAknStylusPopUpMenu( MEikMenuObserver* aObserver, 
    48     const TPoint& aPoint,
    48     const TPoint& aPoint,
    49     CAknPreviewPopUpController* aPopup ) 
    49     CAknPreviewPopUpController* aPopup,
       
    50     const TInt aFlags )
    50     : iPosition ( aPoint ),
    51     : iPosition ( aPoint ),
    51      iMenuObserver( aObserver ),
    52      iMenuObserver( aObserver ),
    52      iPreviewPopup( aPopup ),
    53      iPreviewPopup( aPopup ),
    53      iPositionType( EPositionTypeLeftTop )
    54      iPositionType( EPositionTypeLeftTop ),
       
    55      iModeFlags ( aFlags )
    54     {
    56     {
    55     }
    57     }
    56 
    58 
    57 
    59 
    58 // ---------------------------------------------------------------------------
    60 // ---------------------------------------------------------------------------
    81                                                             aPopup );
    83                                                             aPopup );
    82     CleanupStack::Pop( self );
    84     CleanupStack::Pop( self );
    83     return self;
    85     return self;
    84     }
    86     }
    85 
    87 
       
    88 // ---------------------------------------------------------------------------
       
    89 // CAknStylusPopUpMenu::NewL
       
    90 // ---------------------------------------------------------------------------
       
    91 //
       
    92 CAknStylusPopUpMenu* CAknStylusPopUpMenu::NewL( MEikMenuObserver* aObserver,
       
    93         const TPoint& aPoint,
       
    94         CAknPreviewPopUpController* aPopup,
       
    95         const TInt aFlags )
       
    96     {
       
    97     CAknStylusPopUpMenu* self = new ( ELeave ) CAknStylusPopUpMenu( aObserver,
       
    98                                                                     aPoint,
       
    99                                                                     aPopup,
       
   100                                                                     aFlags );
       
   101     CleanupStack::PushL( self );
       
   102     self->ConstructL();
       
   103     CleanupStack::Pop( self );
       
   104     return self;
       
   105     }
    86 
   106 
    87 // ---------------------------------------------------------------------------
   107 // ---------------------------------------------------------------------------
    88 // CAknStylusPopUpMenu::NewL
   108 // CAknStylusPopUpMenu::NewL
    89 // ---------------------------------------------------------------------------
   109 // ---------------------------------------------------------------------------
    90 //
   110 //
   179 EXPORT_C void CAknStylusPopUpMenu::ShowMenu()
   199 EXPORT_C void CAknStylusPopUpMenu::ShowMenu()
   180     {
   200     {
   181     // if contoller exists, re-use it .
   201     // if contoller exists, re-use it .
   182     if ( !iController )
   202     if ( !iController )
   183         {
   203         {
   184         TRAPD( err, 
   204         TInt err ( KErrNone );
   185                iController = CAknPreviewPopUpController::NewL( *iContent,
   205 
   186                        CAknPreviewPopUpController::ELayoutSubMenu | 
   206         if ( iModeFlags & EConsumeKeyEvents )
   187                        CAknPreviewPopUpController::EAutoMirror |
   207             {
   188                        CAknPreviewPopUpController::EDontClose ) );
   208             TRAP( err, iController = CAknPreviewPopUpController::NewL(
       
   209                     *iContent,
       
   210                     CAknPreviewPopUpController::ELayoutSubMenu |
       
   211                     CAknPreviewPopUpController::EAutoMirror |
       
   212                     CAknPreviewPopUpController::EDontClose |
       
   213                     CAknPreviewPopUpController::EConsumeKeys ) );
       
   214             }
       
   215         else
       
   216             {
       
   217             TRAP( err, iController = CAknPreviewPopUpController::NewL(
       
   218                     *iContent,
       
   219                     CAknPreviewPopUpController::ELayoutSubMenu |
       
   220                     CAknPreviewPopUpController::EAutoMirror |
       
   221                     CAknPreviewPopUpController::EDontClose ) );
       
   222             }
   189         if ( err )
   223         if ( err )
   190             {
   224             {
   191             return;
   225             return;
   192             }
   226             }
   193             
   227             
   483         {
   517         {
   484         iController->UpdateContentSize();
   518         iController->UpdateContentSize();
   485         }
   519         }
   486     }
   520     }
   487 
   521 
       
   522 
       
   523 // ---------------------------------------------------------------------------
       
   524 // CAknStylusPopUpMenu::HideMenu
       
   525 // ---------------------------------------------------------------------------
       
   526 //
       
   527 void CAknStylusPopUpMenu::HideMenu()
       
   528     {
       
   529     if ( iController )
       
   530         {
       
   531         iController->HidePopUp();
       
   532         }
       
   533     }
       
   534 
       
   535 
   488 // -----------------------------------------------------------------------------
   536 // -----------------------------------------------------------------------------
   489 // CAknStylusPopUpMenu::StartControllerIdleL
   537 // CAknStylusPopUpMenu::StartControllerIdleL
   490 // -----------------------------------------------------------------------------
   538 // -----------------------------------------------------------------------------
   491 //
   539 //
   492 void CAknStylusPopUpMenu::StartControllerIdleL()
   540 void CAknStylusPopUpMenu::StartControllerIdleL()
   533 
   581 
   534 // -----------------------------------------------------------------------------
   582 // -----------------------------------------------------------------------------
   535 // CAknStylusPopUpMenu::CleanLocalRef
   583 // CAknStylusPopUpMenu::CleanLocalRef
   536 // -----------------------------------------------------------------------------
   584 // -----------------------------------------------------------------------------
   537 //
   585 //
   538 void CAknStylusPopUpMenu::CleanLocalRef( TAny* any )
   586 void CAknStylusPopUpMenu::CleanLocalRef( TAny* aParam )
   539     {
   587     {
   540     static_cast<CAknStylusPopUpMenu*>( any )->iIsDeleted = NULL;
   588     static_cast<CAknStylusPopUpMenu*>( aParam )->iIsDeleted = NULL;
   541     }
   589     }