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

Side by Side Diff: ui/base/native_theme/native_theme_android.h

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

Powered by Google App Engine
This is Rietveld 408576698