|
1 /* |
|
2 * Copyright (c) 2007-2007 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: Native ui controller view. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <AknsDrawUtils.h> |
|
20 #include <AknsUtils.h> |
|
21 #include <AknUtils.h> |
|
22 #include "appui.h" |
|
23 #include "ainativeuiview.h" |
|
24 |
|
25 using namespace AiNativeUiController; |
|
26 |
|
27 CAiNativeUiView::CAiNativeUiView( CAppUi* aAppUi ) |
|
28 : iAppUi( aAppUi ) |
|
29 { |
|
30 } |
|
31 |
|
32 void CAiNativeUiView::ConstructL( const TRect& aRect ) |
|
33 { |
|
34 CreateWindowL(); |
|
35 SetRect( aRect ); |
|
36 ActivateL(); |
|
37 } |
|
38 |
|
39 CAiNativeUiView* CAiNativeUiView::NewL( |
|
40 const TRect& aRect, |
|
41 CAppUi* aAppUi ) |
|
42 { |
|
43 CAiNativeUiView* self = |
|
44 new (ELeave) CAiNativeUiView( aAppUi ); |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL( aRect ); |
|
47 CleanupStack::Pop(self); |
|
48 return self; |
|
49 } |
|
50 |
|
51 CAiNativeUiView::~CAiNativeUiView() |
|
52 { |
|
53 } |
|
54 |
|
55 void CAiNativeUiView::SizeChanged() |
|
56 { |
|
57 if( iControl ) |
|
58 { |
|
59 iControl->SetRect( Rect() ); |
|
60 } |
|
61 } |
|
62 |
|
63 TInt CAiNativeUiView::CountComponentControls() const |
|
64 { |
|
65 if( iControl ) |
|
66 { |
|
67 return 1; |
|
68 } |
|
69 else |
|
70 { |
|
71 return 0; |
|
72 } |
|
73 } |
|
74 |
|
75 CCoeControl* CAiNativeUiView::ComponentControl( TInt /*aIndex*/ ) const |
|
76 { |
|
77 return iControl; |
|
78 } |
|
79 |
|
80 TKeyResponse CAiNativeUiView::OfferKeyEventL( |
|
81 const TKeyEvent& aKeyEvent, |
|
82 TEventCode aType ) |
|
83 { |
|
84 if( iControl ) |
|
85 { |
|
86 return iControl->OfferKeyEventL( aKeyEvent, aType ); |
|
87 } |
|
88 return EKeyWasNotConsumed; |
|
89 } |
|
90 |
|
91 void CAiNativeUiView::Draw( const TRect& aRect ) const |
|
92 { |
|
93 TRect rect = Rect(); |
|
94 if ( !rect.iTl.iY ) |
|
95 { |
|
96 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
97 MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); |
|
98 CWindowGc& gc = SystemGc(); |
|
99 |
|
100 if ( !AknsDrawUtils::Background( skin, cc, this, gc, aRect ) ) |
|
101 { |
|
102 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
103 gc.SetBrushColor( AKN_LAF_COLOR( 0 ) ); |
|
104 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
105 gc.DrawRect( aRect ); |
|
106 } |
|
107 } |
|
108 } |
|
109 |
|
110 TVwsViewId CAiNativeUiView::ViewId() const |
|
111 { |
|
112 return TVwsViewId( TUid::Uid( 0x102750F0 ), TUid::Uid( 0x102750F0 ) ); |
|
113 } |
|
114 |
|
115 void CAiNativeUiView::ViewActivatedL( const TVwsViewId& /*aPrevViewId*/, |
|
116 TUid /*aCustomMessageId*/, |
|
117 const TDesC8& /*aCustomMessage*/ ) |
|
118 { |
|
119 } |
|
120 |
|
121 void CAiNativeUiView::ViewDeactivated() |
|
122 { |
|
123 } |
|
124 |
|
125 void CAiNativeUiView::SetControl( CCoeControl* aControl ) |
|
126 { |
|
127 iControl = aControl; |
|
128 } |
|
129 |
|
130 // End of File. |