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"
35 #include "../WebColor.h"
36 #include "../WebSize.h"
42 class WebThemeEngine {
44 // The UI part which is being accessed.
46 // ScrollbarTheme parts
47 PartScrollbarDownArrow,
48 PartScrollbarLeftArrow,
49 PartScrollbarRightArrow,
51 PartScrollbarHorizontalThumb,
52 PartScrollbarVerticalThumb,
53 PartScrollbarHorizontalTrack,
54 PartScrollbarVerticalTrack,
68 // The current state of the associated Part.
76 // Extra parameters for drawing the PartScrollbarHorizontalTrack and
77 // PartScrollbarVerticalTrack.
78 struct ScrollbarTrackExtraParams {
79 // The bounds of the entire track, as opposed to the part being painted.
86 // Extra parameters for PartCheckbox, PartPushButton and PartRadio.
87 struct ButtonExtraParams {
89 bool indeterminate; // Whether the button state is indeterminate.
90 bool isDefault; // Whether the button is default button.
92 WebColor backgroundColor;
95 // Extra parameters for PartTextField
96 struct TextFieldExtraParams {
99 WebColor backgroundColor;
102 // Extra parameters for PartMenuList
103 struct MenuListExtraParams {
105 bool hasBorderRadius;
108 WebColor backgroundColor;
111 // Extra parameters for PartSliderTrack and PartSliderThumb
112 struct SliderExtraParams {
117 // Extra parameters for PartInnerSpinButton
118 struct InnerSpinButtonExtraParams {
123 // Extra parameters for PartProgressBar
124 struct ProgressBarExtraParams {
133 ScrollbarTrackExtraParams scrollbarTrack;
134 ButtonExtraParams button;
135 TextFieldExtraParams textField;
136 MenuListExtraParams menuList;
137 SliderExtraParams slider;
138 InnerSpinButtonExtraParams innerSpin;
139 ProgressBarExtraParams progressBar;
142 // Gets the size of the given theme part. For variable sized items
143 // like vertical scrollbar thumbs, the width will be the required width of
144 // the track while the height will be the minimum height.
145 virtual WebSize getSize(Part) { return WebSize(); }
146 // Paint the given the given theme part.
148 WebCanvas*, Part, State, const WebRect&, const ExtraParams*) {}
151 } // namespace WebKit