| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2010 Google 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 are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebThemeEngine_h | |
| 32 #define WebThemeEngine_h | |
| 33 | |
| 34 #include "sky/engine/public/platform/WebCanvas.h" | |
| 35 #include "sky/engine/public/platform/WebColor.h" | |
| 36 #include "sky/engine/public/platform/WebSize.h" | |
| 37 | |
| 38 namespace blink { | |
| 39 | |
| 40 struct WebRect; | |
| 41 | |
| 42 // FIXME: crbug.com/327471. We need to merge the Apple and non-Apple implementat
ions. | |
| 43 | |
| 44 class WebThemeEngine { | |
| 45 public: | |
| 46 // The current state of the associated Part. | |
| 47 enum State { | |
| 48 StateDisabled, | |
| 49 StateHover, // non-Apple | |
| 50 StateNormal, // non-Apple | |
| 51 StatePressed, | |
| 52 StateFocused, // non-Apple | |
| 53 StateReadonly, // non-Apple | |
| 54 StateInactive, // Apple-specific | |
| 55 StateActive, // Apple-specific | |
| 56 }; | |
| 57 | |
| 58 // FIXME: The next section describes stuff only used on the Apple port. | |
| 59 enum Size { | |
| 60 SizeRegular, | |
| 61 SizeSmall, | |
| 62 }; | |
| 63 | |
| 64 enum ScrollbarOrientation { | |
| 65 ScrollbarOrientationHorizontal, | |
| 66 ScrollbarOrientationVertical, | |
| 67 }; | |
| 68 | |
| 69 enum ScrollbarParent { | |
| 70 ScrollbarParentScrollView, | |
| 71 ScrollbarParentRenderLayer, | |
| 72 }; | |
| 73 | |
| 74 struct ScrollbarInfo { | |
| 75 ScrollbarOrientation orientation; | |
| 76 ScrollbarParent parent; | |
| 77 int maxValue; | |
| 78 int currentValue; | |
| 79 int visibleSize; | |
| 80 int totalSize; | |
| 81 }; | |
| 82 | |
| 83 // FIXME: The remaining definitions are only used on the non-Apple ports. | |
| 84 | |
| 85 // The UI part which is being accessed. | |
| 86 enum Part { | |
| 87 // ScrollbarTheme parts | |
| 88 PartScrollbarDownArrow, | |
| 89 PartScrollbarLeftArrow, | |
| 90 PartScrollbarRightArrow, | |
| 91 PartScrollbarUpArrow, | |
| 92 PartScrollbarHorizontalThumb, | |
| 93 PartScrollbarVerticalThumb, | |
| 94 PartScrollbarHorizontalTrack, | |
| 95 PartScrollbarVerticalTrack, | |
| 96 | |
| 97 // RenderTheme parts | |
| 98 PartCheckbox, | |
| 99 PartRadio, | |
| 100 PartButton, | |
| 101 PartMenuList, | |
| 102 PartSliderTrack, | |
| 103 PartSliderThumb, | |
| 104 PartInnerSpinButton, | |
| 105 PartProgressBar | |
| 106 }; | |
| 107 | |
| 108 | |
| 109 // Extra parameters for drawing the PartScrollbarHorizontalTrack and | |
| 110 // PartScrollbarVerticalTrack. | |
| 111 struct ScrollbarTrackExtraParams { | |
| 112 bool isBack; // Whether this is the 'back' part or the 'forward' part. | |
| 113 | |
| 114 // The bounds of the entire track, as opposed to the part being painted. | |
| 115 int trackX; | |
| 116 int trackY; | |
| 117 int trackWidth; | |
| 118 int trackHeight; | |
| 119 }; | |
| 120 | |
| 121 // Extra parameters for PartCheckbox, PartPushButton and PartRadio. | |
| 122 struct ButtonExtraParams { | |
| 123 bool checked; | |
| 124 bool indeterminate; // Whether the button state is indeterminate. | |
| 125 bool isDefault; // Whether the button is default button. | |
| 126 bool hasBorder; | |
| 127 WebColor backgroundColor; | |
| 128 }; | |
| 129 | |
| 130 // Extra parameters for PartMenuList | |
| 131 struct MenuListExtraParams { | |
| 132 bool hasBorder; | |
| 133 bool hasBorderRadius; | |
| 134 int arrowX; | |
| 135 int arrowY; | |
| 136 int arrowHeight; | |
| 137 WebColor backgroundColor; | |
| 138 bool fillContentArea; | |
| 139 }; | |
| 140 | |
| 141 // Extra parameters for PartSliderTrack and PartSliderThumb | |
| 142 struct SliderExtraParams { | |
| 143 bool vertical; | |
| 144 bool inDrag; | |
| 145 }; | |
| 146 | |
| 147 // Extra parameters for PartInnerSpinButton | |
| 148 struct InnerSpinButtonExtraParams { | |
| 149 bool spinUp; | |
| 150 bool readOnly; | |
| 151 }; | |
| 152 | |
| 153 // Extra parameters for PartProgressBar | |
| 154 struct ProgressBarExtraParams { | |
| 155 bool determinate; | |
| 156 int valueRectX; | |
| 157 int valueRectY; | |
| 158 int valueRectWidth; | |
| 159 int valueRectHeight; | |
| 160 }; | |
| 161 | |
| 162 union ExtraParams { | |
| 163 ScrollbarTrackExtraParams scrollbarTrack; | |
| 164 ButtonExtraParams button; | |
| 165 MenuListExtraParams menuList; | |
| 166 SliderExtraParams slider; | |
| 167 InnerSpinButtonExtraParams innerSpin; | |
| 168 ProgressBarExtraParams progressBar; | |
| 169 }; | |
| 170 | |
| 171 // Gets the size of the given theme part. For variable sized items | |
| 172 // like vertical scrollbar thumbs, the width will be the required width of | |
| 173 // the track while the height will be the minimum height. | |
| 174 virtual WebSize getSize(Part) { return WebSize(); } | |
| 175 // Paint the given the given theme part. | |
| 176 virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParam
s*) { } | |
| 177 }; | |
| 178 | |
| 179 } // namespace blink | |
| 180 | |
| 181 #endif | |
| OLD | NEW |