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 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
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 // FIXME: crbug.com/327471. Remove this header after we've updated all the |
32 #define WebThemeEngine_h | 32 // callers to use platform/WebThemeEngine.h directly. |
33 | 33 |
34 #include "../WebCanvas.h" | 34 #include "../WebThemeEngine.h" |
35 #include "../WebColor.h" | |
36 #include "../WebSize.h" | |
37 | |
38 namespace blink { | |
39 | |
40 struct WebRect; | |
41 | |
42 class WebThemeEngine { | |
43 public: | |
44 // The UI part which is being accessed. | |
45 enum Part { | |
46 // ScrollbarTheme parts | |
47 PartScrollbarDownArrow, | |
48 PartScrollbarLeftArrow, | |
49 PartScrollbarRightArrow, | |
50 PartScrollbarUpArrow, | |
51 PartScrollbarHorizontalThumb, | |
52 PartScrollbarVerticalThumb, | |
53 PartScrollbarHorizontalTrack, | |
54 PartScrollbarVerticalTrack, | |
55 PartScrollbarCorner, | |
56 | |
57 // RenderTheme parts | |
58 PartCheckbox, | |
59 PartRadio, | |
60 PartButton, | |
61 PartTextField, | |
62 PartMenuList, | |
63 PartSliderTrack, | |
64 PartSliderThumb, | |
65 PartInnerSpinButton, | |
66 PartProgressBar | |
67 }; | |
68 | |
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 | |
79 // Extra parameters for drawing the PartScrollbarHorizontalTrack and | |
80 // PartScrollbarVerticalTrack. | |
81 struct ScrollbarTrackExtraParams { | |
82 bool isBack; // Whether this is the 'back' part or the 'forward' part. | |
83 | |
84 // The bounds of the entire track, as opposed to the part being painted. | |
85 int trackX; | |
86 int trackY; | |
87 int trackWidth; | |
88 int trackHeight; | |
89 }; | |
90 | |
91 // Extra parameters for PartCheckbox, PartPushButton and PartRadio. | |
92 struct ButtonExtraParams { | |
93 bool checked; | |
94 bool indeterminate; // Whether the button state is indeterminate. | |
95 bool isDefault; // Whether the button is default button. | |
96 bool hasBorder; | |
97 WebColor backgroundColor; | |
98 }; | |
99 | |
100 // Extra parameters for PartTextField | |
101 struct TextFieldExtraParams { | |
102 bool isTextArea; | |
103 bool isListbox; | |
104 WebColor backgroundColor; | |
105 }; | |
106 | |
107 // Extra parameters for PartMenuList | |
108 struct MenuListExtraParams { | |
109 bool hasBorder; | |
110 bool hasBorderRadius; | |
111 int arrowX; | |
112 int arrowY; | |
113 int arrowHeight; | |
114 WebColor backgroundColor; | |
115 bool fillContentArea; | |
116 }; | |
117 | |
118 // Extra parameters for PartSliderTrack and PartSliderThumb | |
119 struct SliderExtraParams { | |
120 bool vertical; | |
121 bool inDrag; | |
122 }; | |
123 | |
124 // Extra parameters for PartInnerSpinButton | |
125 struct InnerSpinButtonExtraParams { | |
126 bool spinUp; | |
127 bool readOnly; | |
128 }; | |
129 | |
130 // Extra parameters for PartProgressBar | |
131 struct ProgressBarExtraParams { | |
132 bool determinate; | |
133 int valueRectX; | |
134 int valueRectY; | |
135 int valueRectWidth; | |
136 int valueRectHeight; | |
137 }; | |
138 | |
139 union ExtraParams { | |
140 ScrollbarTrackExtraParams scrollbarTrack; | |
141 ButtonExtraParams button; | |
142 TextFieldExtraParams textField; | |
143 MenuListExtraParams menuList; | |
144 SliderExtraParams slider; | |
145 InnerSpinButtonExtraParams innerSpin; | |
146 ProgressBarExtraParams progressBar; | |
147 }; | |
148 | |
149 // 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 | |
151 // the track while the height will be the minimum height. | |
152 virtual WebSize getSize(Part) { return WebSize(); } | |
153 // Paint the given the given theme part. | |
154 virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParam
s*) { } | |
155 }; | |
156 | |
157 } // namespace blink | |
158 | |
159 #endif | |
OLD | NEW |