62
|
1 |
/*
|
|
2 |
* Copyright (c) 2009, 2010 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: CDialerToolbarContainer replaces the standard S60 toolbar
|
|
15 |
* in the Dialer layout in the Easy dialing mode. It's
|
|
16 |
* responsible of the toolbar layout and logic, but not of the
|
|
17 |
* contents which are provided by an instance of
|
|
18 |
* MPhoneDialerController.
|
|
19 |
*
|
|
20 |
*/
|
|
21 |
|
|
22 |
#ifndef CDIALERTOOLBAR_H_
|
|
23 |
#define CDIALERTOOLBAR_H_
|
|
24 |
|
|
25 |
// INCLUDES
|
|
26 |
#include <mphonedialercontroller.h>
|
|
27 |
#include "cdialercontainerbase.h"
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CAknButton;
|
|
31 |
|
|
32 |
|
|
33 |
// CLASS DECLARATION
|
|
34 |
NONSHARABLE_CLASS(CDialerToolbarContainer) :
|
|
35 |
public CDialerContainerBase,
|
|
36 |
private MCoeForegroundObserver
|
|
37 |
{
|
|
38 |
public: // constructor and destructor
|
|
39 |
static CDialerToolbarContainer* NewL(
|
|
40 |
CCoeControl& aParent,
|
|
41 |
MPhoneDialerController* aContentProvider );
|
|
42 |
virtual ~CDialerToolbarContainer();
|
|
43 |
|
|
44 |
private: // constructors
|
|
45 |
CDialerToolbarContainer(
|
|
46 |
CCoeControl& aParent,
|
|
47 |
MPhoneDialerController* aContentProvider );
|
|
48 |
void ConstructL();
|
|
49 |
|
|
50 |
public: // new methods
|
|
51 |
/**
|
|
52 |
* Set provider of toolbar button functions
|
|
53 |
*/
|
|
54 |
void SetContentProviderL( MPhoneDialerController* aProvider );
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Update states of all toolbar buttons.
|
|
58 |
*/
|
|
59 |
void UpdateButtonStates();
|
|
60 |
|
|
61 |
protected: // from CDialerContainerBase
|
|
62 |
virtual void SetVariety();
|
|
63 |
virtual void SetLayout();
|
|
64 |
|
|
65 |
protected: // from CCoeControl
|
|
66 |
TInt CountComponentControls() const;
|
|
67 |
CCoeControl* ComponentControl( TInt aIndex ) const;
|
|
68 |
void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
|
69 |
|
|
70 |
private: // from MCoeControlObserver
|
|
71 |
/**
|
|
72 |
* Callback for handling button presses.
|
|
73 |
*/
|
|
74 |
void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
|
|
75 |
|
|
76 |
private: // from MCoeForegroundObserver
|
|
77 |
void HandleGainingForeground();
|
|
78 |
void HandleLosingForeground();
|
|
79 |
|
|
80 |
private: // new methods
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Create toolbar button instances and fill them with states
|
|
84 |
* according the data given by the content provider.
|
|
85 |
*/
|
|
86 |
void CreateButtonsL();
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Delete all buttons and free the memory reserved for button data.
|
|
90 |
*/
|
|
91 |
void DeleteButtons();
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Create and add new button state.
|
|
95 |
*/
|
|
96 |
void AddButtonStateL( TInt aButtonIndex, MPhoneDialerController::CButtonData& aButtonData );
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Get command ID for the given button in it's current state.
|
|
100 |
*/
|
|
101 |
TInt ButtonCommand( const CAknButton& aButton ) const;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Set layout for one button.
|
|
105 |
* @param aButtonIdx Index of the button to be laid out.
|
|
106 |
* @param aPos Position (top-left corned) where button is to be placed.
|
|
107 |
* @return Position of the next button.
|
|
108 |
*/
|
|
109 |
TPoint LayoutButton( TInt aButtonIdx, TPoint aPos );
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Simulate backspace press including key down event, key event, and key up event
|
|
113 |
*/
|
|
114 |
void SimulateBackspace();
|
|
115 |
|
|
116 |
private: // data
|
|
117 |
|
|
118 |
/** Provides toolbar button data. Not owned. */
|
|
119 |
MPhoneDialerController* iContentProvider;
|
|
120 |
|
|
121 |
/** Button objects. Owned. */
|
|
122 |
RPointerArray< CAknButton > iButtons;
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Maps buttons states to command IDs.
|
|
126 |
* First index is the button index, second index is the state index.
|
|
127 |
*/
|
|
128 |
RArray< RArray<TInt> > iButtonCommands;
|
|
129 |
|
|
130 |
/** The last received pointer event. */
|
|
131 |
TPointerEvent iLatestPointerEvent;
|
|
132 |
};
|
|
133 |
|
|
134 |
#endif /* CDIALERTOOLBAR_H_ */
|