|
1 /* |
|
2 * Copyright (c) 1997-1999 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <gulbordr.h> |
|
21 #include <gulcolor.h> |
|
22 #include <gulutil.h> |
|
23 #include <coecntrl.h> |
|
24 |
|
25 #include <uikon.hrh> |
|
26 #include <eikon.hrh> |
|
27 |
|
28 #include "LAFSCRLB.H" |
|
29 #include "LAFSCBUT.H" |
|
30 #include "LAFSTD.H" |
|
31 #include "lafpublc.h" |
|
32 |
|
33 #include "LAFSBFRM.H" |
|
34 |
|
35 |
|
36 // |
|
37 // Class LafScrollBarFrame::TScrollBarAttributes() |
|
38 // |
|
39 |
|
40 EXPORT_C LafScrollBarFrame::TScrollBarAttributes::TScrollBarAttributes() |
|
41 : iControlType(EEikCtScrollBar), iBreadth(LafScrollBar::DefaultBreadth()), |
|
42 iSide(SLafScrollBarFrame::EBottomOrRight), iManagement(SLafScrollBarFrame::EComponent) |
|
43 { |
|
44 } |
|
45 |
|
46 // |
|
47 // Class LafScrollBarFrame |
|
48 // |
|
49 |
|
50 const TInt KLafFloatingScrollBarOffset=5; |
|
51 |
|
52 /** |
|
53 * Returns the default flags for the matched control. Called from the constructor of the matched control. |
|
54 */ |
|
55 EXPORT_C TInt LafScrollBarFrame::DefaultFlags() |
|
56 { |
|
57 return 0; |
|
58 } |
|
59 |
|
60 /** |
|
61 * Returns the default flags for the scroll bar for orientation aOrientation. |
|
62 * Called from the constructor of the scroll bar frame.. |
|
63 */ |
|
64 EXPORT_C TInt LafScrollBarFrame::DefaultScrollBarFlags(TInt /*aOrientation*/) |
|
65 { |
|
66 return 0; |
|
67 } |
|
68 |
|
69 /** |
|
70 * Gets the default attributes for the scroll bar for orientation aOrientation in aAttributes. |
|
71 * Called from the constructor of the scroll bar frame.. |
|
72 */ |
|
73 EXPORT_C void LafScrollBarFrame::GetDefaultScrollBarAttributes(TInt /*aOrientation*/, TScrollBarAttributes& aAttributes) |
|
74 { |
|
75 aAttributes = LafScrollBarFrame::TScrollBarAttributes(); |
|
76 } |
|
77 |
|
78 /** |
|
79 * Gets the position for a floating scroll bar for orientation aOrientation in aPosition. |
|
80 * The scroll bar attributes aAttributes, the client rectangle of the scrolled area aClientRect and |
|
81 * the scroll bar size aScrollBarSize may all influence the positioning. Called for floating scroll bars |
|
82 * from the TileL() method of the scroll bar frame when tiling the scroll bar geomtery with the client area. |
|
83 */ |
|
84 EXPORT_C void LafScrollBarFrame::GetFloatingScrollBarPosition(TInt aOrientation, const TScrollBarAttributes& aAttributes, const TRect& aClientRect, const TSize& /*aScrollBarSize*/, TPoint &aPosition) |
|
85 { |
|
86 aPosition = aClientRect.iTl; |
|
87 |
|
88 if (aOrientation == SLafScrollBar::EVertical) |
|
89 { |
|
90 if (aAttributes.iSide == SLafScrollBarFrame::EBottomOrRight) |
|
91 { |
|
92 aPosition.iX = aClientRect.iBr.iX - aAttributes.iBreadth - KLafFloatingScrollBarOffset; |
|
93 aPosition.iY += KLafFloatingScrollBarOffset; |
|
94 } |
|
95 } |
|
96 else |
|
97 { |
|
98 if (aAttributes.iControlType == EEikCtArrowHeadScrollBar) |
|
99 aPosition.iY = aClientRect.iBr.iY - LafArrowHeadScrollButton::ButtonBreadth(); |
|
100 else |
|
101 { |
|
102 if (aAttributes.iSide == SLafScrollBarFrame::EBottomOrRight) |
|
103 aPosition.iY = aClientRect.iBr.iY - aAttributes.iBreadth - KLafFloatingScrollBarOffset; |
|
104 else |
|
105 aPosition.iY += KLafFloatingScrollBarOffset; |
|
106 |
|
107 aPosition.iX += KLafFloatingScrollBarOffset; |
|
108 } |
|
109 } |
|
110 } |
|
111 |
|
112 /** |
|
113 * Returns the length of the floating scroll bar for orientation aOrientation. |
|
114 * The scroll bar attributes aAttributes, the client rectangle of the scrolled area aClientRect |
|
115 * and the scroll bar size aScrollBarSize may all influence the scroll bar length Called for floating |
|
116 * scroll bars from the TileL() method of the scroll bar frame when tiling the scroll bar geomtery with |
|
117 * the client area. |
|
118 */ |
|
119 EXPORT_C TInt LafScrollBarFrame::FloatingScrollBarLength(TInt aOrientation, const TScrollBarAttributes& aAttributes, const TRect& aClientRect, const TSize& aScrollBarSize) |
|
120 { |
|
121 if (aOrientation == SLafScrollBar::EVertical) |
|
122 { |
|
123 if (aAttributes.iSide == SLafScrollBarFrame::EBottomOrRight) |
|
124 return 2*aScrollBarSize.iWidth; |
|
125 else |
|
126 return aClientRect.Height(); |
|
127 } |
|
128 else |
|
129 { |
|
130 if (aAttributes.iControlType == EEikCtArrowHeadScrollBar) |
|
131 return aClientRect.Width(); |
|
132 else |
|
133 return 2*aScrollBarSize.iHeight; |
|
134 } |
|
135 } |
|
136 |
|
137 EXPORT_C void LafScrollBarFrameCornerWindow::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) |
|
138 { // static |
|
139 TCoeColorUse colorUse; |
|
140 colorUse.SetLogicalColor(EColorScrollButtonThumbBackground); |
|
141 colorUse.SetUse(TCoeColorUse::ESurrounds|TCoeColorUse::ENormal|TCoeColorUse::ENeutral|TCoeColorUse::EBack|TCoeColorUse::EActive); |
|
142 aColorUseList.AppendL(colorUse); |
|
143 } |