|
1 /* |
|
2 * Copyright (c) 2006 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: CVtUiToolbarButton class definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_VTUITOOLBARBUTTON_H |
|
20 #define C_VTUITOOLBARBUTTON_H |
|
21 |
|
22 #include <aknbutton.h> |
|
23 |
|
24 class CVtUiAppUi; |
|
25 |
|
26 /** |
|
27 * CVtUiToolbarButton |
|
28 * |
|
29 * Toolbar button class definition. |
|
30 * |
|
31 * @since S60 3.2 |
|
32 */ |
|
33 class CVtUiToolbarButton : public CAknButton |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Static constructor. |
|
39 * @param aResourceId Resource id. |
|
40 * @param aAppUi Reference to appui. |
|
41 * @param aCmdId Reference to command id. |
|
42 */ |
|
43 static CVtUiToolbarButton* NewL( TInt aResourceId, |
|
44 CVtUiAppUi& aAppUi, TInt aCmdId ); |
|
45 |
|
46 /** |
|
47 * Static constructor. |
|
48 * @param aResourceId Resource id. |
|
49 * @param aAppUi Reference to appui. |
|
50 * @param aCmdId Reference to command id. |
|
51 */ |
|
52 static CVtUiToolbarButton* NewLC( TInt aResourceId, |
|
53 CVtUiAppUi& aAppUi, TInt aCmdId ); |
|
54 |
|
55 /** |
|
56 * C++ destructor. |
|
57 */ |
|
58 ~CVtUiToolbarButton(); |
|
59 |
|
60 /* |
|
61 * Shows help text for a certain period of time. |
|
62 */ |
|
63 void ShowHelpL(); |
|
64 |
|
65 /* |
|
66 * Return commmand id |
|
67 */ |
|
68 TInt CmdId() const; |
|
69 |
|
70 /* |
|
71 * Starts or stops to block pointer events |
|
72 * @param aIsBlocking ETrue if events are blocked |
|
73 * otherwise EFalse |
|
74 */ |
|
75 void BlockPointerEvents( TBool aIsBlocking ); |
|
76 |
|
77 /* |
|
78 * Starts or stops to block key events |
|
79 * @param aIsBlocking ETrue if events are blocked |
|
80 * otherwise EFalse |
|
81 */ |
|
82 void BlockKeyEvents( TBool aIsBlocking ); |
|
83 |
|
84 |
|
85 /* @see CAknButton::OfferKeyEventL */ |
|
86 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
87 TEventCode aType ); |
|
88 |
|
89 /* @see CAknButton::HandlePointerEventL */ |
|
90 void HandlePointerEventL( const TPointerEvent& |
|
91 aPointerEvent ); |
|
92 |
|
93 /* @see CAknButton::StatesCount */ |
|
94 TInt StatesCount() const; |
|
95 |
|
96 private: |
|
97 |
|
98 /** |
|
99 * Constructor |
|
100 */ |
|
101 CVtUiToolbarButton( CVtUiAppUi& aAppUi, TInt aCmdId ); |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * Checks whether key events should be blocked. |
|
107 */ |
|
108 TBool IsCommandActive() const; |
|
109 |
|
110 private: |
|
111 |
|
112 // reference to appui |
|
113 CVtUiAppUi& iAppUi; |
|
114 |
|
115 // command id |
|
116 TInt iCmdId; |
|
117 |
|
118 // Flag to indicate is key event blocking on |
|
119 TBool iIsBlockingKeyEvents; |
|
120 |
|
121 // Flag to indicate is pointer event blocking on |
|
122 TBool iIsBlockingPointerEvents; |
|
123 |
|
124 // time stamp to limit pointerevents |
|
125 TTime iTimeStamp; |
|
126 |
|
127 TBool isLimitingPointers; |
|
128 |
|
129 }; |
|
130 |
|
131 #endif // C_VTUITOOLBARBUTTON_H |