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

Side by Side Diff: ash/wm/caption_buttons/frame_caption_button.h

Issue 148003003: Use white header for app windows part #2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ 5 #ifndef ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_
6 #define ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ 6 #define ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/wm/caption_buttons/caption_button_types.h" 9 #include "ash/wm/caption_buttons/caption_button_types.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 14 matching lines...) Expand all
25 25
26 static const char kViewClassName[]; 26 static const char kViewClassName[];
27 27
28 FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon); 28 FrameCaptionButton(views::ButtonListener* listener, CaptionButtonIcon icon);
29 virtual ~FrameCaptionButton(); 29 virtual ~FrameCaptionButton();
30 30
31 // Sets the images to use to paint the button. If |animate| is ANIMATE_YES, 31 // Sets the images to use to paint the button. If |animate| is ANIMATE_YES,
32 // the button crossfades to the new visuals. 32 // the button crossfades to the new visuals.
33 void SetImages(CaptionButtonIcon icon, 33 void SetImages(CaptionButtonIcon icon,
34 Animate animate, 34 Animate animate,
35 int normal_image_id, 35 int icon_image_id,
36 int hovered_image_id, 36 int inactive_icon_image_id,
37 int pressed_image_id); 37 int hovered_background_image_id,
38 int pressed_background_image_id);
38 39
39 // views::View overrides: 40 // views::View overrides:
40 virtual gfx::Size GetPreferredSize() OVERRIDE; 41 virtual gfx::Size GetPreferredSize() OVERRIDE;
41 virtual const char* GetClassName() const OVERRIDE; 42 virtual const char* GetClassName() const OVERRIDE;
42 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 43 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
43 44
45 void set_paint_as_active(bool paint_as_active) {
46 paint_as_active_ = paint_as_active;
47 }
48
44 CaptionButtonIcon icon() const { 49 CaptionButtonIcon icon() const {
45 return icon_; 50 return icon_;
46 } 51 }
47 52
48 // Returns true if the button is crossfading to new visuals set in 53 // Returns true if the button is crossfading to new visuals set in
49 // SetImages(). 54 // SetImages().
50 bool is_animating_image_swap() const { 55 bool is_animating_image_swap() const {
51 return swap_images_animation_->is_animating(); 56 return swap_images_animation_->is_animating();
52 } 57 }
53 58
54 protected: 59 protected:
55 // views::CustomButton overrides: 60 // views::CustomButton overrides:
56 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 61 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
57 virtual void StateChanged() OVERRIDE; 62 virtual void StateChanged() OVERRIDE;
58 63
59 private: 64 private:
60 // Paints the button as it will look at the end of |swap_images_animation_|. 65 // Paints the button as it will look at the end of |swap_images_animation_|.
61 void PaintWithAnimationEndState(gfx::Canvas* canvas, int opacity); 66 void PaintWithAnimationEndState(gfx::Canvas* canvas, int opacity);
62 67
63 // The button's current icon. 68 // The button's current icon.
64 CaptionButtonIcon icon_; 69 CaptionButtonIcon icon_;
65 70
71 // Whether the button should be painted as active.
72 bool paint_as_active_;
73
66 // The scale at which the button was previously painted. 74 // The scale at which the button was previously painted.
67 float last_paint_scale_; 75 float last_paint_scale_;
68 76
69 // The images and image ids used to paint the button. 77 // The images and image ids used to paint the button.
70 int normal_image_id_; 78 int icon_image_id_;
71 int hovered_image_id_; 79 int inactive_icon_image_id_;
72 int pressed_image_id_; 80 int hovered_background_image_id_;
73 gfx::ImageSkia normal_image_; 81 int pressed_background_image_id_;
74 gfx::ImageSkia hovered_image_; 82 gfx::ImageSkia icon_image_;
75 gfx::ImageSkia pressed_image_; 83 gfx::ImageSkia inactive_icon_image_;
84 gfx::ImageSkia hovered_background_image_;
85 gfx::ImageSkia pressed_background_image_;
76 86
77 // The image to crossfade from. 87 // The image to crossfade from.
78 gfx::ImageSkia crossfade_image_; 88 gfx::ImageSkia crossfade_image_;
79 89
80 // Crossfade animation started when the button's images are changed by 90 // Crossfade animation started when the button's images are changed by
81 // SetImages(). 91 // SetImages().
82 scoped_ptr<gfx::SlideAnimation> swap_images_animation_; 92 scoped_ptr<gfx::SlideAnimation> swap_images_animation_;
83 93
84 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton); 94 DISALLOW_COPY_AND_ASSIGN(FrameCaptionButton);
85 }; 95 };
86 96
87 } // namespace ash 97 } // namespace ash
88 98
89 #endif // ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_ 99 #endif // ASH_WM_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698