OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * 1. Redistributions of source code must retain the above copyright | |
8 * notice, this list of conditions and the following disclaimer. | |
9 * 2. Redistributions in binary form must reproduce the above copyright | |
10 * notice, this list of conditions and the following disclaimer in the | |
11 * documentation and/or other materials provided with the distribution. | |
12 * | |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 */ | |
25 | |
26 #ifndef ScrollTypes_h | |
27 #define ScrollTypes_h | |
28 | |
29 #include "wtf/Assertions.h" | |
30 | |
31 namespace WebCore { | |
32 | |
33 enum ScrollDirection { | |
34 ScrollUp, | |
35 ScrollDown, | |
36 ScrollLeft, | |
37 ScrollRight | |
38 }; | |
39 | |
40 enum ScrollLogicalDirection { | |
41 ScrollBlockDirectionBackward, | |
42 ScrollBlockDirectionForward, | |
43 ScrollInlineDirectionBackward, | |
44 ScrollInlineDirectionForward | |
45 }; | |
46 | |
47 | |
48 inline ScrollDirection logicalToPhysical(ScrollLogicalDirection direction, b
ool isVertical, bool isFlipped) | |
49 { | |
50 switch (direction) { | |
51 case ScrollBlockDirectionBackward: { | |
52 if (isVertical) { | |
53 if (!isFlipped) | |
54 return ScrollUp; | |
55 return ScrollDown; | |
56 } else { | |
57 if (!isFlipped) | |
58 return ScrollLeft; | |
59 return ScrollRight; | |
60 } | |
61 break; | |
62 } | |
63 case ScrollBlockDirectionForward: { | |
64 if (isVertical) { | |
65 if (!isFlipped) | |
66 return ScrollDown; | |
67 return ScrollUp; | |
68 } else { | |
69 if (!isFlipped) | |
70 return ScrollRight; | |
71 return ScrollLeft; | |
72 } | |
73 break; | |
74 } | |
75 case ScrollInlineDirectionBackward: { | |
76 if (isVertical) { | |
77 if (!isFlipped) | |
78 return ScrollLeft; | |
79 return ScrollRight; | |
80 } else { | |
81 if (!isFlipped) | |
82 return ScrollUp; | |
83 return ScrollDown; | |
84 } | |
85 break; | |
86 } | |
87 case ScrollInlineDirectionForward: { | |
88 if (isVertical) { | |
89 if (!isFlipped) | |
90 return ScrollRight; | |
91 return ScrollLeft; | |
92 } else { | |
93 if (!isFlipped) | |
94 return ScrollDown; | |
95 return ScrollUp; | |
96 } | |
97 break; | |
98 } | |
99 default: | |
100 ASSERT_NOT_REACHED(); | |
101 break; | |
102 } | |
103 return ScrollUp; | |
104 } | |
105 | |
106 enum ScrollGranularity { | |
107 ScrollByLine, | |
108 ScrollByPage, | |
109 ScrollByDocument, | |
110 ScrollByPixel, | |
111 ScrollByPrecisePixel | |
112 }; | |
113 | |
114 enum ScrollElasticity { | |
115 ScrollElasticityAutomatic, | |
116 ScrollElasticityNone, | |
117 ScrollElasticityAllowed | |
118 }; | |
119 | |
120 enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar }; | |
121 | |
122 enum ScrollbarMode { ScrollbarAuto, ScrollbarAlwaysOff, ScrollbarAlwaysOn }; | |
123 | |
124 enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar }; | |
125 | |
126 typedef unsigned ScrollbarControlState; | |
127 | |
128 enum ScrollbarControlStateMask { | |
129 ActiveScrollbarState = 1, | |
130 EnabledScrollbarState = 1 << 1, | |
131 PressedScrollbarState = 1 << 2 | |
132 }; | |
133 | |
134 enum ScrollbarPart { | |
135 NoPart = 0, | |
136 BackButtonStartPart = 1, | |
137 ForwardButtonStartPart = 1 << 1, | |
138 BackTrackPart = 1 << 2, | |
139 ThumbPart = 1 << 3, | |
140 ForwardTrackPart = 1 << 4, | |
141 BackButtonEndPart = 1 << 5, | |
142 ForwardButtonEndPart = 1 << 6, | |
143 ScrollbarBGPart = 1 << 7, | |
144 TrackBGPart = 1 << 8, | |
145 AllParts = 0xffffffff | |
146 }; | |
147 | |
148 enum ScrollbarButtonsPlacement { | |
149 ScrollbarButtonsNone, | |
150 ScrollbarButtonsSingle, | |
151 ScrollbarButtonsDoubleStart, | |
152 ScrollbarButtonsDoubleEnd, | |
153 ScrollbarButtonsDoubleBoth | |
154 }; | |
155 | |
156 enum ScrollbarOverlayStyle { | |
157 ScrollbarOverlayStyleDefault, | |
158 ScrollbarOverlayStyleDark, | |
159 ScrollbarOverlayStyleLight | |
160 }; | |
161 | |
162 typedef unsigned ScrollbarControlPartMask; | |
163 | |
164 } | |
165 | |
166 #endif | |
OLD | NEW |