|
1 /* |
|
2 * ============================================================================ |
|
3 * Name : CTestAppContainer from TestAppContainer.h |
|
4 * Part of : TestApp |
|
5 * Created : 08.10.2004 by Jalemine |
|
6 * Implementation notes: |
|
7 * Initial content was generated by Series 60 AppWizard. |
|
8 * Version : |
|
9 * Copyright: Digia |
|
10 * ============================================================================ |
|
11 */ |
|
12 |
|
13 // INCLUDE FILES |
|
14 #include "TestAppContainer.h" |
|
15 #include <aknlists.h> |
|
16 #include <AknsUtils.h> |
|
17 #include <AppLayout.cdl.h> |
|
18 #include <AknIconUtils.h> |
|
19 #include <AknsConstants.h> |
|
20 #include <AknsDrawUtils.h> |
|
21 #include <AknsBasicBackgroundControlContext.h> |
|
22 |
|
23 // ================= MEMBER FUNCTIONS ======================= |
|
24 |
|
25 // --------------------------------------------------------- |
|
26 // CTestAppContainer::ConstructL(const TRect& aRect) |
|
27 // EPOC two phased constructor |
|
28 // --------------------------------------------------------- |
|
29 // |
|
30 void CTestAppContainer::ConstructL(const TRect& aRect) |
|
31 { |
|
32 CreateWindowL(); |
|
33 |
|
34 // Get the skin instance |
|
35 iSkinInstance = AknsUtils::SkinInstance(); |
|
36 |
|
37 // Create background control context for skinning the background |
|
38 iBackgroundSkinContext = CAknsBasicBackgroundControlContext::NewL( |
|
39 KAknsIIDSkinBmpMainPaneUsual, aRect, ETrue ); |
|
40 |
|
41 iListBox = new (ELeave) CEikTextListBox; |
|
42 iListBox->SetContainerWindowL( *this ); |
|
43 iListBox->ConstructL( this ); |
|
44 |
|
45 iItems = new( ELeave )CDesCArrayFlat( 4 ); |
|
46 iListBox->Model()->SetItemTextArray( iItems ); |
|
47 iListBox->Model()->SetOwnershipType( ELbmOwnsItemArray ); |
|
48 iListBox->SetMopParent( this ); |
|
49 |
|
50 SetRect(aRect); |
|
51 ActivateL(); |
|
52 } |
|
53 |
|
54 // Destructor |
|
55 CTestAppContainer::~CTestAppContainer() |
|
56 { |
|
57 delete iListBox; |
|
58 delete iBackgroundSkinContext; |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------- |
|
62 // CTestAppContainer::SizeChanged() |
|
63 // Called by framework when the view size is changed |
|
64 // --------------------------------------------------------- |
|
65 // |
|
66 void CTestAppContainer::SizeChanged() |
|
67 { |
|
68 iListBox->SetRect( Rect() ); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CTestAppContainer::CountComponentControls() const |
|
73 // --------------------------------------------------------- |
|
74 // |
|
75 TInt CTestAppContainer::CountComponentControls() const |
|
76 { |
|
77 return 1; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------- |
|
81 // CTestAppContainer::AppendData |
|
82 // --------------------------------------------------------- |
|
83 // |
|
84 void CTestAppContainer::AppendDataL( TDesC& buf ) |
|
85 { |
|
86 iItems->AppendL( buf ); |
|
87 iListBox->HandleItemAdditionL(); |
|
88 TInt focus = iItems->Count()-1; |
|
89 if ( focus < 0 ) |
|
90 focus=0; |
|
91 iListBox->SetCurrentItemIndexAndDraw( focus ); |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CTestAppContainer::ComponentControl(TInt aIndex) const |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 CCoeControl* CTestAppContainer::ComponentControl(TInt aIndex) const |
|
99 { |
|
100 switch ( aIndex ) |
|
101 { |
|
102 case 0: |
|
103 return iListBox; |
|
104 default: |
|
105 return NULL; |
|
106 } |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------- |
|
110 // CTestAppContainer::Draw(const TRect& aRect) const |
|
111 // --------------------------------------------------------- |
|
112 // |
|
113 void CTestAppContainer::Draw(const TRect& /*aRect*/) const |
|
114 { |
|
115 CWindowGc& gc = SystemGc(); |
|
116 |
|
117 AknsDrawUtils::Background( iSkinInstance, |
|
118 iBackgroundSkinContext, this, gc, Rect() ); |
|
119 } |
|
120 |
|
121 // --------------------------------------------------------- |
|
122 // CTestAppContainer::HandleControlEventL( |
|
123 // CCoeControl* aControl,TCoeEvent aEventType) |
|
124 // --------------------------------------------------------- |
|
125 // |
|
126 void CTestAppContainer::HandleControlEventL( |
|
127 CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) |
|
128 { |
|
129 } |
|
130 |
|
131 // End of File |