|
1 /* |
|
2 * Copyright (c) 2002-2006 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: Class declaration for EIKON bordered control. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __EIKBCTRL_H__ |
|
20 #define __EIKBCTRL_H__ |
|
21 |
|
22 #include <gulbordr.h> |
|
23 #include <coecntrl.h> |
|
24 #include <AknControl.h> |
|
25 |
|
26 /** |
|
27 * A control which is drawn surrounded by a rectangular border. |
|
28 * |
|
29 * The screen appearance of derived classes can be changed by overriding |
|
30 * the protected method @c Draw(). By default, this draws a border of the |
|
31 * appropriate type around the control. |
|
32 * |
|
33 * @lib eikcoctl.lib |
|
34 * @since S60 0.9 |
|
35 */ |
|
36 class CEikBorderedControl : public CAknControl |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Default C++ Constructor. |
|
42 * Constructs a new bordered control that has no border. |
|
43 */ |
|
44 IMPORT_C CEikBorderedControl(); |
|
45 |
|
46 /** |
|
47 * Constructor that creates a new bordered control with |
|
48 * a specified border. |
|
49 * |
|
50 * @param aBorder The border of the control. |
|
51 */ |
|
52 IMPORT_C CEikBorderedControl(const TGulBorder& aBorder); |
|
53 |
|
54 public: /** From @c CCoeControl. */ |
|
55 |
|
56 /** |
|
57 * Checks whether the control has a border. |
|
58 * |
|
59 * From @c CCoeControl. |
|
60 * |
|
61 * @return @c ETrue if the control has a border, @c EFalse otherwise. |
|
62 */ |
|
63 IMPORT_C TBool HasBorder() const; |
|
64 |
|
65 /** |
|
66 * Sets the control's adjacency. |
|
67 * |
|
68 * Declares that a control abuts another control along one edge, |
|
69 * and does not need to be drawn with a full border along that side. |
|
70 * This is for use by layout engines or any user code which lays out |
|
71 * controls next to one another. |
|
72 * |
|
73 * Its intended use is to remove the double border that may occur if |
|
74 * two controls, both with borders, are adjacent within a |
|
75 * container control. |
|
76 * |
|
77 * From @c CCoeControl. |
|
78 * |
|
79 * @param aAdjacent A value from @c TGulAdjacent declaring |
|
80 * which edge of this control is shared. |
|
81 * |
|
82 * @see CCoeControl::SetAdjacent() |
|
83 */ |
|
84 IMPORT_C void SetAdjacent(TInt aAdjacent); |
|
85 |
|
86 /** |
|
87 * <b> Not used in S60. </b> |
|
88 * |
|
89 * From @c CCoeControl. |
|
90 * |
|
91 * @param aColorUseList Not used. |
|
92 */ |
|
93 IMPORT_C void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; |
|
94 |
|
95 /** |
|
96 * Handles a change to the control's resources. |
|
97 * |
|
98 * The types of resources handled are those which are shared across |
|
99 * the environment, e.g. colours or fonts. For colour scheme changes, |
|
100 * @c DrawDeferred() is called in order to redraw the control. |
|
101 * |
|
102 * If overriding this method, the implementation must |
|
103 * include a base call to this method. |
|
104 * |
|
105 * From @c CCoeControl. |
|
106 * |
|
107 * @param aType The type of resource that has changed. |
|
108 */ |
|
109 IMPORT_C void HandleResourceChange(TInt aType); |
|
110 |
|
111 /** |
|
112 * Handles pointer events. |
|
113 * |
|
114 * This function gets called whenever a pointer event occurs in the |
|
115 * control, i.e. when the pointer is within the control's extent, or when |
|
116 * the control has grabbed the pointer. |
|
117 * |
|
118 * If overriding this method, the implementation must |
|
119 * include a base call to this method. |
|
120 * |
|
121 * From @c CCoeControl. |
|
122 * |
|
123 * @param aPointerEvent The pointer event. |
|
124 */ |
|
125 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
126 |
|
127 public: |
|
128 |
|
129 /** |
|
130 * Sets the border type of the control to a type defined in |
|
131 * @c TGulBorder::TBorderType. |
|
132 * |
|
133 * @param aBorderType The border type to be set. |
|
134 */ |
|
135 IMPORT_C void SetBorder(TGulBorder::TBorderType aBorderType); |
|
136 |
|
137 /** |
|
138 * Sets the border type. |
|
139 * Any one of the values from the enums @c TGulBorder::TBorderType |
|
140 * or @c TGulBorder::TLogicalType specifies a valid border type. |
|
141 * |
|
142 * Custom border types can be created by selecting |
|
143 * one value from enum @c TGulBorder::T3DStyle, |
|
144 * one value from enum @c TGulBorder::TConstructionStyle, |
|
145 * at most one value from enum @c TGulBorder::TOutlineStyle, |
|
146 * at most one value from enum @c TGulBorder::TInlineStyle, |
|
147 * at least one value from enum @c TGulBorder::TThickness and |
|
148 * at least one value from enum @c TGulBorder::TRounding |
|
149 * and performing an OR operation to these. |
|
150 * |
|
151 * @param aBorderType The border type to be set. |
|
152 */ |
|
153 IMPORT_C void SetBorder(TInt aBorderType); |
|
154 |
|
155 /** |
|
156 * Gets the control's border. |
|
157 * |
|
158 * @return The border of the control. |
|
159 */ |
|
160 IMPORT_C TGulBorder Border() const; |
|
161 |
|
162 protected: /** From @c CCoeControl. */ |
|
163 |
|
164 /** |
|
165 * Draws the border around the control. This function also clears the |
|
166 * central area if the @c IsBlank() method returns @c ETrue. |
|
167 * |
|
168 * From @c CCoeControl |
|
169 * |
|
170 * @param aRect Not used. |
|
171 * |
|
172 * @see CCoeControl::IsBlank() |
|
173 * @see Border() |
|
174 */ |
|
175 IMPORT_C void Draw(const TRect& aRect) const; |
|
176 |
|
177 /** |
|
178 * Writes the internal state of the control and its components to @c aWriteStream. |
|
179 * Does nothing in release mode. |
|
180 * |
|
181 * Designed to be overridden and base called from subclasses. |
|
182 * |
|
183 * From @c CCoeControl |
|
184 * |
|
185 * @param[in,out] aWriteStream A connected write stream. |
|
186 */ |
|
187 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; |
|
188 |
|
189 private: /** From @c CAknControl. */ |
|
190 |
|
191 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
192 |
|
193 protected: |
|
194 |
|
195 /** The control's border. */ |
|
196 TGulBorder iBorder; |
|
197 |
|
198 private: |
|
199 TInt iSpare[2]; |
|
200 }; |
|
201 |
|
202 #endif // __EIKBCTRL_H__ |