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

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

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

Powered by Google App Engine
This is Rietveld 408576698