|
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: |
|
15 * Declares portal button for WidgetManager |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef ___WMPORTALBUTTON_H__ |
|
20 #define ___WMPORTALBUTTON_H__ |
|
21 |
|
22 #include <aknbutton.h> // CAknButton |
|
23 #include "wmimageconverter.h" |
|
24 #include "wmcommon.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CWmMainContainer; |
|
28 |
|
29 /** |
|
30 * Portal button ( ovi, operator ) class for Wm |
|
31 * |
|
32 * @class CWmPortalButton wmportalbutton.h |
|
33 */ |
|
34 NONSHARABLE_CLASS( CWmPortalButton ) : public CAknButton, |
|
35 public MConverterObserver |
|
36 { |
|
37 public: |
|
38 /* |
|
39 * Two-phased constructor. |
|
40 * |
|
41 * @param aParent button title text |
|
42 * @param aText button title text |
|
43 * @param aUrl Url to open in browser when clicked. |
|
44 * @param aButtonCtrlId type of button |
|
45 */ |
|
46 static CWmPortalButton* NewL( |
|
47 const CCoeControl* aParent, |
|
48 const TDesC& aText = KNullDesC, |
|
49 const TDesC& aUrl = KNullDesC, |
|
50 TWmUiControlIds aButtonCtrlId = EOviPortal ); |
|
51 |
|
52 /** Destructor */ |
|
53 virtual ~CWmPortalButton(); |
|
54 |
|
55 public: // Functions from base class |
|
56 |
|
57 /** |
|
58 * Handles key events. |
|
59 * |
|
60 * @see CCoeControl::OfferKeyEventL |
|
61 */ |
|
62 TKeyResponse OfferKeyEventL( |
|
63 const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
64 |
|
65 /** |
|
66 * Handles pointer events. |
|
67 * |
|
68 * @see CCoeControl::HandlePointerEventL |
|
69 */ |
|
70 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
71 |
|
72 /* |
|
73 * Draws the control. |
|
74 * |
|
75 * @see CCoeControl::Draw |
|
76 */ |
|
77 void Draw( const TRect& /*aRect*/ ) const; |
|
78 |
|
79 /** |
|
80 * Sets the control's extent, specifying a rectangle. |
|
81 * |
|
82 * @see CCoeControl::SizeChanged |
|
83 */ |
|
84 void SizeChanged(); |
|
85 |
|
86 protected: // from MConverterObserver |
|
87 |
|
88 /** image conversin completed */ |
|
89 void NotifyCompletion( TInt aError ); |
|
90 |
|
91 protected: // Constructors |
|
92 |
|
93 /** Constructor for performing 1st stage construction */ |
|
94 CWmPortalButton( const TInt aFlags, |
|
95 TWmUiControlIds aButtonCtrlId = EOviPortal ); |
|
96 |
|
97 /** 2nd phase constructor */ |
|
98 void ConstructL( |
|
99 const CCoeControl* aParent, |
|
100 const TDesC& aText = KNullDesC, |
|
101 const TDesC& aUrl = KNullDesC ); |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * Draws text over button |
|
107 */ |
|
108 void DrawText( CWindowGc& aGc, |
|
109 const TDesC& aText, |
|
110 TAknTextComponentLayout& aLayout, |
|
111 TInt aMargin ) const; |
|
112 |
|
113 private: //data members |
|
114 /** |
|
115 * Button text |
|
116 */ |
|
117 HBufC* iText; |
|
118 |
|
119 /** |
|
120 * Url assigned to button |
|
121 */ |
|
122 HBufC* iUrl; |
|
123 |
|
124 /** |
|
125 * the image converter utility |
|
126 */ |
|
127 CWmImageConverter* iImageConverter; |
|
128 |
|
129 /** |
|
130 * Parent control |
|
131 */ |
|
132 CWmMainContainer* iWmMainContainer; |
|
133 |
|
134 /** |
|
135 * Button ctrl id |
|
136 */ |
|
137 TWmUiControlIds iButtonCtrlId; |
|
138 }; |
|
139 |
|
140 #endif //___WMPORTALBUTTON_H__ |
|
141 |
|
142 // End of File |