30
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 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: Calendar Toolbar Implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CALENTOOLBARIMPL_H
|
|
20 |
#define CALENTOOLBARIMPL_H
|
|
21 |
|
|
22 |
#include <akntoolbarobserver.h> // MAknToolbarObserver
|
|
23 |
#include <coecobs.h> // MCoeControlObserver
|
|
24 |
#include <calentoolbar.h> // MCalenToolbarObserver
|
|
25 |
|
|
26 |
//Forward declarations
|
|
27 |
class CAknAppUi;
|
|
28 |
class CAknButton;
|
|
29 |
class CAknToolbar;
|
|
30 |
class CCalenController;
|
|
31 |
class CGulIcon;
|
|
32 |
class CAknView;
|
|
33 |
class CCalenViewInfo;
|
|
34 |
|
|
35 |
NONSHARABLE_CLASS( CCalenToolbarImpl ) : public CBase,
|
|
36 |
public MCalenToolbar,
|
|
37 |
public MAknToolbarObserver,
|
|
38 |
public MCoeControlObserver
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
|
|
42 |
/**
|
|
43 |
* First phase construction
|
|
44 |
* Creates a new CCalenToolbarImpl instance
|
|
45 |
* @param aController Reference to the Calendar Controller
|
|
46 |
*/
|
|
47 |
static CCalenToolbarImpl* NewL( CCalenController& aController );
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Destructor
|
|
51 |
* Frees all resources used by this class
|
|
52 |
*/
|
|
53 |
~CCalenToolbarImpl();
|
|
54 |
|
|
55 |
/**
|
|
56 |
* From MCalenToolbar
|
|
57 |
* Check if the toolbar is currently visible
|
|
58 |
* @return ETrue if the toolbar is currently shown, EFalse otherwise
|
|
59 |
*/
|
|
60 |
TBool IsVisible();
|
|
61 |
|
|
62 |
/**
|
|
63 |
* From MCalenToolbar
|
|
64 |
* Show or hide the toolbar. Has no effect if the toolbar is
|
|
65 |
* disabled
|
|
66 |
* @param aVisibility ETrue to set visible, EFalse to set invisible
|
|
67 |
*/
|
|
68 |
void SetToolbarVisibilityL( TBool aMakeVisible );
|
|
69 |
|
|
70 |
/**
|
|
71 |
* From MCalenToolbar
|
|
72 |
* Update the toolbar using Calendar layout information
|
|
73 |
*/
|
|
74 |
void UpdateToolbar();
|
|
75 |
|
|
76 |
/**
|
|
77 |
* From MCalenToolbar
|
|
78 |
* Accessor for the concrete toolbar
|
|
79 |
* @return Reference to the concrete toolbar object
|
|
80 |
*/
|
|
81 |
CAknToolbar& Toolbar();
|
|
82 |
|
|
83 |
/**
|
|
84 |
* From MCalenToolbar.
|
|
85 |
* Allows extending this API without breaking BC.
|
|
86 |
*
|
|
87 |
* @param aExtensionUid specifies
|
|
88 |
* @return extension of the requested type
|
|
89 |
*/
|
|
90 |
TAny* CalenToolbarExtensionL( TUid aExtensionUid );
|
|
91 |
|
|
92 |
/**
|
|
93 |
* From MAknToolbarObserver
|
|
94 |
* Called before toolbar is drawn. Allows modification of toolbar
|
|
95 |
* components based on current context
|
|
96 |
* @param aResourceId The resource ID for particular toolbar
|
|
97 |
* @param aToolbar The toolbar object pointer
|
|
98 |
*/
|
|
99 |
void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
|
|
100 |
|
|
101 |
/**
|
|
102 |
* From MAknToolbarObserver
|
|
103 |
* Handles toolbar events for a toolbar item
|
|
104 |
* @param aCommand The command ID of the toolbar item
|
|
105 |
*/
|
|
106 |
void OfferToolbarEventL( TInt aCommand );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* From MCoeControlObserver
|
|
110 |
* Handles an event from an observed control
|
|
111 |
* @param aControl The control that sent the event
|
|
112 |
* @param aEventType The event type
|
|
113 |
*/
|
|
114 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Update icon for "NextView" button
|
|
118 |
* @param aIcon New icon for the nextview button
|
|
119 |
*/
|
|
120 |
void SetNextViewIcon( CGulIcon* aIcon );
|
|
121 |
|
|
122 |
/**
|
|
123 |
* Populate the change view toolbar extension
|
|
124 |
* with available cycling views
|
|
125 |
*/
|
|
126 |
void PopulateChangeViewToolbarExtensionL();
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Resets calendar toolbar
|
|
130 |
*/
|
|
131 |
void ResetCalendarToolbar();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* For handling focus in toolbar extension
|
|
135 |
*/
|
|
136 |
void SetToolbarExtensionFocus(TBool aFocus);
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Reset toolbar extension commands
|
|
140 |
*/
|
|
141 |
void ResetToolbarExtensionCommandsL();
|
|
142 |
|
|
143 |
inline TBool IsICalenToolBar()
|
|
144 |
{
|
|
145 |
return iCalenToolbar ? ETrue : EFalse;
|
|
146 |
}
|
|
147 |
|
|
148 |
private:
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Private constructor
|
|
152 |
* Creates a new CCalenToolbarImpl instance
|
|
153 |
* @param aController Reference to the Calendar Controller
|
|
154 |
*/
|
|
155 |
CCalenToolbarImpl( CCalenController& aController );
|
|
156 |
|
|
157 |
/**
|
|
158 |
* Second phase construction
|
|
159 |
* Creates initial toolbar buttons
|
|
160 |
*/
|
|
161 |
void ConstructL();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Create calendar toolbar buttons
|
|
165 |
* @param aIcon Button Icon
|
|
166 |
* @param aIconTextId Icon Text
|
|
167 |
* @param aTooltipID Tooltip Text
|
|
168 |
*/
|
|
169 |
CAknButton* CreateButtonL( CGulIcon* aIcon,
|
|
170 |
TInt aIconTextId,
|
|
171 |
TInt aTooltipID );
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Create calendar toolbar buttons
|
|
175 |
* @param aIcon Button Icon
|
|
176 |
* @param aIconTextId Icon Text
|
|
177 |
* @param aTooltipID Tooltip Text
|
|
178 |
*/
|
|
179 |
CAknButton* CreateButtonForCustomViewsL(CGulIcon* aIcon,
|
|
180 |
TInt aIconTextId,
|
|
181 |
const TDesC &aIconText );
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Add view toolbar items to the extendable toolbar as per
|
|
185 |
* view cycle positions
|
|
186 |
*
|
|
187 |
* @param aIndex Index of the toolbar item
|
|
188 |
* @aViewInformation reference to the CCalenViewInfo
|
|
189 |
*/
|
|
190 |
void AddItemsToExtendableToolbarL( TInt aIndex,
|
|
191 |
CCalenViewInfo& aViewInformation);
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Get view position list based on the cycling positions
|
|
195 |
*
|
|
196 |
* @param aCurrentViewUid UID of the current view
|
|
197 |
* @param aViewPositionArray array of view positions as per view cycle
|
|
198 |
*/
|
|
199 |
void GetViewPositionList( TUid aCurrentViewUid,
|
|
200 |
RArray<TUid>& aViewPositionArray,
|
|
201 |
RPointerArray<CCalenViewInfo>& aViewInfoArray);
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Get IconText and tooltip text resource ids for extendable toolbar
|
|
205 |
* items
|
|
206 |
*
|
|
207 |
* @param aViewUid view uid of the view
|
|
208 |
* @param aIconTextId resource id of icon text
|
|
209 |
* @param aToolTipTextId resource id of tooltip text
|
|
210 |
*/
|
|
211 |
void GetResourceIdForToolTip( TUid aViewUid, TInt& aIconTextId,
|
|
212 |
TInt& aToolTipTextId);
|
|
213 |
|
|
214 |
private: // Data.
|
|
215 |
|
|
216 |
CAknAppUi* iAppUi; // Application UI. Not owned by this class
|
|
217 |
CCalenController& iController; // Calendar Controller reference.
|
|
218 |
CAknToolbar* iCalenToolbar; // calendar toolbar. Owned by the CCalenToolbarImpl
|
|
219 |
TBool iStartUpToolbar;
|
|
220 |
RArray<TInt> iExtensionToolbarCommands;
|
|
221 |
CAknToolbar* iAppToolbar; // Concrete toolbar. Owned by the appui.
|
|
222 |
|
|
223 |
};
|
|
224 |
|
|
225 |
#endif // CALENTOOLBARIMPL_H
|
|
226 |
|
|
227 |
// End of File
|