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

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

Issue 8597015: Add a new GetSystemColor method to native theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for review Created 9 years, 1 month 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/gfx/native_theme_base.h » ('j') | ui/gfx/native_theme_base.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_GFX_NATIVE_THEME_H_ 5 #ifndef UI_GFX_NATIVE_THEME_H_
6 #define UI_GFX_NATIVE_THEME_H_ 6 #define UI_GFX_NATIVE_THEME_H_
7 #pragma once 7 #pragma once
8 8
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/ui_export.h" 10 #include "ui/base/ui_export.h"
11 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 12
13 class SkCanvas; 13 class SkCanvas;
14 14
15 namespace gfx { 15 namespace gfx {
16 16
17 class Rect; 17 class Rect;
18 class Size; 18 class Size;
19 19
20 // This class supports drawing UI controls (like buttons, text fields, lists, 20 // This class supports drawing UI controls (like buttons, text fields, lists,
21 // comboboxes, etc) that look like the native UI controls of the underlying 21 // comboboxes, etc) that look like the native UI controls of the underlying
22 // platform, such as Windows or Linux. 22 // platform, such as Windows or Linux. It also supplies default colors for
James Cook 2011/11/18 23:22:50 Thanks for adding file/class level docs.
23 // dialog box backgrounds, etc., which are obtained from the system theme where
24 // possible.
23 // 25 //
24 // The supported control types are listed in the Part enum. These parts can be 26 // The supported control types are listed in the Part enum. These parts can be
25 // in any state given by the State enum, where the actual definititon of the 27 // in any state given by the State enum, where the actual definition of the
26 // state is part-specific. 28 // state is part-specific. The supported colors are listed in the ColorId enum.
27 // 29 //
28 // Some parts require more information than simply the state in order to be 30 // Some parts require more information than simply the state in order to be
29 // drawn correctly, and this information is given to the Paint() method via the 31 // drawn correctly, and this information is given to the Paint() method via the
30 // ExtraParams union. Each part that requires more information has its own 32 // ExtraParams union. Each part that requires more information has its own
31 // field in the union. 33 // field in the union.
32 // 34 //
33 // NativeTheme also supports getting the default size of a given part with 35 // NativeTheme also supports getting the default size of a given part with
34 // the GetPartSize() method. 36 // the GetPartSize() method.
35 class UI_EXPORT NativeTheme { 37 class UI_EXPORT NativeTheme {
36 public: 38 public:
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 Part part, 207 Part part,
206 State state, 208 State state,
207 const gfx::Rect& rect, 209 const gfx::Rect& rect,
208 const ExtraParams& extra) const = 0; 210 const ExtraParams& extra) const = 0;
209 211
210 // Supports theme specific colors. 212 // Supports theme specific colors.
211 void SetScrollbarColors(unsigned inactive_color, 213 void SetScrollbarColors(unsigned inactive_color,
212 unsigned active_color, 214 unsigned active_color,
213 unsigned track_color) const; 215 unsigned track_color) const;
214 216
217 // Colors for GetSystemColor().
218 enum ColorId {
219 kDialogBackgroundColor
220 // TODO(benrg): move other hardcoded colors here.
221 };
222
223 // Return a color from the system theme.
224 virtual SkColor GetSystemColor(ColorId color_id) const = 0;
225
215 // Returns a shared instance of the native theme. 226 // Returns a shared instance of the native theme.
216 // The returned object should not be deleted by the caller. This function 227 // The returned object should not be deleted by the caller. This function
217 // is not thread safe and should only be called from the UI thread. 228 // is not thread safe and should only be called from the UI thread.
218 // Each port of NativeTheme should provide its own implementation of this 229 // Each port of NativeTheme should provide its own implementation of this
219 // function, returning the port's subclass. 230 // function, returning the port's subclass.
220 static const NativeTheme* instance(); 231 static const NativeTheme* instance();
221 232
222 protected: 233 protected:
223 NativeTheme() {} 234 NativeTheme() {}
224 virtual ~NativeTheme() {} 235 virtual ~NativeTheme() {}
225 236
226 static unsigned int thumb_inactive_color_; 237 static unsigned int thumb_inactive_color_;
227 static unsigned int thumb_active_color_; 238 static unsigned int thumb_active_color_;
228 static unsigned int track_color_; 239 static unsigned int track_color_;
229 240
230 DISALLOW_COPY_AND_ASSIGN(NativeTheme); 241 DISALLOW_COPY_AND_ASSIGN(NativeTheme);
231 }; 242 };
232 243
233 } // namespace gfx 244 } // namespace gfx
234 245
235 #endif // UI_GFX_NATIVE_THEME_H_ 246 #endif // UI_GFX_NATIVE_THEME_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/native_theme_base.h » ('j') | ui/gfx/native_theme_base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698