|
1 /* |
|
2 * Copyright (c) 2002 - 2007 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: misc_controls_api |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "testsdkmisccontrolcontainer.h" |
|
19 // --------------------------------------------------------------------------- |
|
20 // C++ default Constructor |
|
21 // --------------------------------------------------------------------------- |
|
22 // |
|
23 CMiscControlsContainer::CMiscControlsContainer() |
|
24 { |
|
25 |
|
26 } |
|
27 // --------------------------------------------------------------------------- |
|
28 // Destructor |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CMiscControlsContainer::~CMiscControlsContainer() |
|
32 { |
|
33 |
|
34 ResetControl(); |
|
35 |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // Symbian 2nd Constructor |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CMiscControlsContainer::ConstructL(const TRect& aRect) |
|
43 { |
|
44 CreateWindowL(); |
|
45 SetRect(aRect); |
|
46 ActivateL(); |
|
47 |
|
48 } |
|
49 |
|
50 // ---------------------------------------------------------------------------- |
|
51 // CMiscControlsContainer::Draw |
|
52 // Fills the window's rectangle. |
|
53 // ---------------------------------------------------------------------------- |
|
54 // |
|
55 void CMiscControlsContainer::Draw(const TRect& aRect) const |
|
56 { |
|
57 CWindowGc& gc = SystemGc(); |
|
58 gc.SetPenStyle(CGraphicsContext::ENullPen); |
|
59 gc.SetBrushColor( KRgbGray); |
|
60 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
61 gc.DrawRect(aRect); |
|
62 } |
|
63 // --------------------------------------------------------------------------- |
|
64 // CMiscControlsContainer::CountComponentControls |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 TInt CMiscControlsContainer::CountComponentControls() const |
|
68 { |
|
69 if (iControl) |
|
70 { |
|
71 return 1; |
|
72 } |
|
73 else |
|
74 { |
|
75 return 0; |
|
76 } |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CMiscControlsContainer::ComponentControl |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 CCoeControl* CMiscControlsContainer::ComponentControl(TInt) const |
|
84 { |
|
85 return iControl; |
|
86 } |
|
87 |
|
88 // --------------------------------------------------------------------------- |
|
89 // CMiscControlsContainer::SetControlL |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CMiscControlsContainer::SetControlL(CCoeControl* aControl) |
|
93 { |
|
94 iControl = aControl; |
|
95 if (iControl) |
|
96 { |
|
97 // You can change the position and size |
|
98 iControl->SetExtent(Rect().iTl, Rect().Size() ); |
|
99 iControl->ActivateL(); |
|
100 DrawNow(); |
|
101 } |
|
102 } |
|
103 |
|
104 // --------------------------------------------------------------------------- |
|
105 // CMiscControlsContainer::ResetControl |
|
106 // --------------------------------------------------------------------------- |
|
107 // |
|
108 void CMiscControlsContainer::ResetControl() |
|
109 { |
|
110 delete iControl; |
|
111 iControl = NULL; |
|
112 } |
|
113 |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // CMiscControlsContainer::GetCoeEnv |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 CCoeEnv* CMiscControlsContainer::GetCoeEnv() |
|
120 { |
|
121 return iCoeEnv; |
|
122 } |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CMiscControlsContainer::ActivateGc |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 void CMiscControlsContainer::ActivateGc() const |
|
128 { |
|
129 CCoeControl::ActivateGc(); |
|
130 } |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CMiscControlsContainer::DeactivateGc |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 void CMiscControlsContainer::DeactivateGc() const |
|
136 { |
|
137 CCoeControl::DeactivateGc(); |
|
138 } |