|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Layout base classes |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __GLXLAYOUT_H__ |
|
22 #define __GLXLAYOUT_H__ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <glxlayoutinfo.h> |
|
26 |
|
27 /** |
|
28 * MGlxLayout |
|
29 * |
|
30 * Layout base class. Layouts are objects that specify the |
|
31 * renderable values, such as position, size or opacity for the visuals |
|
32 * They can be chained to form processing chains, and the chains |
|
33 * can also split into several chains (different chain for different |
|
34 * visuals) and combine several chains into one. This allows building |
|
35 * complex visual effects by using simple layouts as building blocks. |
|
36 */ |
|
37 class MGlxLayout |
|
38 { |
|
39 protected: |
|
40 |
|
41 /** |
|
42 * Destructor. Dont allow deletion through this interface. |
|
43 */ |
|
44 ~MGlxLayout() { } |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * This method can specify the layout of given visual by setting |
|
50 * the corresponding fields in the layout info struct. |
|
51 * @param aInfo the layout information to specify |
|
52 */ |
|
53 virtual void SetLayoutValues( TGlxLayoutInfo& aInfo ) = 0; |
|
54 |
|
55 /** |
|
56 * Sets the next layout in the chain. |
|
57 */ |
|
58 virtual void SetNext( MGlxLayout* aLayout ) = 0; |
|
59 |
|
60 /** |
|
61 * Returns the next layout in the chain. |
|
62 */ |
|
63 virtual MGlxLayout* Next() const = 0; |
|
64 |
|
65 }; |
|
66 |
|
67 /** |
|
68 * TGlxLayout |
|
69 * |
|
70 * Implements the MGlxLayout interface and provides common layout chain functionality. |
|
71 * |
|
72 * @lib glxlayouts.lib |
|
73 */ |
|
74 class TGlxLayout : public MGlxLayout |
|
75 { |
|
76 public: |
|
77 |
|
78 /** |
|
79 * Constructor, resets the object. |
|
80 */ |
|
81 IMPORT_C TGlxLayout(); |
|
82 |
|
83 /** |
|
84 * Destructor. |
|
85 */ |
|
86 IMPORT_C virtual ~TGlxLayout(); |
|
87 |
|
88 /** |
|
89 * Sets the next layout in the chain. |
|
90 */ |
|
91 IMPORT_C void SetNext( MGlxLayout* aLayout ); |
|
92 |
|
93 /** |
|
94 * Returns the next layout in the chain. |
|
95 */ |
|
96 IMPORT_C MGlxLayout* Next() const; |
|
97 |
|
98 public: // From MGlxLayout |
|
99 |
|
100 /// @ref MGlxLayout::SetLayoutValues |
|
101 IMPORT_C void SetLayoutValues( TGlxLayoutInfo& aInfo ); |
|
102 |
|
103 protected: // New API, template method pattern |
|
104 |
|
105 /** |
|
106 * This method can specify the layout of given visual by setting the corresponding fields |
|
107 * in the layout info struct. |
|
108 * @param aInfo the layout information to specify |
|
109 */ |
|
110 virtual void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); |
|
111 |
|
112 private: |
|
113 |
|
114 /// Ref: The next layout in chain |
|
115 MGlxLayout* iNextLayout; |
|
116 |
|
117 public: |
|
118 |
|
119 __DEBUG_ONLY( TBuf<50> _iName ); |
|
120 |
|
121 }; |
|
122 |
|
123 /** |
|
124 * CGlxLayout |
|
125 * |
|
126 * Implements the MGlxLayout interface and provides common layout chain functionality. |
|
127 * This class is provided as a base class for CBase deriving layout classes. |
|
128 * |
|
129 * @lib glxlayouts.lib |
|
130 */ |
|
131 class CGlxLayout : public CBase, public MGlxLayout |
|
132 { |
|
133 public: |
|
134 |
|
135 /** |
|
136 * Constructor, resets the object. |
|
137 */ |
|
138 IMPORT_C CGlxLayout(); |
|
139 |
|
140 /** |
|
141 * Destructor. Virtual by CBase and MGlxLayout |
|
142 */ |
|
143 IMPORT_C ~CGlxLayout(); |
|
144 |
|
145 /** |
|
146 * Sets the next layout in the chain. |
|
147 */ |
|
148 IMPORT_C void SetNext( MGlxLayout* aLayout ); |
|
149 |
|
150 /** |
|
151 * Returns the next layout in the chain. |
|
152 */ |
|
153 IMPORT_C MGlxLayout* Next() const; |
|
154 |
|
155 public: // From MGlxLayout |
|
156 |
|
157 /// @ref MGlxLayout::SetLayoutValues |
|
158 IMPORT_C void SetLayoutValues( TGlxLayoutInfo& aInfo ); |
|
159 |
|
160 protected: // New API, template method pattern |
|
161 |
|
162 /** |
|
163 * This method can specify the layout of given visual by setting the corresponding fields |
|
164 * in the layout info struct. |
|
165 * @param aInfo the layout information to specify |
|
166 */ |
|
167 virtual void DoSetLayoutValues( TGlxLayoutInfo& aInfo ); |
|
168 |
|
169 private: |
|
170 |
|
171 /// Own: the layout implementation |
|
172 TGlxLayout iLayoutImpl; |
|
173 |
|
174 public: |
|
175 |
|
176 __DEBUG_ONLY( TBuf<50> _iName ); |
|
177 |
|
178 }; |
|
179 |
|
180 #endif // __GLXLAYOUT_H__ |
|
181 |