1 /* |
|
2 * Copyright (c) 2007-2008 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: custom control class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "cimcvappcustomdraw.h" |
|
23 |
|
24 #include <AknsSkinInstance.h> |
|
25 #include <AknsUtils.h> |
|
26 #include <AknsDrawUtils.h> |
|
27 #include <eikenv.h> |
|
28 #include <eikappui.h> |
|
29 |
|
30 #include <AknsDrawUtils.h> |
|
31 #include <AknsBasicBackgroundControlContext.h> |
|
32 #include <biditext.h> // A/H |
|
33 #include <AknBidiTextUtils.h> |
|
34 #include <aknlayout.cdl.h> //cdl |
|
35 #include <applayout.cdl.h> //cdl |
|
36 #include <AknUtils.h> |
|
37 #include "imcvlogger.h" |
|
38 |
|
39 // ============================ MEMBER FUNCTIONS =============================== |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CIMCVAppCustomDraw::CIMCVAppCustomDraw |
|
43 // C++ default constructor can NOT contain any code, that |
|
44 // might leave. |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 CIMCVAppCustomDraw::CIMCVAppCustomDraw( TRect aViewRect ) |
|
48 :iViewRect( aViewRect ) |
|
49 { |
|
50 } |
|
51 |
|
52 // Destructor |
|
53 CIMCVAppCustomDraw::~CIMCVAppCustomDraw() |
|
54 { |
|
55 |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CIMCVAppCustomDraw::SetRect |
|
60 // (other items were commented in a header). |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void CIMCVAppCustomDraw::SetRect( const TRect& aRect ) |
|
64 { |
|
65 IM_CV_LOGS(TXT("CIMCVAppCustomDraw::SetRect() start" )); |
|
66 iViewRect = aRect; |
|
67 IM_CV_LOGS(TXT("CIMCVAppCustomDraw::SetRect() end" )); |
|
68 } |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // CIMCVAppCustomDraw::DrawBackground |
|
72 // (other items were commented in a header). |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 void CIMCVAppCustomDraw::DrawBackground( const TParam& aParam, |
|
76 const TRgb& aBackground, |
|
77 TRect& aDrawn ) const |
|
78 { |
|
79 IM_CV_LOGS(TXT("CIMCVAppCustomDraw::DrawBackground() start" )); |
|
80 if( aBackground != KRgbWhite || !iBgContext ) |
|
81 { |
|
82 // draw background with color |
|
83 aParam.iGc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
84 aParam.iGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
85 aParam.iGc.SetBrushColor( aBackground ); |
|
86 aParam.iGc.DrawRect( aParam.iDrawRect ); |
|
87 } |
|
88 // if background is white -> we draw the skinned background |
|
89 else |
|
90 { |
|
91 //Draw the skin background |
|
92 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
93 AknsDrawUtils::Background( skin, |
|
94 iBgContext, |
|
95 iParent, |
|
96 static_cast<CWindowGc&>(aParam.iGc), |
|
97 aParam.iDrawRect); |
|
98 |
|
99 } |
|
100 aDrawn = aParam.iDrawRect; |
|
101 IM_CV_LOGS(TXT("CIMCVAppCustomDraw::DrawBackground() end" )); |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // CIMCVAppCustomDraw::SetBackgroundContext |
|
106 // (other items were commented in a header). |
|
107 // ----------------------------------------------------------------------------- |
|
108 // |
|
109 void CIMCVAppCustomDraw::SetBackgroundContext( CAknsBasicBackgroundControlContext* aBgContext, |
|
110 CCoeControl* aParent ) |
|
111 { |
|
112 IM_CV_LOGS(TXT("CIMCVAppCustomDraw::SetBackgroundContext() start" )); |
|
113 iBgContext = aBgContext; |
|
114 iParent = aParent; |
|
115 IM_CV_LOGS(TXT("CIMCVAppCustomDraw::SetBackgroundContext() end" )); |
|
116 } |
|
117 |
|
118 // End of File |
|