|
1 /* |
|
2 * Copyright (c) 2003 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: smilregion declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef SMILREGION_H |
|
21 #define SMILREGION_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32def.h> |
|
25 #include <e32base.h> |
|
26 |
|
27 #include "smiltextbuf.h" |
|
28 |
|
29 #include "smillength.h" |
|
30 #include "smilregioninterface.h" |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CSmilPresentation; |
|
34 class CSmilEvent; |
|
35 class CSmilObject; |
|
36 class CSmilArea; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 class CSmilRegion : public CBase, public MSmilRegion |
|
41 { |
|
42 public: // Constructors and destructor |
|
43 |
|
44 friend class CSmilRootRegion; |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 */ |
|
49 static CSmilRegion* NewL( CSmilPresentation* aPresentation ); |
|
50 |
|
51 /** |
|
52 * Destructor. |
|
53 */ |
|
54 virtual ~CSmilRegion(); |
|
55 |
|
56 |
|
57 public: // New functions |
|
58 |
|
59 /** |
|
60 * Following methods are an implementation of MSmilRegion interface |
|
61 */ |
|
62 virtual TRect GetRectangle() const; |
|
63 virtual TRect GetRectangle(const CSmilMedia* aMedia) const; |
|
64 |
|
65 virtual TInt GetZIndex() const; |
|
66 virtual TFit GetFit() const; |
|
67 virtual TRgb GetBackground() const; |
|
68 virtual TRgb GetForeground() const; |
|
69 virtual TBgMode GetBackgroundMode() const; |
|
70 virtual TBool BackgroundTransparent() const { return iTransparent; } |
|
71 |
|
72 virtual void Redraw(); |
|
73 virtual void Redraw(TRect iUpdate); |
|
74 |
|
75 virtual MSmilRegion* Parent() const; |
|
76 virtual MSmilRegion* Root() const; |
|
77 |
|
78 virtual void AddMediaL(CSmilMedia* aMedia); |
|
79 virtual void RemoveMedia(CSmilMedia* aMedia); |
|
80 virtual TBool ContainsMedia(const CSmilMedia* aMedia) const; |
|
81 |
|
82 virtual TBool IsRoot() const { return EFalse; } |
|
83 |
|
84 virtual void MediaTransitionEnd(CSmilMedia* aMedia); |
|
85 |
|
86 |
|
87 virtual CSmilMedia* MediaAt(const TPoint& aPoint,TBool aOnlyFocusable=EFalse); |
|
88 virtual CSmilArea* AreaAt(const TPoint& aPoint, TBool aOnlyFocusable=EFalse); |
|
89 |
|
90 enum TDirection { ELeft, ERight, ETop, EBottom, ETopTwoWay, EBottomTwoWay, EAll }; |
|
91 |
|
92 /** |
|
93 * Calculate the region positions |
|
94 */ |
|
95 virtual void Layout(TReal32 aScalingFactor = 1); |
|
96 |
|
97 // drawing |
|
98 |
|
99 virtual void Draw(CGraphicsContext& aGc, const TRect& aRect); |
|
100 |
|
101 // child management |
|
102 |
|
103 virtual void AddChild(CSmilRegion* ) { } |
|
104 virtual CSmilRegion* FirstChild() const { return 0; } |
|
105 virtual CSmilRegion* LastChild() const { return 0; } |
|
106 |
|
107 virtual void SetFirstChild(CSmilRegion*) { } |
|
108 virtual void SetLastChild(CSmilRegion*) { } |
|
109 |
|
110 virtual CSmilRegion* NextSibling() const { return iNext; } |
|
111 virtual CSmilRegion* PreviousSibling() const { return iPrevious; } |
|
112 |
|
113 |
|
114 //debug |
|
115 |
|
116 virtual void PrintTree(int d=0) const; |
|
117 |
|
118 |
|
119 // style attributes |
|
120 TSmilLength iWidth; |
|
121 TSmilLength iHeight; |
|
122 TSmilLength iTop; |
|
123 TSmilLength iBottom; |
|
124 TSmilLength iLeft; |
|
125 TSmilLength iRight; |
|
126 |
|
127 TInt iZIndex; |
|
128 |
|
129 TFit iFit; |
|
130 |
|
131 TRgb iBackground; |
|
132 TRgb iForeground; |
|
133 TBgMode iBackgroundMode; |
|
134 TBool iTransparent; |
|
135 |
|
136 TPtrC Id() const { return iId.Text(); } |
|
137 TPtrC Name() const { return iName.Text(); } |
|
138 void SetId(const TDesC& aId) { iId.SetTextL(aId); } |
|
139 void SetName(const TDesC& aName) { iName.SetTextL(aName); } |
|
140 |
|
141 RSmilTextBuf iId; |
|
142 RSmilTextBuf iName; |
|
143 |
|
144 protected: |
|
145 |
|
146 virtual CSmilObject* FindNearest(const TPoint& aPoint, TDirection iDir, TInt& dist2); |
|
147 |
|
148 CSmilRegion(CSmilPresentation* aPresentation); |
|
149 |
|
150 //other |
|
151 |
|
152 CSmilPresentation* iPresentation; |
|
153 TRect iRect; |
|
154 |
|
155 TBool iDefaultLayout; |
|
156 |
|
157 struct MediaListItem |
|
158 { |
|
159 MediaListItem(CSmilMedia* aMedia) { iMedia=aMedia; iNext=0; } |
|
160 CSmilMedia* iMedia; |
|
161 MediaListItem* iNext; |
|
162 TRect iArea; |
|
163 }; |
|
164 |
|
165 MediaListItem* iVisibleMedia; |
|
166 |
|
167 // child management |
|
168 |
|
169 CSmilRegion* iNext; |
|
170 CSmilRegion* iPrevious; |
|
171 CSmilRegion* iParent; |
|
172 |
|
173 |
|
174 }; |
|
175 |
|
176 #endif // ?INCLUDE_H |
|
177 |
|
178 // End of File |