williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: Popup toolbar component
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#ifndef __AKNTOOLBAR_H__
|
williamr@2
|
21 |
#define __AKNTOOLBAR_H__
|
williamr@2
|
22 |
|
williamr@2
|
23 |
// INCLUDES
|
williamr@2
|
24 |
#include <avkon.hrh> // TAknOrientation
|
williamr@4
|
25 |
#include <AknControl.h> // CCoeControl
|
williamr@2
|
26 |
#include <coecobs.h> // MCoeControlObserver
|
williamr@2
|
27 |
#include <eikcmobs.h> // MEikCommandObserver
|
williamr@4
|
28 |
#include <AknPopupFader.h>
|
williamr@2
|
29 |
#include <babitflags.h>
|
williamr@4
|
30 |
#include <AknsItemID.h>
|
williamr@2
|
31 |
|
williamr@2
|
32 |
// FORWARD DECLARATIONS
|
williamr@2
|
33 |
class CAknButton;
|
williamr@2
|
34 |
class CAknToolbarItem;
|
williamr@2
|
35 |
class CAknToolbarExtension;
|
williamr@2
|
36 |
class MAknToolbarObserver;
|
williamr@2
|
37 |
class CEikButtonGroupContainer;
|
williamr@2
|
38 |
class TAknWindowComponentLayout;
|
williamr@2
|
39 |
class CAknsFrameBackgroundControlContext;
|
williamr@2
|
40 |
class CAknsBasicBackgroundControlContext;
|
williamr@2
|
41 |
|
williamr@2
|
42 |
|
williamr@2
|
43 |
// DisableToolbarL leaves with this value if toolbar is shown, since toolbar
|
williamr@2
|
44 |
// should not be shown when disabling/enabling toolbar.
|
williamr@2
|
45 |
const TInt KErrToolbarShown = -101;
|
williamr@2
|
46 |
|
williamr@2
|
47 |
// CLASS DECLARATION
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* The class to provide toolbar for the application
|
williamr@2
|
51 |
*
|
williamr@2
|
52 |
* @lib eikcoctl.lib
|
williamr@2
|
53 |
* @since Series 60 3.1
|
williamr@2
|
54 |
*/
|
williamr@2
|
55 |
class CAknToolbar : public CAknControl, public MCoeControlObserver,
|
williamr@2
|
56 |
public MCoeControlBackground, public MEikCommandObserver,
|
williamr@2
|
57 |
public MAknFadedComponent
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
public: //Enumerations:
|
williamr@2
|
60 |
|
williamr@2
|
61 |
enum TEventModifiers {
|
williamr@2
|
62 |
ELongPress = 1,
|
williamr@2
|
63 |
ELongPressEnded = 2,
|
williamr@2
|
64 |
};
|
williamr@2
|
65 |
|
williamr@2
|
66 |
public: // Constructors and destructor
|
williamr@2
|
67 |
|
williamr@2
|
68 |
/**
|
williamr@2
|
69 |
* Two-phased constructor.
|
williamr@2
|
70 |
*
|
williamr@2
|
71 |
* @param aResourceId The ID for this component's resource
|
williamr@2
|
72 |
* @return Pointer to the created toolbar object
|
williamr@2
|
73 |
*/
|
williamr@2
|
74 |
IMPORT_C static CAknToolbar* NewL( const TInt aResourceId );
|
williamr@2
|
75 |
|
williamr@2
|
76 |
/**
|
williamr@2
|
77 |
* Two-phased constructor.
|
williamr@2
|
78 |
*
|
williamr@2
|
79 |
* @param aResourceId The ID for this component's resource
|
williamr@2
|
80 |
* @return Pointer to the created toolbar object
|
williamr@2
|
81 |
*/
|
williamr@2
|
82 |
IMPORT_C static CAknToolbar* NewLC( const TInt aResourceId );
|
williamr@2
|
83 |
|
williamr@2
|
84 |
/**
|
williamr@2
|
85 |
* Destructor
|
williamr@2
|
86 |
*/
|
williamr@2
|
87 |
~CAknToolbar();
|
williamr@2
|
88 |
|
williamr@2
|
89 |
public: // From base class
|
williamr@2
|
90 |
|
williamr@2
|
91 |
/**
|
williamr@2
|
92 |
* From CCoeControl.
|
williamr@2
|
93 |
* Gets the number of controls contained in a compound control.
|
williamr@2
|
94 |
*
|
williamr@2
|
95 |
* @return The number of component controls contained by this control.
|
williamr@2
|
96 |
*/
|
williamr@2
|
97 |
IMPORT_C TInt CountComponentControls() const;
|
williamr@2
|
98 |
|
williamr@2
|
99 |
/**
|
williamr@2
|
100 |
* From CCoeControl.
|
williamr@2
|
101 |
* Gets the specified component of a compound control.
|
williamr@2
|
102 |
*
|
williamr@2
|
103 |
* @param aIndex The index of the control to get
|
williamr@2
|
104 |
* @return The component control with an index of aIndex.
|
williamr@2
|
105 |
*/
|
williamr@2
|
106 |
IMPORT_C CCoeControl* ComponentControl( TInt aIndex ) const ;
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
* From CCoeControl.
|
williamr@2
|
110 |
* Handles pointer events.
|
williamr@2
|
111 |
*
|
williamr@2
|
112 |
* @param aPointerEvent The pointer event.
|
williamr@2
|
113 |
*/
|
williamr@2
|
114 |
IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
williamr@2
|
115 |
|
williamr@2
|
116 |
/**
|
williamr@2
|
117 |
* From CCoeControl.
|
williamr@2
|
118 |
* Handles a change to the control's resources.
|
williamr@2
|
119 |
*
|
williamr@2
|
120 |
* @param aType A message UID value.
|
williamr@2
|
121 |
*/
|
williamr@2
|
122 |
IMPORT_C void HandleResourceChange( TInt aType );
|
williamr@2
|
123 |
|
williamr@2
|
124 |
/**
|
williamr@2
|
125 |
* From MCoeControlObserver.
|
williamr@2
|
126 |
* Handles an event from an observed toolbar item.
|
williamr@2
|
127 |
*
|
williamr@2
|
128 |
* @param aControl The control which sent the event
|
williamr@2
|
129 |
* @param aEventType The event type
|
williamr@2
|
130 |
*/
|
williamr@2
|
131 |
IMPORT_C void HandleControlEventL( CCoeControl* aControl,
|
williamr@2
|
132 |
TCoeEvent aEventType );
|
williamr@2
|
133 |
|
williamr@2
|
134 |
/**
|
williamr@2
|
135 |
* From CCoeControl.
|
williamr@2
|
136 |
* Responds to changes in the position of a toolbar.
|
williamr@2
|
137 |
*/
|
williamr@2
|
138 |
IMPORT_C void PositionChanged();
|
williamr@2
|
139 |
|
williamr@2
|
140 |
/**
|
williamr@2
|
141 |
* From MEikCommandObserver.
|
williamr@2
|
142 |
* Processes user commands.
|
williamr@2
|
143 |
*
|
williamr@2
|
144 |
* @param TInt aCommandId ID of the command to respond to.
|
williamr@2
|
145 |
*/
|
williamr@2
|
146 |
IMPORT_C void ProcessCommandL( TInt aCommandId );
|
williamr@2
|
147 |
|
williamr@2
|
148 |
/**
|
williamr@2
|
149 |
* From CCoeControl.
|
williamr@2
|
150 |
* Sets toolbar dimmed. Doesn't redraw.
|
williamr@2
|
151 |
*
|
williamr@2
|
152 |
* @param aDimmed is ETrue to dim the toolbar,
|
williamr@2
|
153 |
* EFalse to set the toolbar as not dimmed
|
williamr@2
|
154 |
*/
|
williamr@2
|
155 |
IMPORT_C void SetDimmed( TBool aDimmed );
|
williamr@2
|
156 |
|
williamr@2
|
157 |
/**
|
williamr@2
|
158 |
* From CCoeControl.
|
williamr@2
|
159 |
* Handles key events.
|
williamr@2
|
160 |
*
|
williamr@2
|
161 |
* @param aKeyEvent The key event
|
williamr@2
|
162 |
* @param aType The type of key event: EEventKey, EEventKeyUp
|
williamr@2
|
163 |
* or EEventKeyDown.
|
williamr@2
|
164 |
* @return TKeyResponse Indicates whether or not the key event was used
|
williamr@2
|
165 |
* by this control.
|
williamr@2
|
166 |
*/
|
williamr@2
|
167 |
IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
williamr@2
|
168 |
TEventCode aType );
|
williamr@2
|
169 |
|
williamr@2
|
170 |
/**
|
williamr@2
|
171 |
* From CCoeControl.
|
williamr@2
|
172 |
* Gets the control's input capabilities.
|
williamr@2
|
173 |
*
|
williamr@2
|
174 |
* @return The control's input capabilities.
|
williamr@2
|
175 |
*/
|
williamr@2
|
176 |
IMPORT_C TCoeInputCapabilities InputCapabilities() const;
|
williamr@2
|
177 |
|
williamr@2
|
178 |
/**
|
williamr@2
|
179 |
* From MCoeControlBackground.
|
williamr@2
|
180 |
* Draw the background for a given control.
|
williamr@2
|
181 |
* The text drawer that shall be used to draw text on the specific
|
williamr@2
|
182 |
* background can be fetched through the GetTextDrawer() method.
|
williamr@2
|
183 |
*
|
williamr@2
|
184 |
* @param aGc Graphics context used for drawing.
|
williamr@2
|
185 |
* @param aControl The control being drawn (may be a child of the drawer).
|
williamr@2
|
186 |
* @param aRect The area to be redrawn.
|
williamr@2
|
187 |
*/
|
williamr@2
|
188 |
IMPORT_C void Draw( CWindowGc& aGc,
|
williamr@2
|
189 |
const CCoeControl& aControl,
|
williamr@2
|
190 |
const TRect& aRect ) const;
|
williamr@2
|
191 |
|
williamr@2
|
192 |
public: // New functions
|
williamr@2
|
193 |
|
williamr@2
|
194 |
/**
|
williamr@2
|
195 |
* Gets a pointer to the specified control.
|
williamr@2
|
196 |
*
|
williamr@2
|
197 |
* @param aControlId The ID of the control for which a pointer is
|
williamr@2
|
198 |
* required.
|
williamr@2
|
199 |
* @return Pointer to the control with the specified ID.
|
williamr@2
|
200 |
*/
|
williamr@2
|
201 |
IMPORT_C CCoeControl* ControlOrNull( const TInt aControlId ) const;
|
williamr@2
|
202 |
|
williamr@2
|
203 |
/**
|
williamr@2
|
204 |
* Shows or hides toolbar. Position of the top left corner should be set
|
williamr@2
|
205 |
* in advance. Toolbar set visible with this method is by default focusing.
|
williamr@2
|
206 |
* Does nothing if toolbar is disabled.
|
williamr@2
|
207 |
* @param aVisible ETrue to show it, EFalse to hide it.
|
williamr@2
|
208 |
*/
|
williamr@2
|
209 |
IMPORT_C void SetToolbarVisibility( const TBool aVisible );
|
williamr@2
|
210 |
|
williamr@2
|
211 |
/**
|
williamr@2
|
212 |
* Shows or hides toolbar. Position of the top left corner should be set
|
williamr@2
|
213 |
* in advance. This overload of the method allows toolbar to be set
|
williamr@2
|
214 |
* non-focusing. Does nothing if toolbar is disabled.
|
williamr@2
|
215 |
* @param aVisible ETrue to show it, EFalse to hide it.
|
williamr@2
|
216 |
* @param aFocusing ETrue to set toolbar focusing, otherwise EFalse.
|
williamr@2
|
217 |
*/
|
williamr@2
|
218 |
IMPORT_C void SetToolbarVisibility( const TBool aVisible,
|
williamr@2
|
219 |
const TBool aFocusing );
|
williamr@2
|
220 |
|
williamr@2
|
221 |
/**
|
williamr@2
|
222 |
* Dims (greys out) or undims a toolbar item.
|
williamr@2
|
223 |
*
|
williamr@2
|
224 |
* @param aCommandId The command (as defined in an .hrh file)
|
williamr@2
|
225 |
* associated with this toolbar item. This identifies the toolbar
|
williamr@2
|
226 |
* item, whose text is to be dimmed or un-dimmed.
|
williamr@2
|
227 |
* @param aDimmed Use ETrue to dim this toolbar item or EFalse to
|
williamr@2
|
228 |
* un-dim this toolbar item.
|
williamr@2
|
229 |
* @param aDrawNow Should be ETrue for the item to be redrawn.
|
williamr@2
|
230 |
*/
|
williamr@2
|
231 |
IMPORT_C void SetItemDimmed( const TInt aCommandId,
|
williamr@2
|
232 |
const TBool aDimmed,
|
williamr@2
|
233 |
const TBool aDrawNow );
|
williamr@2
|
234 |
|
williamr@2
|
235 |
/**
|
williamr@2
|
236 |
* Hides or unhides a toolbar item.
|
williamr@2
|
237 |
*
|
williamr@2
|
238 |
* @param aCommandId The command (as defined in an .hrh file)
|
williamr@2
|
239 |
* associated with this toolbar item. This identifies the toolbar
|
williamr@2
|
240 |
* item, which will be set to hidden or unhidden.
|
williamr@2
|
241 |
* @param aHide Use ETrue to hide this toolbar item or EFalse to
|
williamr@2
|
242 |
* unhide this toolbar item.
|
williamr@2
|
243 |
* @param aDrawNow Should be ETrue for the toolbar to be redrawn.
|
williamr@2
|
244 |
*/
|
williamr@2
|
245 |
IMPORT_C void HideItem( const TInt aCommandId,
|
williamr@2
|
246 |
const TBool aHide,
|
williamr@2
|
247 |
const TBool aDrawNow );
|
williamr@2
|
248 |
|
williamr@2
|
249 |
/**
|
williamr@2
|
250 |
* Sets the observer for the toolbar.
|
williamr@2
|
251 |
*
|
williamr@2
|
252 |
* @param aObserver A pointer to the observer. Ownership is not changed.
|
williamr@2
|
253 |
*/
|
williamr@2
|
254 |
IMPORT_C void SetToolbarObserver( MAknToolbarObserver* aObserver );
|
williamr@2
|
255 |
|
williamr@2
|
256 |
/**
|
williamr@2
|
257 |
* Returns a pointer to the toolbar observer.
|
williamr@2
|
258 |
*
|
williamr@2
|
259 |
* @return Pointer to the toolbar observer.
|
williamr@2
|
260 |
*/
|
williamr@2
|
261 |
IMPORT_C MAknToolbarObserver* ToolbarObserver();
|
williamr@2
|
262 |
|
williamr@2
|
263 |
/**
|
williamr@2
|
264 |
* Adds one item to the end of the toolbar. Takes ownership.
|
williamr@2
|
265 |
* Leaves with value KErrNotSupported, if the control type is not
|
williamr@2
|
266 |
* supported by toolbar (see CAknToolbar::IsSupportedItemType()).
|
williamr@2
|
267 |
*
|
williamr@2
|
268 |
* @param aItem The control.
|
williamr@2
|
269 |
* @param aType The type of the new toolbar item.
|
williamr@2
|
270 |
* @param aCommandId The command ID for this item.
|
williamr@2
|
271 |
* @param aFlags The flags.
|
williamr@2
|
272 |
*/
|
williamr@2
|
273 |
IMPORT_C void AddItemL( CCoeControl* aItem,
|
williamr@2
|
274 |
const TInt aType,
|
williamr@2
|
275 |
const TInt aCommandId,
|
williamr@2
|
276 |
const TInt aFlags );
|
williamr@2
|
277 |
|
williamr@2
|
278 |
/**
|
williamr@2
|
279 |
* Adds one item to the specified place. Takes ownership.
|
williamr@2
|
280 |
* Leaves with value KErrNotSupported, if the control type is not
|
williamr@2
|
281 |
* supported by toolbar (see CAknToolbar::IsSupportedItemType()).
|
williamr@2
|
282 |
*
|
williamr@2
|
283 |
* @param aItem The control.
|
williamr@2
|
284 |
* @param aType The type of the new toolbar item.
|
williamr@2
|
285 |
* @param aCommandId The command ID for this item.
|
williamr@2
|
286 |
* @param aFlags The flags.
|
williamr@2
|
287 |
* @param aIndex The index in array at which item should be added.
|
williamr@2
|
288 |
*/
|
williamr@2
|
289 |
IMPORT_C void AddItemL( CCoeControl* aItem,
|
williamr@2
|
290 |
const TInt aType,
|
williamr@2
|
291 |
const TInt aCommandId,
|
williamr@2
|
292 |
const TInt aFlags,
|
williamr@2
|
293 |
const TInt aIndex );
|
williamr@2
|
294 |
|
williamr@2
|
295 |
/**
|
williamr@2
|
296 |
* Removes one item from the toolbar.
|
williamr@2
|
297 |
*
|
williamr@2
|
298 |
* @param aCommandId The ID of the item which should be removed.
|
williamr@2
|
299 |
*/
|
williamr@2
|
300 |
IMPORT_C void RemoveItem( const TInt aCommandId );
|
williamr@2
|
301 |
|
williamr@2
|
302 |
/**
|
williamr@2
|
303 |
* Returns ETrue if the type of the item can be included in the
|
williamr@2
|
304 |
* toolbar.
|
williamr@2
|
305 |
*
|
williamr@2
|
306 |
* @return ETrue for the supported type, otherwise EFalse.
|
williamr@2
|
307 |
*/
|
williamr@2
|
308 |
IMPORT_C TBool IsSupportedItemType( const TInt aType ) const;
|
williamr@2
|
309 |
|
williamr@2
|
310 |
/**
|
williamr@2
|
311 |
* Changes the command ID for the initially focused item when toolbar is
|
williamr@2
|
312 |
* shown or gain focus. Notice that, if this item is not visible, then
|
williamr@2
|
313 |
* focus will be according default behaviour. Normally, focus will be on
|
williamr@2
|
314 |
* the first item, if KAknToolbarMiddleItemFocused flag was not used.
|
williamr@2
|
315 |
*
|
williamr@2
|
316 |
* @param aCommandId The command ID for the item to get focus.
|
williamr@2
|
317 |
*/
|
williamr@2
|
318 |
IMPORT_C void SetInitialFocusedItem( const TInt aCommandId );
|
williamr@2
|
319 |
|
williamr@2
|
320 |
/**
|
williamr@2
|
321 |
* Called by the framework to handle the emphasising or
|
williamr@2
|
322 |
* de-emphasising of a toolbar window when it is needed.
|
williamr@2
|
323 |
*
|
williamr@2
|
324 |
* @param aEmphasis ETrue to emphasize the menu, EFalse otherwise.
|
williamr@2
|
325 |
*/
|
williamr@2
|
326 |
IMPORT_C void SetEmphasis( const TBool aEmphasis );
|
williamr@2
|
327 |
|
williamr@2
|
328 |
/**
|
williamr@2
|
329 |
* Returns toolbar visibility at this moment
|
williamr@2
|
330 |
*
|
williamr@2
|
331 |
* @return ETrue, if toolbar is shown.
|
williamr@2
|
332 |
*/
|
williamr@2
|
333 |
IMPORT_C TBool IsShown() const;
|
williamr@2
|
334 |
|
williamr@2
|
335 |
/**
|
williamr@2
|
336 |
* Specifies whether toolbar should be shown with sliding effect or not.
|
williamr@2
|
337 |
* By default toolbar is shown with sliding.
|
williamr@2
|
338 |
*
|
williamr@2
|
339 |
* @param aSlide ETrue for sliding effect, EFalse without sliding.
|
williamr@2
|
340 |
*/
|
williamr@2
|
341 |
IMPORT_C void SetWithSliding( const TBool aSlide );
|
williamr@2
|
342 |
|
williamr@2
|
343 |
/**
|
williamr@2
|
344 |
* Sets whether the toolbar should be closed or remain open after the
|
williamr@2
|
345 |
* specified command is issued from the toolbar.
|
williamr@2
|
346 |
*
|
williamr@2
|
347 |
* @param aCommandId The command.
|
williamr@2
|
348 |
* @param aClose ETrue, if toolbar should be close.
|
williamr@2
|
349 |
*/
|
williamr@2
|
350 |
IMPORT_C void SetCloseOnCommand( const TInt aCommandId,
|
williamr@2
|
351 |
const TBool aClose );
|
williamr@2
|
352 |
|
williamr@2
|
353 |
/**
|
williamr@2
|
354 |
* Sets whether the toolbar should be closed after a command is issued
|
williamr@2
|
355 |
* from the toolbar. This method affects every command on the toolbar.
|
williamr@2
|
356 |
*
|
williamr@2
|
357 |
* @param aClose ETrue, if toolbar should be closed.
|
williamr@2
|
358 |
*/
|
williamr@2
|
359 |
IMPORT_C void SetCloseOnAllCommands( const TBool aClose );
|
williamr@2
|
360 |
|
williamr@2
|
361 |
/**
|
williamr@2
|
362 |
* Sets toolbar orientation.
|
williamr@2
|
363 |
*
|
williamr@2
|
364 |
* @param aOrientation Orientation that should be used for toolbar.
|
williamr@2
|
365 |
* @since 3.2
|
williamr@2
|
366 |
*/
|
williamr@2
|
367 |
IMPORT_C void SetOrientation( const TAknOrientation aOrientation );
|
williamr@2
|
368 |
|
williamr@2
|
369 |
/**
|
williamr@2
|
370 |
* Updates transparent toolbar's background.
|
williamr@2
|
371 |
* @since 3.2
|
williamr@2
|
372 |
*/
|
williamr@2
|
373 |
IMPORT_C void UpdateBackground();
|
williamr@2
|
374 |
|
williamr@2
|
375 |
/**
|
williamr@2
|
376 |
* Shows toolbar again after it has been hidden for background changing
|
williamr@2
|
377 |
* purposes
|
williamr@2
|
378 |
*
|
williamr@2
|
379 |
* @since 3.2
|
williamr@2
|
380 |
*/
|
williamr@2
|
381 |
void ShowToolbarForBackgroundUpdate();
|
williamr@2
|
382 |
|
williamr@2
|
383 |
/**
|
williamr@2
|
384 |
* Disables/Enables toolbar so that it cannot/can be activated from e.g.
|
williamr@2
|
385 |
* touch pane. Needed especially if a dialog is on the screen and
|
williamr@2
|
386 |
* toolbar is not wished to be shown. Leaves with value KErrToolbarShown
|
williamr@2
|
387 |
* if called when toolbar is shown.
|
williamr@2
|
388 |
*
|
williamr@2
|
389 |
* @param aDisable ETrue if toolbar should be disabled
|
williamr@2
|
390 |
*
|
williamr@2
|
391 |
* @since S60 3.2
|
williamr@2
|
392 |
*/
|
williamr@2
|
393 |
IMPORT_C void DisableToolbarL( TBool aDisable );
|
williamr@2
|
394 |
|
williamr@2
|
395 |
/**
|
williamr@2
|
396 |
* Checks if toolbar is disabled.
|
williamr@2
|
397 |
*
|
williamr@2
|
398 |
* @return ETrue if toolbar is disabled, EFalse if not
|
williamr@2
|
399 |
*
|
williamr@2
|
400 |
* @since S60 3.2
|
williamr@2
|
401 |
*/
|
williamr@2
|
402 |
IMPORT_C TBool IsToolbarDisabled() const;
|
williamr@2
|
403 |
|
williamr@2
|
404 |
/**
|
williamr@2
|
405 |
* Moves highlight from one item to another. Leaves with
|
williamr@2
|
406 |
* value KErrNotFound if item not found.
|
williamr@2
|
407 |
*
|
williamr@2
|
408 |
* @param aCommandId command id of the item to be focused.
|
williamr@2
|
409 |
*
|
williamr@2
|
410 |
* @since S60 3.2
|
williamr@2
|
411 |
*/
|
williamr@2
|
412 |
IMPORT_C void SetFocusedItemL( const TInt aCommandId );
|
williamr@2
|
413 |
|
williamr@2
|
414 |
/**
|
williamr@2
|
415 |
* Returns command id of focused item.
|
williamr@2
|
416 |
*
|
williamr@2
|
417 |
* @return command id of focused item. Returns KErrNotFound if
|
williamr@2
|
418 |
* no item is focused.
|
williamr@2
|
419 |
*
|
williamr@2
|
420 |
* @since S60 3.2
|
williamr@2
|
421 |
*/
|
williamr@2
|
422 |
IMPORT_C TInt FocusedItem() const;
|
williamr@2
|
423 |
|
williamr@2
|
424 |
/**
|
williamr@2
|
425 |
* Takes focus away from edwin or other controls if needed. Called by
|
williamr@2
|
426 |
* AknAppUi from HandleWsEventL when a pointer event is targeted to
|
williamr@2
|
427 |
* other control than toolbar.
|
williamr@2
|
428 |
*
|
williamr@2
|
429 |
* @since S60 3.2
|
williamr@2
|
430 |
*/
|
williamr@2
|
431 |
void PrepareForFocusLossL();
|
williamr@2
|
432 |
|
williamr@2
|
433 |
/**
|
williamr@2
|
434 |
* Returns event modifiers defined in TEventModifiers in this header.
|
williamr@2
|
435 |
* This can be used by applications in OfferToolbarEventL to know if
|
williamr@2
|
436 |
* the event sent was for example a long press event. Information is
|
williamr@2
|
437 |
* valid only during OfferToolbarEventL.
|
williamr@2
|
438 |
*
|
williamr@2
|
439 |
* @return event modifiers
|
williamr@2
|
440 |
* @since S60 3.2
|
williamr@2
|
441 |
*/
|
williamr@2
|
442 |
IMPORT_C TInt EventModifiers() const;
|
williamr@2
|
443 |
|
williamr@2
|
444 |
/**
|
williamr@2
|
445 |
* Returns the flags of toolbar. Flags are defined in eikon.hrh.
|
williamr@2
|
446 |
* @return toolbar flags
|
williamr@2
|
447 |
* @since S60 3.2
|
williamr@2
|
448 |
*/
|
williamr@2
|
449 |
IMPORT_C TInt ToolbarFlags() const;
|
williamr@2
|
450 |
|
williamr@2
|
451 |
/*
|
williamr@2
|
452 |
* Count faded components
|
williamr@2
|
453 |
* @return then number of faded components
|
williamr@2
|
454 |
*/
|
williamr@2
|
455 |
TInt CountFadedComponents();
|
williamr@2
|
456 |
|
williamr@2
|
457 |
/*
|
williamr@2
|
458 |
* Returns faded components by index
|
williamr@2
|
459 |
* @return faded component
|
williamr@2
|
460 |
*/
|
williamr@2
|
461 |
CCoeControl* FadedComponent( TInt aIndex );
|
williamr@2
|
462 |
|
williamr@2
|
463 |
/*
|
williamr@2
|
464 |
* Reduces main pane rect if it intersects with toolbar's rect
|
williamr@2
|
465 |
* @param aBoundingRect the rect to reduce
|
williamr@2
|
466 |
*/
|
williamr@2
|
467 |
void ReduceRect( TRect& aBoundingRect ) const;
|
williamr@2
|
468 |
|
williamr@2
|
469 |
/**
|
williamr@2
|
470 |
* Sets the resource id for toolbar softkeys. If cba allready exists
|
williamr@2
|
471 |
* then changes the existing softkeys and redraws toolbar cba.
|
williamr@2
|
472 |
* @param aSoftkeyResourceId ID of the resource structure specifying
|
williamr@2
|
473 |
* the command buttons.
|
williamr@2
|
474 |
* @since S60 3.2
|
williamr@2
|
475 |
*/
|
williamr@2
|
476 |
IMPORT_C void SetSoftkeyResourceIdL( TInt aSoftkeyResourceId );
|
williamr@2
|
477 |
|
williamr@2
|
478 |
/**
|
williamr@2
|
479 |
* Extension notifies of its events using this method
|
williamr@2
|
480 |
* aCommandId command id of the button
|
williamr@2
|
481 |
*/
|
williamr@2
|
482 |
void ExtensionEventL( TInt aCommandId );
|
williamr@2
|
483 |
|
williamr@2
|
484 |
/**
|
williamr@2
|
485 |
* Returns the index of the toolbar item inside of the iVisibleItems
|
williamr@2
|
486 |
* array.
|
williamr@2
|
487 |
*
|
williamr@2
|
488 |
* @param aControl The control which index is needed.
|
williamr@2
|
489 |
* @return Index of the toolbar item.
|
williamr@2
|
490 |
*/
|
williamr@2
|
491 |
TInt ToolbarVisibleIndexByControl( const CCoeControl* aControl ) const;
|
williamr@2
|
492 |
|
williamr@2
|
493 |
/**
|
williamr@2
|
494 |
* Returns pointer to toolbar extension if available
|
williamr@2
|
495 |
* @return toolbar extension or NULL
|
williamr@2
|
496 |
*/
|
williamr@2
|
497 |
IMPORT_C CAknToolbarExtension* ToolbarExtension() const;
|
williamr@2
|
498 |
|
williamr@2
|
499 |
/**
|
williamr@2
|
500 |
* Calls DynInitToolbar with extensions commmand id
|
williamr@2
|
501 |
*
|
williamr@2
|
502 |
*/
|
williamr@2
|
503 |
void DynInitExtensionL( CCoeControl* aControl );
|
williamr@2
|
504 |
|
williamr@2
|
505 |
/**
|
williamr@2
|
506 |
* Callback for sliding toolbar.
|
williamr@2
|
507 |
*/
|
williamr@2
|
508 |
static TInt ReadyToSlide( TAny* aThis );
|
williamr@2
|
509 |
|
williamr@2
|
510 |
/**
|
williamr@2
|
511 |
* Slide toolbar
|
williamr@2
|
512 |
*/
|
williamr@2
|
513 |
void SlideWithIdle();
|
williamr@2
|
514 |
|
williamr@2
|
515 |
/**
|
williamr@2
|
516 |
* Hides/Unhides toolbar items temporarily. When called with ETrue
|
williamr@2
|
517 |
* toolbar draws just background in landscape and is hidden in portrait.
|
williamr@2
|
518 |
* Calling with EFalse returns the situation to normal, so drawing the
|
williamr@2
|
519 |
* items normally in portrait and landscape. Use this method only with
|
williamr@2
|
520 |
* fixed toolbar!
|
williamr@2
|
521 |
*
|
williamr@2
|
522 |
* @param aHide ETrue if hiding items, EFalse if unhiding.
|
williamr@2
|
523 |
*/
|
williamr@2
|
524 |
IMPORT_C void HideItemsAndDrawOnlyBackground( TBool aHide );
|
williamr@2
|
525 |
|
williamr@2
|
526 |
/**
|
williamr@2
|
527 |
* Hides/Unhides toolbar items temporarily. When called with ETrue
|
williamr@2
|
528 |
* toolbar draws just background in landscape and is hidden in portrait.
|
williamr@2
|
529 |
* Toolbar window priority is changed to priority passed in parameter.
|
williamr@2
|
530 |
* Priority should be one of the window priority values defined in
|
williamr@2
|
531 |
* TCoeWinPriority. Default priority is ECoeWinPriorityLow.
|
williamr@2
|
532 |
* Note that if toolbar is already hidden, the toolbar window priority
|
williamr@2
|
533 |
* is still changed to priority passed in parameter.
|
williamr@2
|
534 |
* Calling the function HideItemsAndDrawOnlyBackground with EFalse returns
|
williamr@2
|
535 |
* the situation to normal, so drawing the items normally in portrait
|
williamr@2
|
536 |
* and landscape. Use this method only with fixed toolbar!
|
williamr@2
|
537 |
*
|
williamr@2
|
538 |
* @param aHide ETrue if hiding items, EFalse if unhiding.
|
williamr@2
|
539 |
* @param aPriority Ordinal priority of toolbar window.
|
williamr@2
|
540 |
*/
|
williamr@2
|
541 |
IMPORT_C void HideItemsAndDrawOnlyBackground( TBool aHide, TInt aPriority );
|
williamr@4
|
542 |
/**
|
williamr@4
|
543 |
* Sets the skin background for fixed toolbar. The new background is used
|
williamr@4
|
544 |
* for all the subsequent drawing operations. This method does not itself
|
williamr@4
|
545 |
* cause a repaint.
|
williamr@4
|
546 |
*
|
williamr@4
|
547 |
* @internal
|
williamr@4
|
548 |
*
|
williamr@4
|
549 |
* @param aIID Skin item ID of the new background. This is one of the constants
|
williamr@4
|
550 |
* defined in AknsConstants.h, and the usual values are KAknsIIDQsnBgScreen
|
williamr@4
|
551 |
* @since S60 5.0
|
williamr@4
|
552 |
*/
|
williamr@4
|
553 |
IMPORT_C void SetSkinBackgroundId( const TAknsItemID& aIID );
|
williamr@2
|
554 |
|
williamr@2
|
555 |
|
williamr@2
|
556 |
protected: // From base class
|
williamr@2
|
557 |
|
williamr@2
|
558 |
/**
|
williamr@2
|
559 |
* From CCoeControl.
|
williamr@2
|
560 |
* Responds to size changes to sets the size and position of
|
williamr@2
|
561 |
* the contents of this control.
|
williamr@2
|
562 |
*/
|
williamr@2
|
563 |
IMPORT_C void SizeChanged();
|
williamr@2
|
564 |
|
williamr@2
|
565 |
/**
|
williamr@2
|
566 |
* From CCoeControl.
|
williamr@2
|
567 |
* This function is called whenever a control gains or loses focus.
|
williamr@2
|
568 |
*
|
williamr@2
|
569 |
* @param aDrawNow Contains the value that was passed to it by SetFocus().
|
williamr@2
|
570 |
*/
|
williamr@2
|
571 |
IMPORT_C void FocusChanged( TDrawNow aDrawNow );
|
williamr@2
|
572 |
|
williamr@2
|
573 |
/**
|
williamr@2
|
574 |
* From CAknControl.
|
williamr@2
|
575 |
* For future extensions.
|
williamr@2
|
576 |
*
|
williamr@2
|
577 |
* @param aInterface The ID for the extension interface.
|
williamr@2
|
578 |
*/
|
williamr@2
|
579 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
580 |
|
williamr@2
|
581 |
/**
|
williamr@2
|
582 |
* From CCoeControl.
|
williamr@2
|
583 |
* Retrieves an object of the same type as that encapsulated in aId.
|
williamr@2
|
584 |
*
|
williamr@2
|
585 |
* @param aId An encapsulated object type ID.
|
williamr@2
|
586 |
* @return Encapsulated pointer to the object provided.
|
williamr@2
|
587 |
* Note that the encapsulated pointer may be NULL.
|
williamr@2
|
588 |
*/
|
williamr@2
|
589 |
IMPORT_C TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
|
williamr@2
|
590 |
|
williamr@2
|
591 |
private: // Constructors
|
williamr@2
|
592 |
|
williamr@2
|
593 |
/**
|
williamr@2
|
594 |
* C++ default constructor.
|
williamr@2
|
595 |
*/
|
williamr@2
|
596 |
CAknToolbar();
|
williamr@2
|
597 |
|
williamr@2
|
598 |
/**
|
williamr@2
|
599 |
* Symbian 2nd phase constructor.
|
williamr@2
|
600 |
*/
|
williamr@2
|
601 |
void ConstructL();
|
williamr@2
|
602 |
|
williamr@2
|
603 |
private: // From base class
|
williamr@2
|
604 |
|
williamr@2
|
605 |
/**
|
williamr@2
|
606 |
* From CCoeControl.
|
williamr@2
|
607 |
* Constructs controls from a resource file.
|
williamr@2
|
608 |
* Hides the one defined in base class.
|
williamr@2
|
609 |
*
|
williamr@2
|
610 |
* @param aReader The resource reader with which to access
|
williamr@2
|
611 |
* the control's resource values.
|
williamr@2
|
612 |
*/
|
williamr@2
|
613 |
IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
|
williamr@2
|
614 |
|
williamr@2
|
615 |
/**
|
williamr@2
|
616 |
* From CCoeControl.
|
williamr@2
|
617 |
* Draw a control called by window server.
|
williamr@2
|
618 |
*
|
williamr@2
|
619 |
* @param aRect The region of the control to be redrawn.
|
williamr@2
|
620 |
* Co-ordinates are relative to the control's origin (top left corner).
|
williamr@2
|
621 |
*/
|
williamr@2
|
622 |
IMPORT_C void Draw( const TRect& aRect ) const;
|
williamr@2
|
623 |
|
williamr@2
|
624 |
private: // New functions
|
williamr@2
|
625 |
|
williamr@2
|
626 |
/**
|
williamr@2
|
627 |
* Constructs controls from a resource file.
|
williamr@2
|
628 |
*
|
williamr@2
|
629 |
* @param aResourceId The ID for this component's resource.
|
williamr@2
|
630 |
*/
|
williamr@2
|
631 |
void ConstructFromResourceL( const TInt aResourceId );
|
williamr@2
|
632 |
|
williamr@2
|
633 |
/**
|
williamr@2
|
634 |
* Constructs one of the toolbar items.
|
williamr@2
|
635 |
*
|
williamr@2
|
636 |
* @param aReader The resource reader with which to access the control's
|
williamr@2
|
637 |
* resource values.
|
williamr@2
|
638 |
* @return Constructed toolbar item.
|
williamr@2
|
639 |
*/
|
williamr@2
|
640 |
CAknToolbarItem* ConstructControlLC( TResourceReader& aReader );
|
williamr@2
|
641 |
|
williamr@2
|
642 |
/**
|
williamr@2
|
643 |
* Calculates size and position of the toolbar depending on the
|
williamr@2
|
644 |
* number and size of the toolbar items.
|
williamr@2
|
645 |
*
|
williamr@2
|
646 |
* @return Toolbar rectangular.
|
williamr@2
|
647 |
*/
|
williamr@2
|
648 |
TRect CalculateSizeAndPosition();
|
williamr@2
|
649 |
|
williamr@2
|
650 |
/**
|
williamr@2
|
651 |
* Calculates rects that are used in calculating the size
|
williamr@2
|
652 |
* and position of the toolbar items
|
williamr@2
|
653 |
*
|
williamr@2
|
654 |
* @param aMainPaneRect main pane rect
|
williamr@2
|
655 |
* @param aToolbarRect rect for toolbar
|
williamr@2
|
656 |
* @param aGridPaneRect rect for grid pane
|
williamr@2
|
657 |
* @param aCellPaneRect rect for cell pane
|
williamr@2
|
658 |
*/
|
williamr@2
|
659 |
void CalculateRects( TRect& aMainPaneRect, TRect& aToolbarRect,
|
williamr@2
|
660 |
TRect& aGridPaneRect, TRect& aCellPaneRect );
|
williamr@2
|
661 |
|
williamr@2
|
662 |
/**
|
williamr@2
|
663 |
* Calculates the position and size of the control rect
|
williamr@2
|
664 |
*
|
williamr@2
|
665 |
* @param aCurrentCellPaneRect current cell pane rect is needed to
|
williamr@2
|
666 |
* get correct control rect from layout data.
|
williamr@2
|
667 |
* @return control rect for the toolbar item
|
williamr@2
|
668 |
*/
|
williamr@2
|
669 |
TRect CalculateControlRect( TRect& aCurrentCellPaneRect );
|
williamr@2
|
670 |
|
williamr@2
|
671 |
/**
|
williamr@2
|
672 |
* Checks the number of visible items, and if too few the toolbar CBA is
|
williamr@2
|
673 |
* deleted. If last time there were too few items then toolbar CBA is
|
williamr@2
|
674 |
* created again. Also the ordinal position of the toolbar is set if
|
williamr@2
|
675 |
* there are changes to previous situation.
|
williamr@2
|
676 |
*
|
williamr@2
|
677 |
* @return ETrue if too few items are visible, EFalse if not
|
williamr@2
|
678 |
*/
|
williamr@2
|
679 |
TBool TooFewItemsVisible();
|
williamr@2
|
680 |
|
williamr@2
|
681 |
/**
|
williamr@2
|
682 |
* Returns toolbar item object for the specified control.
|
williamr@2
|
683 |
*
|
williamr@2
|
684 |
* @param aControl Pointer to the control.
|
williamr@2
|
685 |
* @return Pointer to the toolbar item.
|
williamr@2
|
686 |
*/
|
williamr@2
|
687 |
CAknToolbarItem* ToolbarItemByControl( const CCoeControl* aControl ) const;
|
williamr@2
|
688 |
|
williamr@2
|
689 |
/**
|
williamr@2
|
690 |
* Returns toolbar item object for the specified command ID.
|
williamr@2
|
691 |
*
|
williamr@2
|
692 |
* @param aId The command ID of the item.
|
williamr@2
|
693 |
* @return Pointer to the toolbar item.
|
williamr@2
|
694 |
*/
|
williamr@2
|
695 |
CAknToolbarItem* ToolbarItemById( const TInt aId ) const;
|
williamr@2
|
696 |
|
williamr@2
|
697 |
/**
|
williamr@2
|
698 |
* Returns the index of the toolbar item inside of the iItems array.
|
williamr@2
|
699 |
*
|
williamr@2
|
700 |
* @param aId The command ID of the item
|
williamr@2
|
701 |
* @return Index of the toolbar item.
|
williamr@2
|
702 |
*/
|
williamr@2
|
703 |
TInt ToolbarItemIndexById( const TInt aId ) const;
|
williamr@2
|
704 |
|
williamr@2
|
705 |
/**
|
williamr@2
|
706 |
* Returns the index of the toolbar item inside of the iItems array.
|
williamr@2
|
707 |
*
|
williamr@2
|
708 |
* @param aControl The control which index is needed.
|
williamr@2
|
709 |
* @return Index of the toolbar item.
|
williamr@2
|
710 |
*/
|
williamr@2
|
711 |
TInt ToolbarItemIndexByControl( const CCoeControl* aControl ) const;
|
williamr@2
|
712 |
|
williamr@2
|
713 |
/**
|
williamr@2
|
714 |
* Returns the index of the toolbar item inside of the iVisibleItems
|
williamr@2
|
715 |
* array.
|
williamr@2
|
716 |
*
|
williamr@2
|
717 |
* @param aId The command ID of the item.
|
williamr@2
|
718 |
* @return Index of the toolbar item.
|
williamr@2
|
719 |
*/
|
williamr@2
|
720 |
TInt ToolbarVisibleIndexById( const TInt aId ) const;
|
williamr@2
|
721 |
|
williamr@2
|
722 |
/**
|
williamr@2
|
723 |
* Draws toolbar with sliding effect.
|
williamr@2
|
724 |
*
|
williamr@2
|
725 |
* @param aEndPos The position of the top left corner of toolbar at
|
williamr@2
|
726 |
* the end of animation.
|
williamr@2
|
727 |
*/
|
williamr@2
|
728 |
void SlideToolbar( const TPoint& aEndPos );
|
williamr@2
|
729 |
|
williamr@2
|
730 |
/**
|
williamr@2
|
731 |
* Changes CBA text if all items are dimmed.
|
williamr@2
|
732 |
*/
|
williamr@2
|
733 |
void SetRightCbaTextL();
|
williamr@2
|
734 |
|
williamr@2
|
735 |
/**
|
williamr@2
|
736 |
* Returns next non-dimmed and non-hidden control index.
|
williamr@2
|
737 |
*
|
williamr@2
|
738 |
* @param aStartIndex The index of the item from which the search
|
williamr@2
|
739 |
* should be started.
|
williamr@2
|
740 |
* @param aMoveForward ETrue if search is done from lower index to
|
williamr@2
|
741 |
* the higher one.
|
williamr@2
|
742 |
* @return The index of next non-dimmed and non-hidden item.
|
williamr@2
|
743 |
*/
|
williamr@2
|
744 |
TInt GetNextSelectableItemIndex( TInt aStartIndex,
|
williamr@2
|
745 |
TBool aMoveForward );
|
williamr@2
|
746 |
|
williamr@2
|
747 |
/**
|
williamr@2
|
748 |
* Moves highlight from one item to another. It also will change
|
williamr@2
|
749 |
* softkey text for the focused toolbar.
|
williamr@2
|
750 |
*
|
williamr@2
|
751 |
* @param aItemIndex The index for the newly focused item.
|
williamr@2
|
752 |
* @param aDrawNow Specifies whether the item should be redrawn.
|
williamr@2
|
753 |
* @param aMoveForward Specifies whether the next item in the array
|
williamr@2
|
754 |
* should be selected when the item with aItemIndex is dimmed.
|
williamr@2
|
755 |
* @param aPrepareControl Specifies whether PrepareForFocusLossL() or
|
williamr@2
|
756 |
* PrepareForFocusGainL() functions should be called.
|
williamr@2
|
757 |
*/
|
williamr@2
|
758 |
void MoveHighlightL( TInt aItemIndex,
|
williamr@2
|
759 |
const TBool aDrawNow,
|
williamr@2
|
760 |
const TBool aMoveForward = ETrue,
|
williamr@2
|
761 |
const TBool aPrepareControl = ETrue );
|
williamr@2
|
762 |
|
williamr@2
|
763 |
/**
|
williamr@2
|
764 |
* Makes toolbar visible and activates it. Position of the top left
|
williamr@2
|
765 |
* corner should be set in advance. Also use SetFocus() to specify
|
williamr@2
|
766 |
* whether toolbar gets key events or not.
|
williamr@2
|
767 |
*/
|
williamr@2
|
768 |
void ShowToolbarL();
|
williamr@2
|
769 |
|
williamr@2
|
770 |
/**
|
williamr@2
|
771 |
* Hides toolbar.
|
williamr@2
|
772 |
*/
|
williamr@2
|
773 |
void HideToolbarL();
|
williamr@2
|
774 |
|
williamr@2
|
775 |
/**
|
williamr@2
|
776 |
* Sets the focus to the middle or the first item, depending on the
|
williamr@2
|
777 |
* toolbar flags.
|
williamr@2
|
778 |
*
|
williamr@2
|
779 |
* @param aDrawNow if the newly focused item should be redrawn.
|
williamr@2
|
780 |
*/
|
williamr@2
|
781 |
void InitFocusedItemL( const TBool aDrawNow );
|
williamr@2
|
782 |
|
williamr@2
|
783 |
/**
|
williamr@2
|
784 |
* Sets the flag to be on or off and also calls
|
williamr@2
|
785 |
* CCoeControl::MakeVisible().
|
williamr@2
|
786 |
*/
|
williamr@2
|
787 |
void SetShown( const TBool aShown );
|
williamr@2
|
788 |
|
williamr@2
|
789 |
/**
|
williamr@2
|
790 |
* Selects/deselects the toolbar item at given index.
|
williamr@2
|
791 |
*/
|
williamr@2
|
792 |
void SelectItemL( const TInt aIndex, const TBool aSelect );
|
williamr@2
|
793 |
|
williamr@2
|
794 |
/**
|
williamr@2
|
795 |
* Gets rect from layout data.
|
williamr@2
|
796 |
*/
|
williamr@2
|
797 |
TRect RectFromLayout( const TRect& aParent,
|
williamr@2
|
798 |
const TAknWindowComponentLayout& aComponentLayout ) const;
|
williamr@2
|
799 |
|
williamr@2
|
800 |
/**
|
williamr@2
|
801 |
* Callback to get notified when ready to show toolbar again
|
williamr@2
|
802 |
*/
|
williamr@2
|
803 |
static TInt WaitForScreenSwitch(TAny* aThis);
|
williamr@2
|
804 |
|
williamr@2
|
805 |
/**
|
williamr@2
|
806 |
* Hides toolbar so that screen capture can be taken from the
|
williamr@2
|
807 |
* background in order to update it.
|
williamr@2
|
808 |
*/
|
williamr@2
|
809 |
void HideToolbarForBackgroundUpdate();
|
williamr@2
|
810 |
|
williamr@2
|
811 |
/**
|
williamr@2
|
812 |
* Updates control positions so that tooltips are positioned correctly
|
williamr@2
|
813 |
*/
|
williamr@2
|
814 |
void UpdateControlPositions();
|
williamr@2
|
815 |
|
williamr@2
|
816 |
/**
|
williamr@2
|
817 |
* Shows toolbar via CIdle. As a result, toolbar's window priority is
|
williamr@2
|
818 |
* setted after the application's container window. This places toolbar
|
williamr@2
|
819 |
* to the right place in the window tree.
|
williamr@2
|
820 |
*/
|
williamr@2
|
821 |
void ShowViaIdle();
|
williamr@2
|
822 |
|
williamr@2
|
823 |
/**
|
williamr@2
|
824 |
* Callback for delayed toolbar showing.
|
williamr@2
|
825 |
*/
|
williamr@2
|
826 |
static TInt ShowDelayedToolbar( TAny* aThis );
|
williamr@2
|
827 |
|
williamr@2
|
828 |
|
williamr@2
|
829 |
/**
|
williamr@2
|
830 |
* Fades behind toolbar
|
williamr@2
|
831 |
* @param aFade if ETrue then fade
|
williamr@2
|
832 |
*/
|
williamr@2
|
833 |
void FadeBehindPopup( TBool aFade );
|
williamr@2
|
834 |
|
williamr@2
|
835 |
/**
|
williamr@2
|
836 |
* Sets buttons to check their touchable areas when tapped
|
williamr@2
|
837 |
*/
|
williamr@2
|
838 |
void CheckHitAreas( );
|
williamr@2
|
839 |
|
williamr@2
|
840 |
/**
|
williamr@2
|
841 |
* Counts buttons of fixed tool bar and adds button(s) if needed
|
williamr@2
|
842 |
* There has to bee at leas three buttons in fixed toolbar.
|
williamr@2
|
843 |
*/
|
williamr@2
|
844 |
void CheckFixedToolbarButtonsL();
|
williamr@2
|
845 |
|
williamr@2
|
846 |
/**
|
williamr@2
|
847 |
* Draws backgrounds of fixed toolbar
|
williamr@2
|
848 |
* @param aGc Graphics context used for drawing.
|
williamr@2
|
849 |
* @param aControl The control being drawn (may be a child of the drawer).
|
williamr@2
|
850 |
* @param aRect The area to be drawn.
|
williamr@2
|
851 |
*/
|
williamr@2
|
852 |
void DrawFixedBackgroundL( CWindowGc& aGc,
|
williamr@2
|
853 |
const CCoeControl& aControl,
|
williamr@2
|
854 |
const TRect& aRect ) const;
|
williamr@2
|
855 |
|
williamr@2
|
856 |
/**
|
williamr@2
|
857 |
* Adjusts button's properties depending on the toolbar's features.
|
williamr@2
|
858 |
*/
|
williamr@2
|
859 |
void AdjustButton( CAknButton& aButton );
|
williamr@2
|
860 |
|
williamr@2
|
861 |
/**
|
williamr@2
|
862 |
* Adjusts all buttons' properties depending on the toolbar's features.
|
williamr@2
|
863 |
*/
|
williamr@2
|
864 |
void AdjustAllButtons();
|
williamr@2
|
865 |
|
williamr@2
|
866 |
/**
|
williamr@2
|
867 |
* Adjusts toolbar's and overlying dialog's window positions so that
|
williamr@2
|
868 |
* dialog is displayed on top of the toolbar.
|
williamr@2
|
869 |
*/
|
williamr@2
|
870 |
void SetOrdinalPositions() const;
|
williamr@2
|
871 |
|
williamr@2
|
872 |
/**
|
williamr@2
|
873 |
* Updates control visibility based on toolbar visibility and
|
williamr@2
|
874 |
* buttons visibility inside toolbar.
|
williamr@2
|
875 |
*/
|
williamr@2
|
876 |
void UpdateControlVisibility();
|
williamr@2
|
877 |
|
williamr@4
|
878 |
/*
|
williamr@4
|
879 |
* Update item tooltip position
|
williamr@4
|
880 |
*/
|
williamr@4
|
881 |
void UpdateItemTooltipPosition();
|
williamr@4
|
882 |
|
williamr@2
|
883 |
private: // Member variables
|
williamr@2
|
884 |
|
williamr@2
|
885 |
// Array for toolbar items
|
williamr@2
|
886 |
RPointerArray<CAknToolbarItem> iItems;
|
williamr@2
|
887 |
|
williamr@2
|
888 |
// Array for visible toolbar items
|
williamr@2
|
889 |
RPointerArray<CAknToolbarItem> iVisibleItems;
|
williamr@2
|
890 |
|
williamr@2
|
891 |
// Toolbar flags
|
williamr@2
|
892 |
TInt iFlags;
|
williamr@2
|
893 |
|
williamr@2
|
894 |
// Observer to report toolbar item events, not owned
|
williamr@2
|
895 |
MAknToolbarObserver* iToolbarObserver;
|
williamr@2
|
896 |
|
williamr@2
|
897 |
// Index of focused item, used with focusable toolbar
|
williamr@2
|
898 |
TInt iFocusedItem;
|
williamr@2
|
899 |
|
williamr@2
|
900 |
// Index of selected item, used with focusable and non-focusable toolbar
|
williamr@2
|
901 |
TInt iSelectedItem;
|
williamr@2
|
902 |
|
williamr@2
|
903 |
// Toolbar cba, used with focusable toolbar
|
williamr@2
|
904 |
// own
|
williamr@2
|
905 |
CEikButtonGroupContainer* iToolbarCba;
|
williamr@2
|
906 |
|
williamr@2
|
907 |
// Resource id for toolbar
|
williamr@2
|
908 |
TInt iToolbarResourceId;
|
williamr@2
|
909 |
|
williamr@2
|
910 |
// The default focused item
|
williamr@2
|
911 |
TInt iInitialFocusedItem;
|
williamr@2
|
912 |
|
williamr@2
|
913 |
// Last focused item before focus was lost
|
williamr@2
|
914 |
TInt iLastFocusedItem;
|
williamr@2
|
915 |
|
williamr@2
|
916 |
// Toolbar frame context
|
williamr@2
|
917 |
// own
|
williamr@2
|
918 |
CAknsFrameBackgroundControlContext* iFrameContext;
|
williamr@2
|
919 |
|
williamr@2
|
920 |
// Toolbar background context
|
williamr@2
|
921 |
// own
|
williamr@2
|
922 |
CAknsBasicBackgroundControlContext* iBgContext;
|
williamr@2
|
923 |
|
williamr@2
|
924 |
// Toolbar orientation
|
williamr@2
|
925 |
TAknOrientation iOrientation;
|
williamr@2
|
926 |
|
williamr@2
|
927 |
// Transparency bitmap
|
williamr@2
|
928 |
// own
|
williamr@4
|
929 |
// this member variable is deserted
|
williamr@2
|
930 |
CFbsBitmap* iBgBitmap;
|
williamr@2
|
931 |
|
williamr@2
|
932 |
// This is used to call ShowToolbarForBackgroundChange after toolbar has
|
williamr@2
|
933 |
// been hidden
|
williamr@2
|
934 |
// own
|
williamr@2
|
935 |
CIdle* iIdle;
|
williamr@2
|
936 |
|
williamr@2
|
937 |
// Highlight bitmap
|
williamr@4
|
938 |
// this member variable is deserted
|
williamr@2
|
939 |
CFbsBitmap* iHighlightBitmap;
|
williamr@2
|
940 |
|
williamr@2
|
941 |
// Highlight mask
|
williamr@4
|
942 |
// this member variable is deserted
|
williamr@2
|
943 |
CFbsBitmap* iHighlightMask;
|
williamr@2
|
944 |
|
williamr@2
|
945 |
// event modifiers
|
williamr@2
|
946 |
TInt iEventModifiers;
|
williamr@2
|
947 |
|
williamr@2
|
948 |
// Background fader
|
williamr@2
|
949 |
TAknPopupFader iFader;
|
williamr@2
|
950 |
|
williamr@2
|
951 |
// Softkey resource
|
williamr@2
|
952 |
TInt iSoftkeyResource;
|
williamr@2
|
953 |
|
williamr@2
|
954 |
// Used to store previous item that had pointerevents
|
williamr@2
|
955 |
TInt iPreviousItem;
|
williamr@2
|
956 |
|
williamr@4
|
957 |
// Item that catches point down event
|
williamr@4
|
958 |
TInt iDownItem;
|
williamr@4
|
959 |
|
williamr@2
|
960 |
// Step for toolbar sliding
|
williamr@2
|
961 |
TInt iStep;
|
williamr@2
|
962 |
|
williamr@2
|
963 |
// End position for toolbar sliding
|
williamr@2
|
964 |
TInt iEndPos;
|
williamr@2
|
965 |
|
williamr@2
|
966 |
// Internal flags used to store toolbar's properties
|
williamr@2
|
967 |
TBitFlags iInternalFlags;
|
williamr@2
|
968 |
|
williamr@2
|
969 |
// Background area to be drawn when not enough visible items
|
williamr@2
|
970 |
// to cover the toolbar area
|
williamr@2
|
971 |
TRect iBgRect;
|
williamr@2
|
972 |
|
williamr@2
|
973 |
// Toolbar window priority if set in HideItemsAndDrawOnlyBackground
|
williamr@2
|
974 |
TInt iDrawingPriority;
|
williamr@2
|
975 |
|
williamr@4
|
976 |
/*
|
williamr@4
|
977 |
* Background theme ID user defined. And in default, its value is
|
williamr@4
|
978 |
* KAknsIIDNone is used and toolbar draw background with the current skin
|
williamr@4
|
979 |
*/
|
williamr@4
|
980 |
TAknsItemID iBgIID;
|
williamr@2
|
981 |
};
|
williamr@2
|
982 |
|
williamr@2
|
983 |
#endif // __AKNTOOLBAR_H__
|
williamr@2
|
984 |
|
williamr@2
|
985 |
// End of File
|