Update optimize_png_files.sh to work on msysgit bash.
[chromium-blink-merge.git] / ash / frame / default_header_painter.h
blobe06c31208f145d4ea64d493db7f17b35b26168a8
1 // Copyright 2014 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.
5 #ifndef ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
6 #define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
8 #include "ash/ash_export.h"
9 #include "ash/frame/header_painter.h"
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" // OVERRIDE
12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ui/gfx/animation/animation_delegate.h"
16 namespace gfx {
17 class ImageSkia;
18 class Rect;
19 class SlideAnimation;
21 namespace views {
22 class View;
23 class Widget;
26 namespace ash {
27 class FrameCaptionButtonContainerView;
29 // Helper class for painting the default window header.
30 class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
31 public gfx::AnimationDelegate {
32 public:
33 DefaultHeaderPainter();
34 virtual ~DefaultHeaderPainter();
36 // DefaultHeaderPainter does not take ownership of any of the parameters.
37 void Init(views::Widget* frame,
38 views::View* header_view,
39 views::View* window_icon,
40 FrameCaptionButtonContainerView* caption_button_container);
42 // HeaderPainter overrides:
43 virtual int GetMinimumHeaderWidth() const OVERRIDE;
44 virtual void PaintHeader(gfx::Canvas* canvas, Mode mode) OVERRIDE;
45 virtual void LayoutHeader() OVERRIDE;
46 virtual int GetHeaderHeightForPainting() const OVERRIDE;
47 virtual void SetHeaderHeightForPainting(int height) OVERRIDE;
48 virtual void SchedulePaintForTitle() OVERRIDE;
50 // Sets the window icon for the header. Passing NULL removes the window icon.
51 void UpdateWindowIcon(views::View* window_icon, int icon_size);
53 private:
54 FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
56 // gfx::AnimationDelegate override:
57 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
59 // Paints highlight around the edge of the header for inactive restored
60 // windows.
61 void PaintHighlightForInactiveRestoredWindow(gfx::Canvas* canvas);
63 // Paints the title bar, primarily the title string.
64 void PaintTitleBar(gfx::Canvas* canvas);
66 // Paints the header/content separator.
67 void PaintHeaderContentSeparator(gfx::Canvas* canvas);
69 // Returns the header bounds in the coordinates of |view_|. The header is
70 // assumed to be positioned at the top left corner of |view_| and to have the
71 // same width as |view_|.
72 gfx::Rect GetLocalBounds() const;
74 // Returns the bounds for the title.
75 gfx::Rect GetTitleBounds() const;
77 // Returns the frame image to use when |frame_| is active.
78 gfx::ImageSkia* GetActiveFrameImage() const;
80 // Returns the frame image to use when |frame_| is inactive.
81 gfx::ImageSkia* GetInactiveFrameImage() const;
83 views::Widget* frame_;
84 views::View* view_;
85 views::View* window_icon_; // May be NULL.
86 int window_icon_size_;
87 FrameCaptionButtonContainerView* caption_button_container_;
89 // The height of the header including the header/content separator.
90 int height_;
92 // Whether the header should be painted as active.
93 Mode mode_;
95 // Whether the header is painted for the first time.
96 bool initial_paint_;
98 scoped_ptr<gfx::SlideAnimation> activation_animation_;
100 DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
103 } // namespace ash
105 #endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_