2 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
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
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.
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.
31 #ifndef WebThemeEngine_h
32 #define WebThemeEngine_h
34 #include "WebCanvas.h"
42 // FIXME: crbug.com/327471. We need to merge the Apple and non-Apple implementations.
44 class WebThemeEngine {
46 // The current state of the associated Part.
49 StateHover, // non-Apple
50 StateNormal, // non-Apple
52 StateFocused, // non-Apple
53 StateReadonly, // non-Apple
54 StateInactive, // Apple-specific
55 StateActive, // Apple-specific
58 // FIXME: The next section describes stuff only used on the Apple port.
64 enum ScrollbarOrientation {
65 ScrollbarOrientationHorizontal,
66 ScrollbarOrientationVertical,
69 enum ScrollbarParent {
70 ScrollbarParentScrollView,
71 ScrollbarParentRenderLayer,
74 struct ScrollbarInfo {
75 ScrollbarOrientation orientation;
76 ScrollbarParent parent;
83 virtual void paintScrollbarThumb(WebCanvas*, State, Size, const WebRect&, const ScrollbarInfo&) { }
85 // FIXME: The remaining definitions are only used on the non-Apple ports.
87 // The UI part which is being accessed.
89 // ScrollbarTheme parts
90 PartScrollbarDownArrow,
91 PartScrollbarLeftArrow,
92 PartScrollbarRightArrow,
94 PartScrollbarHorizontalThumb,
95 PartScrollbarVerticalThumb,
96 PartScrollbarHorizontalTrack,
97 PartScrollbarVerticalTrack,
113 // Extra parameters for drawing the PartScrollbarHorizontalTrack and
114 // PartScrollbarVerticalTrack.
115 struct ScrollbarTrackExtraParams {
116 bool isBack; // Whether this is the 'back' part or the 'forward' part.
118 // The bounds of the entire track, as opposed to the part being painted.
125 // Extra parameters for PartCheckbox, PartPushButton and PartRadio.
126 struct ButtonExtraParams {
128 bool indeterminate; // Whether the button state is indeterminate.
129 bool isDefault; // Whether the button is default button.
131 WebColor backgroundColor;
134 // Extra parameters for PartTextField
135 struct TextFieldExtraParams {
138 WebColor backgroundColor;
141 // Extra parameters for PartMenuList
142 struct MenuListExtraParams {
144 bool hasBorderRadius;
148 WebColor backgroundColor;
149 bool fillContentArea;
152 // Extra parameters for PartSliderTrack and PartSliderThumb
153 struct SliderExtraParams {
158 // Extra parameters for PartInnerSpinButton
159 struct InnerSpinButtonExtraParams {
164 // Extra parameters for PartProgressBar
165 struct ProgressBarExtraParams {
174 ScrollbarTrackExtraParams scrollbarTrack;
175 ButtonExtraParams button;
176 TextFieldExtraParams textField;
177 MenuListExtraParams menuList;
178 SliderExtraParams slider;
179 InnerSpinButtonExtraParams innerSpin;
180 ProgressBarExtraParams progressBar;
183 // Gets the size of the given theme part. For variable sized items
184 // like vertical scrollbar thumbs, the width will be the required width of
185 // the track while the height will be the minimum height.
186 virtual WebSize getSize(Part) { return WebSize(); }
187 // Paint the given the given theme part.
188 virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParams*) { }