Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebThemeEngine_h | 31 #ifndef WebThemeEngine_h |
| 32 #define WebThemeEngine_h | 32 #define WebThemeEngine_h |
| 33 | 33 |
| 34 #include "../WebCanvas.h" | 34 #include "WebCanvas.h" |
| 35 #include "../WebColor.h" | 35 #include "WebColor.h" |
| 36 #include "../WebSize.h" | 36 #include "WebSize.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 struct WebRect; | 40 struct WebRect; |
| 41 | 41 |
| 42 // FIXME: crbug.com/327471. Here and above, we need to merge the Mac and | |
| 43 // non-Mac implementations. | |
| 44 | |
| 42 class WebThemeEngine { | 45 class WebThemeEngine { |
| 43 public: | 46 public: |
| 47 // The current state of the associated Part. | |
| 48 enum State { | |
| 49 StateDisabled, | |
| 50 #ifdef __APPLE__ | |
|
jamesr
2014/02/05 20:30:33
why make these conditional? i think the reasonable
Dirk Pranke
2014/02/05 21:34:39
I was a bit concerned that there might be issues w
| |
| 51 StateInactive, | |
| 52 StateActive, | |
| 53 StatePressed, | |
| 54 #else | |
| 55 StateHover, | |
| 56 StateNormal, | |
| 57 StatePressed, | |
| 58 StateFocused, | |
| 59 StateReadonly, | |
| 60 #endif | |
| 61 }; | |
| 62 | |
| 63 #ifdef __APPLE__ | |
|
jamesr
2014/02/05 20:30:33
i don't really see any harm in having these define
Dirk Pranke
2014/02/05 21:34:39
fair enough, will do.
| |
| 64 enum Size { | |
| 65 SizeRegular, | |
| 66 SizeSmall, | |
| 67 }; | |
| 68 | |
| 69 enum ScrollbarOrientation { | |
| 70 ScrollbarOrientationHorizontal, | |
| 71 ScrollbarOrientationVertical, | |
| 72 }; | |
| 73 | |
| 74 enum ScrollbarParent { | |
| 75 ScrollbarParentScrollView, | |
| 76 ScrollbarParentRenderLayer, | |
| 77 }; | |
| 78 | |
| 79 struct ScrollbarInfo { | |
| 80 ScrollbarOrientation orientation; | |
| 81 ScrollbarParent parent; | |
| 82 int maxValue; | |
| 83 int currentValue; | |
| 84 int visibleSize; | |
| 85 int totalSize; | |
| 86 }; | |
| 87 | |
| 88 virtual void paintScrollbarThumb(WebCanvas*, State, Size, const WebRect&, co nst ScrollbarInfo&) { } | |
| 89 #else | |
| 44 // The UI part which is being accessed. | 90 // The UI part which is being accessed. |
| 45 enum Part { | 91 enum Part { |
| 46 // ScrollbarTheme parts | 92 // ScrollbarTheme parts |
| 47 PartScrollbarDownArrow, | 93 PartScrollbarDownArrow, |
| 48 PartScrollbarLeftArrow, | 94 PartScrollbarLeftArrow, |
| 49 PartScrollbarRightArrow, | 95 PartScrollbarRightArrow, |
| 50 PartScrollbarUpArrow, | 96 PartScrollbarUpArrow, |
| 51 PartScrollbarHorizontalThumb, | 97 PartScrollbarHorizontalThumb, |
| 52 PartScrollbarVerticalThumb, | 98 PartScrollbarVerticalThumb, |
| 53 PartScrollbarHorizontalTrack, | 99 PartScrollbarHorizontalTrack, |
| 54 PartScrollbarVerticalTrack, | 100 PartScrollbarVerticalTrack, |
| 55 PartScrollbarCorner, | 101 PartScrollbarCorner, |
| 56 | 102 |
| 57 // RenderTheme parts | 103 // RenderTheme parts |
| 58 PartCheckbox, | 104 PartCheckbox, |
| 59 PartRadio, | 105 PartRadio, |
| 60 PartButton, | 106 PartButton, |
| 61 PartTextField, | 107 PartTextField, |
| 62 PartMenuList, | 108 PartMenuList, |
| 63 PartSliderTrack, | 109 PartSliderTrack, |
| 64 PartSliderThumb, | 110 PartSliderThumb, |
| 65 PartInnerSpinButton, | 111 PartInnerSpinButton, |
| 66 PartProgressBar | 112 PartProgressBar |
| 67 }; | 113 }; |
| 68 | 114 |
| 69 // The current state of the associated Part. | |
| 70 enum State { | |
| 71 StateDisabled, | |
| 72 StateHover, | |
| 73 StateNormal, | |
| 74 StatePressed, | |
| 75 StateFocused, | |
| 76 StateReadonly, | |
| 77 }; | |
| 78 | 115 |
| 79 // Extra parameters for drawing the PartScrollbarHorizontalTrack and | 116 // Extra parameters for drawing the PartScrollbarHorizontalTrack and |
| 80 // PartScrollbarVerticalTrack. | 117 // PartScrollbarVerticalTrack. |
| 81 struct ScrollbarTrackExtraParams { | 118 struct ScrollbarTrackExtraParams { |
| 82 bool isBack; // Whether this is the 'back' part or the 'forward' part. | 119 bool isBack; // Whether this is the 'back' part or the 'forward' part. |
| 83 | 120 |
| 84 // The bounds of the entire track, as opposed to the part being painted. | 121 // The bounds of the entire track, as opposed to the part being painted. |
| 85 int trackX; | 122 int trackX; |
| 86 int trackY; | 123 int trackY; |
| 87 int trackWidth; | 124 int trackWidth; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 InnerSpinButtonExtraParams innerSpin; | 182 InnerSpinButtonExtraParams innerSpin; |
| 146 ProgressBarExtraParams progressBar; | 183 ProgressBarExtraParams progressBar; |
| 147 }; | 184 }; |
| 148 | 185 |
| 149 // Gets the size of the given theme part. For variable sized items | 186 // Gets the size of the given theme part. For variable sized items |
| 150 // like vertical scrollbar thumbs, the width will be the required width of | 187 // like vertical scrollbar thumbs, the width will be the required width of |
| 151 // the track while the height will be the minimum height. | 188 // the track while the height will be the minimum height. |
| 152 virtual WebSize getSize(Part) { return WebSize(); } | 189 virtual WebSize getSize(Part) { return WebSize(); } |
| 153 // Paint the given the given theme part. | 190 // Paint the given the given theme part. |
| 154 virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParam s*) { } | 191 virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParam s*) { } |
| 192 #endif | |
| 155 }; | 193 }; |
| 156 | 194 |
| 157 } // namespace blink | 195 } // namespace blink |
| 158 | 196 |
| 159 #endif | 197 #endif |
| OLD | NEW |