2 ========================================================================
3 Name : ComingNext_SkinFetcherContainer.cpp
4 Author : Michael Prager
5 Copyright : Licensed under GPLv3
7 ========================================================================
9 // [[[ begin generated region: do not modify [Generated System Includes]
11 #include <stringloader.h>
14 #include <aknviewappui.h>
16 #include <ComingNext_SkinFetcher.rsg>
17 // ]]] end generated region [Generated System Includes]
19 // [[[ begin generated region: do not modify [Generated User Includes]
20 #include "ComingNext_SkinFetcherContainer.h"
21 #include "ComingNext_SkinFetcherContainerView.h"
22 #include "ComingNext_SkinFetcher.hrh"
23 #include "ComingNext_SkinFetcherContainer.hrh"
24 // ]]] end generated region [Generated User Includes]
26 // [[[ begin generated region: do not modify [Generated Constants]
27 // ]]] end generated region [Generated Constants]
30 * First phase of Symbian two-phase construction. Should not
31 * contain any code that could leave.
33 CComingNext_SkinFetcherContainer::CComingNext_SkinFetcherContainer()
35 // [[[ begin generated region: do not modify [Generated Contents]
37 // ]]] end generated region [Generated Contents]
41 * Destroy child controls.
43 CComingNext_SkinFetcherContainer::~CComingNext_SkinFetcherContainer()
45 // [[[ begin generated region: do not modify [Generated Contents]
48 // ]]] end generated region [Generated Contents]
53 * Construct the control (first phase).
54 * Creates an instance and initializes it.
55 * Instance is not left on cleanup stack.
56 * @param aRect bounding rectangle
57 * @param aParent owning parent, or NULL
58 * @param aCommandObserver command observer
59 * @return initialized instance of CComingNext_SkinFetcherContainer
61 CComingNext_SkinFetcherContainer
* CComingNext_SkinFetcherContainer::NewL(
62 const TRect
& aRect
, const CCoeControl
* aParent
,
63 MEikCommandObserver
* aCommandObserver
)
65 CComingNext_SkinFetcherContainer
* self
=
66 CComingNext_SkinFetcherContainer::NewLC(aRect
, aParent
,
68 CleanupStack::Pop(self
);
73 * Construct the control (first phase).
74 * Creates an instance and initializes it.
75 * Instance is left on cleanup stack.
76 * @param aRect The rectangle for this window
77 * @param aParent owning parent, or NULL
78 * @param aCommandObserver command observer
79 * @return new instance of CComingNext_SkinFetcherContainer
81 CComingNext_SkinFetcherContainer
* CComingNext_SkinFetcherContainer::NewLC(
82 const TRect
& aRect
, const CCoeControl
* aParent
,
83 MEikCommandObserver
* aCommandObserver
)
85 CComingNext_SkinFetcherContainer
* self
=
86 new (ELeave
) CComingNext_SkinFetcherContainer();
87 CleanupStack::PushL(self
);
88 self
->ConstructL(aRect
, aParent
, aCommandObserver
);
93 * Construct the control (second phase).
94 * Creates a window to contain the controls and activates it.
95 * @param aRect bounding rectangle
96 * @param aCommandObserver command observer
97 * @param aParent owning parent, or NULL
99 void CComingNext_SkinFetcherContainer::ConstructL(const TRect
& aRect
,
100 const CCoeControl
* aParent
, MEikCommandObserver
* aCommandObserver
)
108 SetContainerWindowL(*aParent
);
110 iFocusControl
= NULL
;
111 iCommandObserver
= aCommandObserver
;
112 InitializeControlsL();
115 // [[[ begin generated region: do not modify [Post-ActivateL initializations]
116 // ]]] end generated region [Post-ActivateL initializations]
121 * Return the number of controls in the container (override)
124 TInt
CComingNext_SkinFetcherContainer::CountComponentControls() const
126 return (int) ELastControl
;
130 * Get the control with the given index (override)
131 * @param aIndex Control index [0...n) (limited by #CountComponentControls)
132 * @return Pointer to control
134 CCoeControl
* CComingNext_SkinFetcherContainer::ComponentControl(TInt aIndex
) const
136 // [[[ begin generated region: do not modify [Generated Contents]
142 // ]]] end generated region [Generated Contents]
144 // handle any user controls here...
150 * Handle resizing of the container. This implementation will lay out
151 * full-sized controls like list boxes for any screen size, and will layout
152 * labels, editors, etc. to the size they were given in the UI designer.
153 * This code will need to be modified to adjust arbitrary controls to
156 void CComingNext_SkinFetcherContainer::SizeChanged()
158 CCoeControl::SizeChanged();
160 // [[[ begin generated region: do not modify [Generated Contents]
162 // ]]] end generated region [Generated Contents]
166 // [[[ begin generated function: do not modify
168 * Layout components as specified in the UI Designer
170 void CComingNext_SkinFetcherContainer::LayoutControls()
172 iLabel1
->SetExtent( TPoint( 19, 19 ), TSize( 323, 312 ) );
174 // ]]] end generated function
179 TKeyResponse
CComingNext_SkinFetcherContainer::OfferKeyEventL(
180 const TKeyEvent
& aKeyEvent
, TEventCode aType
)
182 // [[[ begin generated region: do not modify [Generated Contents]
184 // ]]] end generated region [Generated Contents]
186 if (iFocusControl
!= NULL
187 && iFocusControl
->OfferKeyEventL(aKeyEvent
, aType
)
190 return EKeyWasConsumed
;
192 return CCoeControl::OfferKeyEventL(aKeyEvent
, aType
);
195 // [[[ begin generated function: do not modify
197 * Initialize each control upon creation.
199 void CComingNext_SkinFetcherContainer::InitializeControlsL()
201 iLabel1
= new ( ELeave
) CEikLabel
;
202 iLabel1
->SetContainerWindowL( *this );
204 TResourceReader reader
;
205 iEikonEnv
->CreateResourceReaderLC( reader
, R_COMING_NEXT_SKIN_FETCHER_CONTAINER_LABEL1
);
206 iLabel1
->ConstructFromResourceL( reader
);
207 CleanupStack::PopAndDestroy(); // reader internal state
211 // ]]] end generated function
214 * Handle global resource changes, such as scalable UI or skin events (override)
216 void CComingNext_SkinFetcherContainer::HandleResourceChange(TInt aType
)
218 CCoeControl::HandleResourceChange(aType
);
219 SetRect(iAvkonViewAppUi
->View(TUid::Uid(
220 EComingNext_SkinFetcherContainerViewId
))->ClientRect());
221 // [[[ begin generated region: do not modify [Generated Contents]
222 // ]]] end generated region [Generated Contents]
227 * Draw container contents.
229 void CComingNext_SkinFetcherContainer::Draw(const TRect
& aRect
) const
231 // [[[ begin generated region: do not modify [Generated Contents]
232 CWindowGc
& gc
= SystemGc();
235 // ]]] end generated region [Generated Contents]