|
1 /* |
|
2 * Copyright (c) 2007-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: Attachment progress info |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cmrstyluspopupmenu.h" |
|
19 |
|
20 #include <aknstyluspopupmenu.h> |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // CMRStylusPopupMenu::TMenuItem::TMenuItem |
|
24 // --------------------------------------------------------------------------- |
|
25 // |
|
26 EXPORT_C CMRStylusPopupMenu::TMenuItem::TMenuItem() |
|
27 : iTxt( KNullDesC() ), iCommandId( 0 ) |
|
28 { |
|
29 // Do nothing |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // CMRStylusPopupMenu::TMenuItem::TMenuItem |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 EXPORT_C CMRStylusPopupMenu::TMenuItem::TMenuItem( |
|
37 const TDesC& aTxt, TInt aCommandId ) |
|
38 : iTxt( aTxt ), iCommandId( aCommandId ) |
|
39 { |
|
40 // Do nothing |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // CMRStylusPopupMenu::CMRStylusPopupMenu |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CMRStylusPopupMenu::CMRStylusPopupMenu( MEikMenuObserver& aObserver ) |
|
48 : iObserver( aObserver ) |
|
49 { |
|
50 // Do nothing |
|
51 } |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CMRStylusPopupMenu::ConstructL |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void CMRStylusPopupMenu::ConstructL() |
|
58 { |
|
59 // Do nothing |
|
60 } |
|
61 |
|
62 // --------------------------------------------------------------------------- |
|
63 // CMRStylusPopupMenu::NewL |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 EXPORT_C CMRStylusPopupMenu* CMRStylusPopupMenu::NewL( MEikMenuObserver& aObserver ) |
|
67 { |
|
68 CMRStylusPopupMenu* self = new (ELeave) CMRStylusPopupMenu( aObserver ); |
|
69 CleanupStack::PushL( self ); |
|
70 self->ConstructL(); |
|
71 CleanupStack::Pop( self ); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // CMRStylusPopupMenu::~CMRStylusPopupMenu |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C CMRStylusPopupMenu::~CMRStylusPopupMenu() |
|
80 { |
|
81 delete iPopup; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CMRStylusPopupMenu::LaunchPopupL |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 EXPORT_C void CMRStylusPopupMenu::LaunchPopupL( |
|
89 TArray<TMenuItem> aItems, const TPoint &aPosition ) |
|
90 { |
|
91 if( iPopup ) |
|
92 { |
|
93 delete iPopup; |
|
94 iPopup = NULL; |
|
95 } |
|
96 iPopup = CAknStylusPopUpMenu::NewL( &iObserver, aPosition ); |
|
97 TInt count( aItems.Count() ); |
|
98 for( TInt i = 0; i < count; ++i ) |
|
99 { |
|
100 TMenuItem item = aItems[ i ]; |
|
101 iPopup->AddMenuItemL( item.iTxt, item.iCommandId ); |
|
102 } |
|
103 iPopup->SetPosition( aPosition ); |
|
104 iPopup->ShowMenu(); |
|
105 } |