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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
« no previous file with comments | « ui/native_theme/native_theme.gyp ('k') | ui/native_theme/native_theme_aura.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_NATIVE_THEME_NATIVE_THEME_AURA_H_
6 #define UI_NATIVE_THEME_NATIVE_THEME_AURA_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/native_theme/fallback_theme.h"
11
12 namespace gfx {
13 class NineImagePainter;
14 }
15
16 namespace ui {
17
18 // Aura implementation of native theme support.
19 class NATIVE_THEME_EXPORT NativeThemeAura : public FallbackTheme {
20 public:
21 static NativeThemeAura* instance();
22
23 protected:
24 NativeThemeAura();
25 virtual ~NativeThemeAura();
26
27 // Overridden from NativeThemeBase:
28 virtual void PaintMenuPopupBackground(
29 SkCanvas* canvas,
30 const gfx::Size& size,
31 const MenuBackgroundExtraParams& menu_background) const override;
32 virtual void PaintMenuItemBackground(
33 SkCanvas* canvas,
34 State state,
35 const gfx::Rect& rect,
36 const MenuListExtraParams& menu_list) const override;
37 virtual void PaintArrowButton(SkCanvas* gc,
38 const gfx::Rect& rect,
39 Part direction,
40 State state) const override;
41 virtual void PaintScrollbarTrack(
42 SkCanvas* sk_canvas,
43 Part part,
44 State state,
45 const ScrollbarTrackExtraParams& extra_params,
46 const gfx::Rect& rect) const override;
47 virtual void PaintScrollbarThumb(SkCanvas* sk_canvas,
48 Part part,
49 State state,
50 const gfx::Rect& rect) const override;
51 virtual void PaintScrollbarCorner(SkCanvas* canvas,
52 State state,
53 const gfx::Rect& rect) const override;
54
55 virtual void PaintScrollbarThumbStateTransition(SkCanvas* canvas,
56 State startState,
57 State endState,
58 double progress,
59 const gfx::Rect& rect) const
60 override;
61
62 // Returns the NineImagePainter used to paint the specified state, creating if
63 // necessary. If no image is provided for the specified state the normal state
64 // images are used.
65 gfx::NineImagePainter* GetOrCreatePainter(
66 const int image_ids[kNumStates][9],
67 State state,
68 scoped_ptr<gfx::NineImagePainter> painters[kNumStates]) const;
69
70 // Paints |painter| into the canvas using |rect|.
71 void PaintPainter(gfx::NineImagePainter* painter,
72 SkCanvas* sk_canvas,
73 const gfx::Rect& rect) const;
74
75 mutable scoped_ptr<gfx::NineImagePainter> scrollbar_track_painter_;
76
77 mutable scoped_ptr<gfx::NineImagePainter>
78 scrollbar_thumb_painters_[kNumStates];
79
80 mutable scoped_ptr<gfx::NineImagePainter>
81 scrollbar_arrow_button_painters_[kNumStates];
82
83 private:
84 struct DualPainter {
85 // For overlay scrollbar thumbs, fill and stroke are controlled separately,
86 // and each state is achieved by painting with different opacity. This
87 // struct bundles information of painter generated using assets and alpha
88 // value associated with each state, so that a DualPainter for overlay
89 // scrollbar thumb would only need state as input to paint correctly.
90 DualPainter(scoped_ptr<gfx::NineImagePainter> fill_painter,
91 const uint8 fill_alphas[kNumStates],
92 scoped_ptr<gfx::NineImagePainter> stroke_painter,
93 const uint8 stroke_alphas[kNumStates]);
94 ~DualPainter();
95
96 scoped_ptr<gfx::NineImagePainter> fill_painter;
97 const uint8* const fill_alphas;
98 scoped_ptr<gfx::NineImagePainter> stroke_painter;
99 const uint8* const stroke_alphas;
100 };
101
102 // Returns DualPainter from specific fill and stroke, creating if necessary.
103 scoped_ptr<DualPainter> CreateDualPainter(
104 const int fill_image_ids[9],
105 const uint8 fill_alphas[kNumStates],
106 const int stroke_image_ids[9],
107 const uint8 stroke_alphas[kNumStates]) const;
108
109 // Paints |dualPainter| into the canvas using |rect| and specific alpha.
110 void PaintDualPainter(DualPainter* dual_painter,
111 SkCanvas* sk_canvas,
112 const gfx::Rect& rect,
113 State state) const;
114
115 void PaintDualPainterTransition(DualPainter* dual_painter,
116 SkCanvas* sk_canvas,
117 const gfx::Rect& rect,
118 State startState,
119 State endState,
120 double progress) const;
121
122 mutable scoped_ptr<DualPainter> scrollbar_overlay_thumb_painter_;
123
124 DISALLOW_COPY_AND_ASSIGN(NativeThemeAura);
125 };
126
127 } // namespace ui
128
129 #endif // UI_NATIVE_THEME_NATIVE_THEME_AURA_H_
OLDNEW
« no previous file with comments | « ui/native_theme/native_theme.gyp ('k') | ui/native_theme/native_theme_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698