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, bool
isVertical, bool isFlipped) |
| 49 { |
| 50 switch (direction) { |
| 51 case ScrollBlockDirectionBackward: { |
| 52 if (isVertical) { |
| 53 if (!isFlipped) |
| 54 return ScrollUp; |
| 55 return ScrollDown; |
| 56 } |
| 57 if (!isFlipped) |
| 58 return ScrollLeft; |
| 59 return ScrollRight; |
| 60 } |
| 61 case ScrollBlockDirectionForward: { |
| 62 if (isVertical) { |
| 63 if (!isFlipped) |
| 64 return ScrollDown; |
| 65 return ScrollUp; |
| 66 } |
| 67 if (!isFlipped) |
| 68 return ScrollRight; |
| 69 return ScrollLeft; |
| 70 } |
| 71 case ScrollInlineDirectionBackward: { |
| 72 if (isVertical) { |
| 73 if (!isFlipped) |
| 74 return ScrollLeft; |
| 75 return ScrollRight; |
| 76 } |
| 77 if (!isFlipped) |
| 78 return ScrollUp; |
| 79 return ScrollDown; |
| 80 } |
| 81 case ScrollInlineDirectionForward: { |
| 82 if (isVertical) { |
| 83 if (!isFlipped) |
| 84 return ScrollRight; |
| 85 return ScrollLeft; |
| 86 } |
| 87 if (!isFlipped) |
| 88 return ScrollDown; |
| 89 return ScrollUp; |
| 90 } |
| 91 default: |
| 92 ASSERT_NOT_REACHED(); |
| 93 break; |
| 94 } |
| 95 return ScrollUp; |
| 96 } |
| 97 |
| 98 enum ScrollGranularity { |
| 99 ScrollByLine, |
| 100 ScrollByPage, |
| 101 ScrollByDocument, |
| 102 ScrollByPixel, |
| 103 ScrollByPrecisePixel |
| 104 }; |
| 105 |
| 106 enum ScrollElasticity { |
| 107 ScrollElasticityAutomatic, |
| 108 ScrollElasticityNone, |
| 109 ScrollElasticityAllowed |
| 110 }; |
| 111 |
| 112 enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar }; |
| 113 |
| 114 enum ScrollbarMode { ScrollbarAuto, ScrollbarAlwaysOff, ScrollbarAlwaysOn }; |
| 115 |
| 116 enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar }; |
| 117 |
| 118 typedef unsigned ScrollbarControlState; |
| 119 |
| 120 enum ScrollbarControlStateMask { |
| 121 ActiveScrollbarState = 1, |
| 122 EnabledScrollbarState = 1 << 1, |
| 123 PressedScrollbarState = 1 << 2 |
| 124 }; |
| 125 |
| 126 enum ScrollbarPart { |
| 127 NoPart = 0, |
| 128 BackButtonStartPart = 1, |
| 129 ForwardButtonStartPart = 1 << 1, |
| 130 BackTrackPart = 1 << 2, |
| 131 ThumbPart = 1 << 3, |
| 132 ForwardTrackPart = 1 << 4, |
| 133 BackButtonEndPart = 1 << 5, |
| 134 ForwardButtonEndPart = 1 << 6, |
| 135 ScrollbarBGPart = 1 << 7, |
| 136 TrackBGPart = 1 << 8, |
| 137 AllParts = 0xffffffff |
| 138 }; |
| 139 |
| 140 enum ScrollbarButtonsPlacement { |
| 141 ScrollbarButtonsNone, |
| 142 ScrollbarButtonsSingle, |
| 143 ScrollbarButtonsDoubleStart, |
| 144 ScrollbarButtonsDoubleEnd, |
| 145 ScrollbarButtonsDoubleBoth |
| 146 }; |
| 147 |
| 148 enum ScrollbarOverlayStyle { |
| 149 ScrollbarOverlayStyleDefault, |
| 150 ScrollbarOverlayStyleDark, |
| 151 ScrollbarOverlayStyleLight |
| 152 }; |
| 153 |
| 154 typedef unsigned ScrollbarControlPartMask; |
| 155 |
| 156 } |
| 157 |
| 158 #endif |
OLD | NEW |