|
1 /* |
|
2 * Copyright (c) 2003 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: LandmarksUi Content File - |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include <AknsUtils.h> |
|
26 #include <avkon.hrh> |
|
27 #include <eiklabel.h> |
|
28 #include "LmUiRefAppUi.h" |
|
29 #include <lmuirefapp.rsg> |
|
30 #include "lmuirefapp.hrh" |
|
31 #include "LmUiRefAppView.h" |
|
32 #include "LmUiRefAppContainer.h" |
|
33 |
|
34 _LIT(KLmUiRefApp, "Landmarks UI Reference"); |
|
35 _LIT(KTextApp, "Application!"); |
|
36 |
|
37 const TInt KLable1X(20); |
|
38 const TInt KLable1Y(50); |
|
39 const TInt KLable2X(50); |
|
40 const TInt KLable2Y(80); |
|
41 |
|
42 // ================= MEMBER FUNCTIONS ======================= |
|
43 |
|
44 // ---------------------------------------------------------------------------- |
|
45 // CLmUiRefAppContainer::NewL |
|
46 // ---------------------------------------------------------------------------- |
|
47 // |
|
48 CLmUiRefAppContainer* CLmUiRefAppContainer::NewL( |
|
49 MObjectProvider* aParent, |
|
50 const TRect& aRect ) |
|
51 { |
|
52 CLmUiRefAppContainer* self = |
|
53 new( ELeave ) CLmUiRefAppContainer(); |
|
54 CleanupStack::PushL( self ); |
|
55 self->SetMopParent( aParent ); |
|
56 self->ConstructL( aRect ); |
|
57 CleanupStack::Pop(self ); // self |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ---------------------------------------------------------------------------- |
|
62 // CLmUiRefAppContainer::ConstructL |
|
63 // ---------------------------------------------------------------------------- |
|
64 void CLmUiRefAppContainer::ConstructL(const TRect& aRect) |
|
65 { |
|
66 CreateWindowL(); |
|
67 |
|
68 iLabel = new (ELeave) CEikLabel; |
|
69 iLabel->SetContainerWindowL(*this); |
|
70 iLabel->SetTextL(KLmUiRefApp); |
|
71 iToDoLabel = new (ELeave) CEikLabel; |
|
72 iToDoLabel->SetContainerWindowL( *this ); |
|
73 iToDoLabel->SetTextL(KTextApp); |
|
74 SetRect(aRect); |
|
75 ActivateL(); |
|
76 } |
|
77 |
|
78 // ---------------------------------------------------------------------------- |
|
79 // CLmUiRefAppContainer::CLmUiRefAppContainer() |
|
80 // ---------------------------------------------------------------------------- |
|
81 CLmUiRefAppContainer::CLmUiRefAppContainer() |
|
82 { |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CLmUiRefAppContainer::~CLmUiRefAppContainer() |
|
87 // ---------------------------------------------------------------------------- |
|
88 CLmUiRefAppContainer::~CLmUiRefAppContainer() |
|
89 { |
|
90 delete iLabel; |
|
91 delete iToDoLabel; |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CLmUiRefAppContainer::SizeChanged() |
|
96 // Called by framework when the view size is changed |
|
97 // --------------------------------------------------------- |
|
98 // |
|
99 void CLmUiRefAppContainer::SizeChanged() |
|
100 { |
|
101 // TODO: Add here control resize code etc. |
|
102 iLabel->SetExtent(TPoint(KLable1X, KLable1Y), iLabel->MinimumSize()); |
|
103 iToDoLabel->SetExtent(TPoint(KLable2X, KLable2Y), iToDoLabel->MinimumSize()); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // CLmUiRefAppContainer::CountComponentControls() const |
|
108 // return number of controls inside this container |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 TInt CLmUiRefAppContainer::CountComponentControls() const |
|
112 { |
|
113 return 2; // return nbr of controls inside this container |
|
114 } |
|
115 |
|
116 // --------------------------------------------------------- |
|
117 // CLmUiRefAppContainer::ComponentControl(TInt aIndex) const |
|
118 // return control inside the container |
|
119 // --------------------------------------------------------- |
|
120 // |
|
121 CCoeControl* CLmUiRefAppContainer::ComponentControl(TInt aIndex) const |
|
122 { |
|
123 switch ( aIndex ) |
|
124 { |
|
125 case 0: |
|
126 return iLabel; |
|
127 case 1: |
|
128 return iToDoLabel; |
|
129 default: |
|
130 return NULL; |
|
131 } |
|
132 } |
|
133 |
|
134 // --------------------------------------------------------- |
|
135 // CLmUiRefAppContainer::Draw(Trect& aRect) |
|
136 // --------------------------------------------------------- |
|
137 // |
|
138 void CLmUiRefAppContainer::Draw(const TRect& /*aRect*/) const |
|
139 { |
|
140 // Get the standard graphics context |
|
141 CWindowGc& gc = SystemGc(); |
|
142 // TODO: Add your drawing code here |
|
143 // example code... |
|
144 gc.SetPenStyle(CGraphicsContext::ENullPen); |
|
145 gc.SetBrushColor(KRgbGray); |
|
146 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
147 TRect rect = Rect(); |
|
148 gc.DrawRect(rect); |
|
149 } |
|
150 |
|
151 // End of File |