|
1 /* |
|
2 * Copyright (c) 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: MR Toolbar |
|
15 * |
|
16 */ |
|
17 #ifndef CMRTOOLBAR_H |
|
18 #define CMRTOOLBAR_H |
|
19 |
|
20 // INCLUDES |
|
21 #include <e32base.h> |
|
22 #include <akntoolbarobserver.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class CMRAsynchCmd; |
|
26 |
|
27 // CLASS DECLARATIONS |
|
28 |
|
29 NONSHARABLE_CLASS( CMRToolbar ) : public CBase, public MAknToolbarObserver |
|
30 { |
|
31 public: |
|
32 /// Context of the toolbar |
|
33 enum TToolbarContext |
|
34 { |
|
35 EMRViewerOrganizer = 1, |
|
36 EMRViewerAttendee, |
|
37 EMRViewerFromMailApp, |
|
38 ECustom = 100 // User has customized the toolbar with own buttons |
|
39 }; |
|
40 |
|
41 public: |
|
42 /** |
|
43 * C'tor |
|
44 */ |
|
45 static CMRToolbar* NewL(); |
|
46 /** |
|
47 * D'tor |
|
48 */ |
|
49 ~CMRToolbar(); |
|
50 |
|
51 public: // Interface |
|
52 /** |
|
53 * Initialize toolbar with native toolbar and the context |
|
54 * @param aContext Toolbar's context, defined the button set |
|
55 * @param aNativeToolbar Avkon toolbar, if NULL the |
|
56 * Appui::CurrentFixedToolbar() is used to get the toolbar |
|
57 */ |
|
58 void InitializeToolbarL( |
|
59 TToolbarContext aCntx, |
|
60 CAknToolbar* aNativeToolbar = NULL ); |
|
61 /** |
|
62 * Sets the toolbar's, aNativeToolbar or CurrentFixedToolbar, |
|
63 * visiblity as aShowToolbar. Toolbar's visibility is restored in |
|
64 * class' d'tor |
|
65 * @param aShowToolbar If ETrue sets toolbar visible, |
|
66 * otherwise hides toolbar |
|
67 */ |
|
68 void ShowToolbar( TBool aShowToolbar ); |
|
69 /** |
|
70 * Set on toolbar event observer |
|
71 * @param aObserver Pointer to observer, ownership is not transferred |
|
72 */ |
|
73 void SetObserver( MAknToolbarObserver* aObserver ); |
|
74 |
|
75 /* |
|
76 * Returns the rect of the current toolbar. If not in use, returns |
|
77 * zero rect. |
|
78 * @return Rect of the toolbar in use. |
|
79 */ |
|
80 TRect Rect(); |
|
81 |
|
82 private: // From MAknToolbarObserver |
|
83 void DynInitToolbarL ( TInt aResourceId, CAknToolbar *aToolbar ); |
|
84 void OfferToolbarEventL ( TInt aCommand ); |
|
85 |
|
86 private: // Implementation |
|
87 CMRToolbar(); |
|
88 void ConstructL(); |
|
89 void ConstructToolbarL( TToolbarContext aCntx ); |
|
90 void ConstructButtonL( TInt aResId, TInt aIndex ); |
|
91 void RemovePreviousItems(); |
|
92 |
|
93 private: // Data |
|
94 /// Ref: Current application toolbar |
|
95 CAknToolbar* iToolbar; |
|
96 /// Ref: Observer for toolbar events |
|
97 MAknToolbarObserver* iObserver; |
|
98 /// Own: Context of the toolbar |
|
99 TToolbarContext iCntx; |
|
100 /// Own: Item id array, needed for cleaning up the toolbar in d'tor |
|
101 RArray<TInt> iItemIdArray; |
|
102 /// Own: Asynchronous command notifier |
|
103 CMRAsynchCmd* iAsyncCmd; |
|
104 /// Own: Flag for the visibility change |
|
105 TBool iVisibilityChanged; |
|
106 /// Own: copy of previous application toolbar |
|
107 CAknToolbar* iPreviousToolbar; |
|
108 /// To record if the toolbar in previous view is visible. |
|
109 TBool iPreviousVisibility; |
|
110 /// Ref: Observer for toolbar visibility |
|
111 }; |
|
112 |
|
113 #endif // CMRTOOLBAR_H |
|
114 |
|
115 // End of file |
|
116 |