|
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: CMnrpAppControlclass implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <coemain.h> |
|
20 #include <AknDef.h> |
|
21 #include "mnrpappview.h" |
|
22 #include "mnrpappcontrol.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // ----------------------------------------------------------------------------- |
|
28 // |
|
29 CMnrpAppControl::CMnrpAppControl( CMnrpAppView& aView ) |
|
30 : iView( aView ) |
|
31 { |
|
32 } |
|
33 |
|
34 // ----------------------------------------------------------------------------- |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 CMnrpAppControl::~CMnrpAppControl() |
|
38 { |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 CMnrpAppControl* CMnrpAppControl::NewL( CMnrpAppView& aView, const TRect& aRect) |
|
45 { |
|
46 CMnrpAppControl* self = new (ELeave) CMnrpAppControl( aView ); |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL( aRect ); |
|
49 CleanupStack::Pop( self ); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // ----------------------------------------------------------------------------- |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 TInt CMnrpAppControl::CountComponentControls() const |
|
57 { |
|
58 return 0; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 CCoeControl* CMnrpAppControl::ComponentControl( TInt /*aIndex*/ ) const |
|
65 { |
|
66 return NULL; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 void CMnrpAppControl::ConstructL( const TRect& aRect ) |
|
73 { |
|
74 // Create a window for this application view |
|
75 CreateWindowL(); |
|
76 |
|
77 // Set the windows size |
|
78 SetRect( aRect ); |
|
79 |
|
80 // Activate the window, which makes it ready to be drawn |
|
81 ActivateL(); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void CMnrpAppControl::Draw( const TRect& /*aRect*/ ) const |
|
88 { |
|
89 // Get the standard graphics context |
|
90 CWindowGc& gc = SystemGc(); |
|
91 |
|
92 // Gets the control's extent |
|
93 TRect rect = Rect(); |
|
94 |
|
95 // Clears the screen |
|
96 gc.Clear( rect ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 void CMnrpAppControl::HandleResourceChange( TInt aType ) |
|
103 { |
|
104 CCoeControl::HandleResourceChange( aType ); |
|
105 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
106 { |
|
107 SetRect( iView.ClientRect() ); |
|
108 } |
|
109 } |