|
1 /* |
|
2 * Copyright (c) 2005 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: Content that is shown inside a stylus popup menu. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CAKNSTYLUSPOPUPMENUCONTENT_H |
|
20 #define CAKNSTYLUSPOPUPMENUCONTENT_H |
|
21 |
|
22 #include <coecntrl.h> |
|
23 |
|
24 class CAknButton; |
|
25 |
|
26 const TInt KAiStylusMenuMaxItems = 10; |
|
27 |
|
28 /** |
|
29 * Class providing content for the stylus popup menu. |
|
30 * |
|
31 * @lib eikcoctl.lib |
|
32 * @since S60 v5.0 |
|
33 */ |
|
34 NONSHARABLE_CLASS( CAiStylusPopUpMenuContent ) : public CCoeControl |
|
35 { |
|
36 public: |
|
37 |
|
38 static CAiStylusPopUpMenuContent* NewL(); |
|
39 |
|
40 static CAiStylusPopUpMenuContent* NewLC(); |
|
41 |
|
42 ~CAiStylusPopUpMenuContent(); |
|
43 |
|
44 /** |
|
45 * Adds a new menu item. |
|
46 * |
|
47 * @param aItem Menu item to be added. |
|
48 * @param aCommandId Command ID of the menu item. |
|
49 * @param aObserver Item's observer. |
|
50 */ |
|
51 void AddMenuItemL( const TDesC& aItem, const TInt aCommandId, |
|
52 MCoeControlObserver& aObserver ); |
|
53 |
|
54 /** |
|
55 * Removes a menu item. |
|
56 * |
|
57 * @param aIndex Index of the menu item. |
|
58 */ |
|
59 void RemoveMenuItem( const TInt aIndex ); |
|
60 |
|
61 /** |
|
62 * Hides / shows a menu item. |
|
63 * |
|
64 * @param aIndex Index of the menu item. |
|
65 * @param aDimmed ETrue to hide and EFalse to show |
|
66 */ |
|
67 void SetItemDimmed( const TInt aIndex, const TBool aDimmed ); |
|
68 |
|
69 /** |
|
70 * Method to get a command id of the specified menu item. |
|
71 * |
|
72 * @param aControl The menu item. |
|
73 * @return Command id. |
|
74 */ |
|
75 TInt CommandId( CCoeControl* aControl ) const; |
|
76 |
|
77 // from base class CCoeControl |
|
78 |
|
79 /** |
|
80 * Returns the minimum size of the control. |
|
81 * |
|
82 * @return Minimum size. |
|
83 */ |
|
84 TSize MinimumSize(); |
|
85 |
|
86 /** |
|
87 * Returns the number of component controls. |
|
88 * |
|
89 * @return Number of component controls. |
|
90 */ |
|
91 TInt CountComponentControls() const; |
|
92 |
|
93 /** |
|
94 * Returns the specified component control. |
|
95 * |
|
96 * @return The specified control. |
|
97 */ |
|
98 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
99 |
|
100 /** |
|
101 * Handles changes to the control's resources. |
|
102 * |
|
103 * @aParam aType Type of resource change. |
|
104 */ |
|
105 void HandleResourceChange( TInt aType ); |
|
106 |
|
107 private: |
|
108 |
|
109 CAiStylusPopUpMenuContent(); |
|
110 |
|
111 void ConstructL(); |
|
112 |
|
113 // from base class CCoeControl |
|
114 |
|
115 void SizeChanged(); |
|
116 |
|
117 private: // data |
|
118 |
|
119 /** |
|
120 * Array which holds pointers to menu items. Menu item's command id |
|
121 * is stored in iCommands array with the same index value . |
|
122 */ |
|
123 RPointerArray<CAknButton> iItems; |
|
124 |
|
125 /** |
|
126 * Array which holds menu items' command IDs. |
|
127 */ |
|
128 RArray<TInt> iCommands; |
|
129 |
|
130 /** |
|
131 * Array which holds menu items' visibility |
|
132 */ |
|
133 TInt iVisibility[KAiStylusMenuMaxItems]; |
|
134 |
|
135 }; |
|
136 |
|
137 #endif // CAKNSTYLUSPOPUPMENUCONTENT_H |