1 /* |
|
2 * Copyright (c) 2006 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: Menu item dimmer action class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <cvtlogger.h> |
|
20 #include <eikmenup.h> |
|
21 |
|
22 #include "cvtuimenuitemdimmeraction.h" |
|
23 #include "tvtuicmdvalidatorcallback.h" |
|
24 #include "tvtuimenucommanditerator.h" |
|
25 |
|
26 // ======== MEMBER FUNCTIONS ======== |
|
27 |
|
28 // --------------------------------------------------------------------------- |
|
29 // CVtUiMenuItemDimmerAction::NewL |
|
30 // --------------------------------------------------------------------------- |
|
31 // |
|
32 CVtUiMenuItemDimmerAction* CVtUiMenuItemDimmerAction::NewL() |
|
33 { |
|
34 __VTPRINTENTER( "MenuDimAct.NewL" ) |
|
35 CVtUiMenuItemDimmerAction* self = |
|
36 new ( ELeave ) CVtUiMenuItemDimmerAction(); |
|
37 __VTPRINTEXIT( "MenuDimAct.NewL" ) |
|
38 return self; |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // CVtUiMenuItemDimmerAction::SetMenuPane |
|
43 // --------------------------------------------------------------------------- |
|
44 // |
|
45 void CVtUiMenuItemDimmerAction::SetMenuPane( CEikMenuPane* aMenuPane ) |
|
46 { |
|
47 __VTPRINTENTER( "MenuDimAct.SetMenuPane" ) |
|
48 iMenuPane = aMenuPane; |
|
49 __VTPRINTEXIT( "MenuDimAct.SetMenuPane" ) |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CVtUiMenuItemDimmerAction::ProcessL |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void CVtUiMenuItemDimmerAction::ProcessL( |
|
57 const MVtUiCmdValidatorCallBack& aCallBack ) |
|
58 { |
|
59 __VTPRINTENTER( "MenuDimAct.ProcessL" ) |
|
60 |
|
61 if ( iMenuPane ) |
|
62 { |
|
63 for ( TVtUiMenuCommandIterator i( *iMenuPane ); i.HasNext(); ) |
|
64 { |
|
65 TInt commandId( i.Next() ); |
|
66 if ( !IsCommandHandled( commandId ) ) |
|
67 { |
|
68 if ( aCallBack.Call( commandId ) ) |
|
69 { |
|
70 CommandHandledL( commandId ); |
|
71 SetItemDimmed( commandId ); |
|
72 } |
|
73 } |
|
74 } |
|
75 } |
|
76 __VTPRINTEXIT( "MenuDimAct.ProcessL" ) |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CVtUiMenuItemDimmerAction::EndProcess |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void CVtUiMenuItemDimmerAction::EndProcess() |
|
84 { |
|
85 __VTPRINTENTER( "MenuDimAct.EndProcess" ) |
|
86 iMenuPane = NULL; |
|
87 __VTPRINTEXIT( "MenuDimAct.EndProcess" ) |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // CVtUiMenuItemDimmerAction::CVtUiMenuItemDimmerAction |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 CVtUiMenuItemDimmerAction::CVtUiMenuItemDimmerAction() |
|
95 { |
|
96 __VTPRINTENTER( "MenuDimAct.ctor" ) |
|
97 __VTPRINTEXIT( "MenuDimAct.ctor" ) |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CVtUiMenuItemDimmerAction::SetItemDimmed |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CVtUiMenuItemDimmerAction::SetItemDimmed( TInt aCommandId ) |
|
105 { |
|
106 __VTPRINTENTER( "MenuDimAct.SetItemDimmed" ) |
|
107 iMenuPane->SetItemDimmed( aCommandId, ETrue ); |
|
108 __VTPRINTEXIT( "MenuDimAct.SetItemDimmed" ) |
|
109 } |
|
110 |
|