Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: ui/gfx/native_theme_android.h

Issue 10310136: ui: Move NativeTheme files into ui/base/native_theme/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/native_theme.cc ('k') | ui/gfx/native_theme_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_GFX_NATIVE_THEME_ANDROID_H_
6 #define UI_GFX_NATIVE_THEME_ANDROID_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "skia/ext/platform_canvas.h"
11 #include "ui/gfx/native_theme.h"
12
13 namespace gfx {
14 class Rect;
15 class Size;
16
17 // Android theming API.
18 class NativeThemeAndroid : public NativeTheme {
19 public:
20 // Gets our singleton instance.
21 static const NativeThemeAndroid* instance();
22
23 // Return the size of the part.
24 virtual Size GetPartSize(Part part,
25 State state,
26 const ExtraParams& extra) const OVERRIDE;
27
28 // Paint the part to the canvas.
29 virtual void Paint(SkCanvas* canvas,
30 Part part,
31 State state,
32 const gfx::Rect& rect,
33 const ExtraParams& extra) const OVERRIDE;
34
35 virtual SkColor GetSystemColor(ColorId color_id) const OVERRIDE;
36
37 private:
38 NativeThemeAndroid();
39 virtual ~NativeThemeAndroid();
40
41 // Draw the arrow. Used by scrollbar and inner spin button.
42 void PaintArrowButton(SkCanvas* gc,
43 const gfx::Rect& rect,
44 Part direction,
45 State state) const;
46
47 // Draw the checkbox.
48 void PaintCheckbox(SkCanvas* canvas,
49 State state,
50 const gfx::Rect& rect,
51 const ButtonExtraParams& button) const;
52
53 // Draw the radio.
54 void PaintRadio(SkCanvas* canvas,
55 State state,
56 const gfx::Rect& rect,
57 const ButtonExtraParams& button) const;
58
59 // Draw the push button.
60 void PaintButton(SkCanvas* canvas,
61 State state,
62 const gfx::Rect& rect,
63 const ButtonExtraParams& button) const;
64
65 // Draw the text field.
66 void PaintTextField(SkCanvas* canvas,
67 State state,
68 const gfx::Rect& rect,
69 const TextFieldExtraParams& text) const;
70
71 // Draw the menu list.
72 void PaintMenuList(SkCanvas* canvas,
73 State state,
74 const gfx::Rect& rect,
75 const MenuListExtraParams& menu_list) const;
76
77 // Draw the slider track.
78 void PaintSliderTrack(SkCanvas* canvas,
79 State state,
80 const gfx::Rect& rect,
81 const SliderExtraParams& slider) const;
82
83 // Draw the slider thumb.
84 void PaintSliderThumb(SkCanvas* canvas,
85 State state,
86 const gfx::Rect& rect,
87 const SliderExtraParams& slider) const;
88
89 // Draw the inner spin button.
90 void PaintInnerSpinButton(
91 SkCanvas* canvas,
92 State state,
93 const gfx::Rect& rect,
94 const InnerSpinButtonExtraParams& spin_button) const;
95
96 // Draw the progress bar.
97 void PaintProgressBar(
98 SkCanvas* canvas,
99 State state,
100 const gfx::Rect& rect,
101 const ProgressBarExtraParams& progress_bar) const;
102
103 // Return true if there is intersection between the |canvas| and the given
104 // rectangle.
105 bool IntersectsClipRectInt(SkCanvas* canvas,
106 int x,
107 int y,
108 int w,
109 int h) const;
110
111 // Draw the dest rectangle with the given bitmap which might be scaled if its
112 // size is not same as target rectangle.
113 void DrawBitmapInt(SkCanvas* canvas,
114 const SkBitmap& bitmap,
115 int src_x,
116 int src_y,
117 int src_w,
118 int src_h,
119 int dest_x,
120 int dest_y,
121 int dest_w,
122 int dest_h) const;
123
124 // Draw the target rectangle with the |bitmap| accroding the given
125 // |tile_scale_x| and |tile_scale_y|
126 void DrawTiledImage(SkCanvas* canvas,
127 const SkBitmap& bitmap,
128 int src_x,
129 int src_y,
130 double tile_scale_x,
131 double tile_scale_y,
132 int dest_x,
133 int dest_y,
134 int w,
135 int h) const;
136
137 // Return a new color which comes from the |hsv| by adjusting saturate and
138 // brighten according |saturate_amount| and |brighten_amount|
139 SkColor SaturateAndBrighten(SkScalar* hsv,
140 SkScalar saturate_amount,
141 SkScalar brighten_amount) const;
142
143 void DrawVertLine(SkCanvas* canvas,
144 int x,
145 int y1,
146 int y2,
147 const SkPaint& paint) const;
148
149 void DrawHorizLine(SkCanvas* canvas,
150 int x1,
151 int x2,
152 int y,
153 const SkPaint& paint) const;
154
155 void DrawBox(SkCanvas* canvas,
156 const gfx::Rect& rect,
157 const SkPaint& paint) const;
158
159 // Return the |value| if it is between |min| and |max|, otherwise the |min|
160 // or |max| is returned dependent on which is mostly near the |value|.
161 SkScalar Clamp(SkScalar value, SkScalar min, SkScalar max) const;
162
163 // Used to return the color of scrollbar based on the color of thumb and
164 // track.
165 SkColor OutlineColor(SkScalar* hsv1, SkScalar* hsv2) const;
166
167 DISALLOW_COPY_AND_ASSIGN(NativeThemeAndroid);
168 };
169
170 } // namespace gfx
171
172 #endif // UI_GFX_NATIVE_THEME_ANDROID_H_
OLDNEW
« no previous file with comments | « ui/gfx/native_theme.cc ('k') | ui/gfx/native_theme_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698