|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __COECCNTX_H__ |
|
17 #define __COECCNTX_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <w32std.h> |
|
22 |
|
23 /** Interface to allow sharing of graphics settings between controls. |
|
24 |
|
25 The interface provides functions to set the graphics context of a control |
|
26 before drawing. If a control has its iContext member set, the UI Control Framework |
|
27 calls functions defined by this interface when a control is about to be drawn. |
|
28 Developers must implement PrepareContext(), which is called by the framework, |
|
29 to initialise the control's window with the required graphics settings. |
|
30 |
|
31 To use control contexts, a control should inherit from an MCoeControlContext-derived |
|
32 class. To share the context between controls, this control should then be |
|
33 set as the context for all controls that wish to share it. This is done by |
|
34 setting the iContext member of each of the controls, using CCoeControl::SetControlContext() |
|
35 and CCoeControl::CopyControlContextFrom(). |
|
36 |
|
37 @publishedAll |
|
38 @released */ |
|
39 class MCoeControlContext |
|
40 { |
|
41 public: |
|
42 IMPORT_C virtual void ActivateContext(CWindowGc& aGc,RDrawableWindow& aWindow) const; |
|
43 IMPORT_C virtual void ResetContext(CWindowGc& aGc) const; |
|
44 IMPORT_C virtual void PrepareContext(CWindowGc& aGc) const; |
|
45 protected: |
|
46 IMPORT_C MCoeControlContext(); |
|
47 |
|
48 private: |
|
49 IMPORT_C virtual void MCoeControlContext_Reserved1(); |
|
50 IMPORT_C virtual void MCoeControlContext_Reserved2(); |
|
51 |
|
52 private: |
|
53 TInt iMCoeControlContext_Reserved1; |
|
54 }; |
|
55 |
|
56 /** Brush and pen graphics context. |
|
57 |
|
58 This class allows an MCoeControlContext to be instantiated and used to set |
|
59 brush and pen properties before drawing a control. |
|
60 |
|
61 @publishedAll |
|
62 @released */ |
|
63 class CCoeBrushAndPenContext : public CBase, public MCoeControlContext |
|
64 { |
|
65 public: |
|
66 IMPORT_C static CCoeBrushAndPenContext* NewL(); |
|
67 // |
|
68 IMPORT_C void SetBrushStyle(CWindowGc::TBrushStyle aBrushStyle); |
|
69 IMPORT_C void SetBrushColor(TRgb aColor); |
|
70 IMPORT_C void SetBrushBitmap(const CFbsBitmap& aBitmap); |
|
71 IMPORT_C void SetPenColor(TRgb aColor); |
|
72 // |
|
73 IMPORT_C CWindowGc::TBrushStyle BrushStyle() const; |
|
74 IMPORT_C TRgb BrushColor() const; |
|
75 IMPORT_C const CFbsBitmap& BrushBitmap() const; |
|
76 IMPORT_C TRgb PenColor() const; |
|
77 protected: // from MCoeControlContext |
|
78 IMPORT_C void PrepareContext(CWindowGc& aGc) const; |
|
79 private: |
|
80 CCoeBrushAndPenContext(); |
|
81 private: |
|
82 CWindowGc::TBrushStyle iBrushStyle; |
|
83 TRgb iBrushColor; |
|
84 const CFbsBitmap* iBitmap; |
|
85 TRgb iPenColor; |
|
86 }; |
|
87 |
|
88 |
|
89 /** Protocol for sharing brush settings used in graphics operations. |
|
90 |
|
91 It can be used to set brush and pen properties before drawing a control. |
|
92 |
|
93 The mixin provides a default implementation of a control context. It implements |
|
94 PrepareContext() to initialise brush settings used in graphics operations. |
|
95 Its data members are public so that the brush style, brush colour and brush |
|
96 pattern can be set by application code. |
|
97 |
|
98 @publishedAll |
|
99 @deprecated */ |
|
100 class MCoeControlBrushContext : public MCoeControlContext |
|
101 { |
|
102 public: |
|
103 /** Cause vtable & typeinfo to be exported */ |
|
104 IMPORT_C MCoeControlBrushContext(); |
|
105 protected: // from MCoeControlContext |
|
106 IMPORT_C void PrepareContext(CWindowGc& aGc) const; |
|
107 public: |
|
108 /** Brush style. (Not required if iBitmap is set.) */ |
|
109 CWindowGc::TBrushStyle iBrushStyle; |
|
110 /** Brush colour. (Not required if iBitmap is set.) */ |
|
111 TRgb iBrushColor; |
|
112 /** Brush pattern. */ |
|
113 const CFbsBitmap* iBitmap; |
|
114 |
|
115 private: |
|
116 TInt iMCoeControlBrushContext_Reserved1; |
|
117 }; |
|
118 |
|
119 #endif |