1 /* |
|
2 * Copyright (c) 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: Base class for command validators. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_VTUICMDVALIDATORBASE_H |
|
20 #define C_VTUICMDVALIDATORBASE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "tvtuicmdcontexttype.h" |
|
25 |
|
26 class CVtUiCmdValidationActionBase; |
|
27 class CVtUiCmdCustomValidationActionBase; |
|
28 |
|
29 /** |
|
30 * CVtUiCmdValidatorBase |
|
31 * |
|
32 * Base class for all validators. Validator implementations validate commands |
|
33 * and other properties (like softkey resource IDs) on context basis. E.g. |
|
34 * primary validator will validate commands in all contexts, while toolbar |
|
35 * validator will do fine tuning for commands only in menu context, so that |
|
36 * commands that are visible in toolbar are not shown in menu. |
|
37 * |
|
38 * @since S60 v3.2 |
|
39 */ |
|
40 NONSHARABLE_CLASS( CVtUiCmdValidatorBase ) : public CBase |
|
41 { |
|
42 |
|
43 public: // public methods |
|
44 |
|
45 /** |
|
46 * Returns validator priority. |
|
47 * |
|
48 * @return Validator priority. |
|
49 */ |
|
50 TInt Priority() const; |
|
51 |
|
52 public: // pure virtual methods |
|
53 |
|
54 /** |
|
55 * Validates menu items. |
|
56 * |
|
57 * @param aAction Reference to validation action. |
|
58 * @param aReferencePriority Context reference priority. |
|
59 */ |
|
60 virtual void ValidateMenuItemsL( CVtUiCmdValidationActionBase& aAction, |
|
61 TInt aReferencePriority ) = 0; |
|
62 |
|
63 /** |
|
64 * Validates softkey items. |
|
65 * |
|
66 * @param aAction Reference to validation action. |
|
67 * @param aReferencePriority Context reference priority. |
|
68 */ |
|
69 virtual void ValidateSoftkeyItemsL( CVtUiCmdValidationActionBase& aAction, |
|
70 TInt aReferencePriority ) = 0; |
|
71 |
|
72 /** |
|
73 * Validates toolbar items. |
|
74 * |
|
75 * @param aAction Reference to validation action. |
|
76 * @param aReferencePriority Context reference priority. |
|
77 */ |
|
78 virtual void ValidateToolbarItemsL( CVtUiCmdValidationActionBase& aAction, |
|
79 TInt aReferencePriority ) = 0; |
|
80 |
|
81 /** |
|
82 * Custom validation. |
|
83 * |
|
84 * @param aAction Reference to custom validation action. |
|
85 * @param aReferencePriority Context reference priority. |
|
86 */ |
|
87 virtual void CustomValidationL( CVtUiCmdCustomValidationActionBase& aAction, |
|
88 TInt aReferencePriority ) = 0; |
|
89 |
|
90 /** |
|
91 * Query for context validation. |
|
92 * |
|
93 * @param aCtxType Command context type. |
|
94 * @return ETrue if this instance validates given context type, EFalse |
|
95 * otherwise. |
|
96 */ |
|
97 virtual TBool ValidatesContext( const TVtUiCmdContextType& aCtxType ) |
|
98 const = 0; |
|
99 |
|
100 protected: |
|
101 |
|
102 /** |
|
103 * C++ constructor |
|
104 * |
|
105 * @param aPriority Validator priority. |
|
106 */ |
|
107 CVtUiCmdValidatorBase( TInt aPriority ); |
|
108 |
|
109 private: // data |
|
110 |
|
111 // Validator priority |
|
112 const TInt iPriority; |
|
113 |
|
114 }; |
|
115 |
|
116 #endif // C_VTUICMDVALIDATORBASE_H |
|