|
1 /* |
|
2 * Copyright (c) 2005 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "cenrepeditorview1container.h" |
|
21 #include "cenrepeditordocument.h" |
|
22 #include "cenrepeditorappui.h" |
|
23 #include "cenrepeditormodel.h" |
|
24 |
|
25 |
|
26 |
|
27 #include <eiklabel.h> // for example label control |
|
28 |
|
29 |
|
30 // ================= MEMBER FUNCTIONS ======================= |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // CCenrepEditorView1Container::ConstructL(const TRect& aRect) |
|
34 // EPOC two phased constructor |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 void CCenrepEditorView1Container::ConstructL(const TRect& aRect,TInt aResourceId, CPhoneResources* aPhoneResources) |
|
38 { |
|
39 CreateWindowL(); |
|
40 iPhoneResourceListBox = new(ELeave)CPhoneResourcesListbox; |
|
41 // and put the data in the list |
|
42 iPhoneResourceListBox->SetData(aPhoneResources); |
|
43 // setting list is constructed from resources |
|
44 iPhoneResourceListBox->ConstructFromResourceL(aResourceId); |
|
45 SetRect(aRect); |
|
46 iPhoneResourceListBox->MakeVisible(ETrue); |
|
47 iPhoneResourceListBox->SetRect(aRect); |
|
48 iPhoneResourceListBox->LoadSettingsL(); |
|
49 iPhoneResourceListBox->ActivateL(); |
|
50 ActivateL(); |
|
51 } |
|
52 |
|
53 // Destructor |
|
54 CCenrepEditorView1Container::~CCenrepEditorView1Container() |
|
55 { |
|
56 iPhoneResourceListBox->StoreSettingsL(); |
|
57 delete iPhoneResourceListBox; |
|
58 iPhoneResourceListBox = NULL; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CCenrepEditorView1Container::SizeChanged() |
|
63 // Called by framework when the view size is changed |
|
64 // --------------------------------------------------------- |
|
65 // |
|
66 void CCenrepEditorView1Container::SizeChanged() |
|
67 { |
|
68 // TODO: Add here control resize code etc. |
|
69 iPhoneResourceListBox->SetRect(Rect()); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------- |
|
73 // CCenrepEditorView1Container::CountComponentControls() const |
|
74 // --------------------------------------------------------- |
|
75 // |
|
76 TInt CCenrepEditorView1Container::CountComponentControls() const |
|
77 { |
|
78 TInt count = 0; |
|
79 if(iPhoneResourceListBox) |
|
80 count++; |
|
81 return count; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------- |
|
85 // CCenrepEditorView1Container::ComponentControl(TInt aIndex) const |
|
86 // --------------------------------------------------------- |
|
87 // |
|
88 CCoeControl* CCenrepEditorView1Container::ComponentControl(TInt /*aIndex*/) const |
|
89 { |
|
90 return iPhoneResourceListBox; |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // CCenrepEditorView1Container::Draw(const TRect& aRect) const |
|
95 // --------------------------------------------------------- |
|
96 // |
|
97 void CCenrepEditorView1Container::Draw(const TRect& aRect) const |
|
98 { |
|
99 CWindowGc& gc = SystemGc(); |
|
100 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
101 gc.SetBrushColor( KRgbGray ); |
|
102 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
103 gc.DrawRect( aRect ); |
|
104 |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // CCenrepEditorView1Container::OfferKeyEventL( |
|
109 // const TKeyEvent& aKeyEvent, |
|
110 // TEventCode aType ) |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 TKeyResponse CCenrepEditorView1Container::OfferKeyEventL( |
|
114 const TKeyEvent& aKeyEvent, |
|
115 TEventCode aType ) |
|
116 { |
|
117 if(aType != EEventKey) // Is not key event? |
|
118 { |
|
119 return EKeyWasNotConsumed; |
|
120 } |
|
121 switch (aKeyEvent.iCode) |
|
122 { |
|
123 case EKeyLeftArrow: |
|
124 case EKeyRightArrow: |
|
125 return EKeyWasNotConsumed; |
|
126 default: |
|
127 if(iPhoneResourceListBox) |
|
128 { |
|
129 return iPhoneResourceListBox->OfferKeyEventL( aKeyEvent, aType ); |
|
130 } |
|
131 else |
|
132 { |
|
133 return EKeyWasNotConsumed; |
|
134 } |
|
135 |
|
136 } |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------- |
|
140 // CCenrepEditorView1Container::StoreSettingsL() |
|
141 // Store the Settings to Variable |
|
142 // --------------------------------------------------------- |
|
143 // |
|
144 void CCenrepEditorView1Container::StoreSettingsL() |
|
145 { |
|
146 iPhoneResourceListBox->StoreSettingsL(); |
|
147 } |
|
148 |
|
149 |
|
150 // End of File |