Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / WebFallbackThemeEngine.h
blob60fb5c8e0709e8926dbb132d6d7da595e5bc6863
1 /*
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
6 * met:
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.
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 WebFallbackThemeEngine_h
32 #define WebFallbackThemeEngine_h
34 #include "WebCanvas.h"
35 #include "WebColor.h"
36 #include "WebSize.h"
38 namespace blink {
40 struct WebRect;
42 class WebFallbackThemeEngine {
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,
57 // LayoutTheme parts
58 PartCheckbox,
59 PartRadio,
60 PartButton,
61 PartTextField,
62 PartMenuList,
63 PartSliderTrack,
64 PartSliderThumb,
65 PartInnerSpinButton,
66 PartProgressBar
69 // The current state of the associated Part.
70 enum State {
71 StateDisabled,
72 StateHover,
73 StateNormal,
74 StatePressed,
77 // Extra parameters for drawing the PartScrollbarHorizontalTrack and
78 // PartScrollbarVerticalTrack.
79 struct ScrollbarTrackExtraParams {
80 // The bounds of the entire track, as opposed to the part being painted.
81 int trackX;
82 int trackY;
83 int trackWidth;
84 int trackHeight;
87 // Extra parameters for PartCheckbox, PartPushButton and PartRadio.
88 struct ButtonExtraParams {
89 bool checked;
90 bool indeterminate; // Whether the button state is indeterminate.
91 bool isDefault; // Whether the button is default button.
92 bool hasBorder;
93 WebColor backgroundColor;
96 // Extra parameters for PartTextField
97 struct TextFieldExtraParams {
98 bool isTextArea;
99 bool isListbox;
100 WebColor backgroundColor;
103 // Extra parameters for PartMenuList
104 struct MenuListExtraParams {
105 bool hasBorder;
106 bool hasBorderRadius;
107 int arrowX;
108 int arrowY;
109 WebColor backgroundColor;
112 // Extra parameters for PartSliderTrack and PartSliderThumb
113 struct SliderExtraParams {
114 bool vertical;
115 bool inDrag;
118 // Extra parameters for PartInnerSpinButton
119 struct InnerSpinButtonExtraParams {
120 bool spinUp;
121 bool readOnly;
124 // Extra parameters for PartProgressBar
125 struct ProgressBarExtraParams {
126 bool determinate;
127 int valueRectX;
128 int valueRectY;
129 int valueRectWidth;
130 int valueRectHeight;
133 union ExtraParams {
134 ScrollbarTrackExtraParams scrollbarTrack;
135 ButtonExtraParams button;
136 TextFieldExtraParams textField;
137 MenuListExtraParams menuList;
138 SliderExtraParams slider;
139 InnerSpinButtonExtraParams innerSpin;
140 ProgressBarExtraParams progressBar;
143 // Gets the size of the given theme part. For variable sized items
144 // like vertical scrollbar thumbs, the width will be the required width of
145 // the track while the height will be the minimum height.
146 virtual WebSize getSize(Part) { return WebSize(); }
147 // Paint the given the given theme part.
148 virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParams*) { }
151 } // namespace blink
153 #endif