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 ASH_WM_PANELS_PANEL_FRAME_VIEW_H_
6#define ASH_WM_PANELS_PANEL_FRAME_VIEW_H_
7
8#include "ash/ash_export.h"
9#include "base/basictypes.h"
10#include "ui/views/window/non_client_view.h"
11
12namespace views {
13class ImageView;
14}
15
16namespace ash {
17class DefaultHeaderPainter;
18class FrameCaptionButtonContainerView;
19class FrameBorderHitTestController;
20
21class ASH_EXPORT PanelFrameView : public views::NonClientFrameView {
22 public:
23  // Internal class name.
24  static const char kViewClassName[];
25
26  enum FrameType {
27    FRAME_NONE,
28    FRAME_ASH
29  };
30
31  PanelFrameView(views::Widget* frame, FrameType frame_type);
32  virtual ~PanelFrameView();
33
34  // Overridden from views::View:
35  virtual const char* GetClassName() const OVERRIDE;
36
37 private:
38  void InitHeaderPainter();
39
40  // Height from top of window to top of client area.
41  int NonClientTopBorderHeight() const;
42
43  // Overridden from views::NonClientFrameView:
44  virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
45  virtual gfx::Rect GetWindowBoundsForClientBounds(
46      const gfx::Rect& client_bounds) const OVERRIDE;
47  virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
48  virtual void GetWindowMask(const gfx::Size& size,
49                             gfx::Path* window_mask) OVERRIDE;
50  virtual void ResetWindowControls() OVERRIDE;
51  virtual void UpdateWindowIcon() OVERRIDE;
52  virtual void UpdateWindowTitle() OVERRIDE;
53  virtual void SizeConstraintsChanged() OVERRIDE;
54
55  // Overridden from views::View:
56  virtual gfx::Size GetMinimumSize() const OVERRIDE;
57  virtual void Layout() OVERRIDE;
58  virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
59
60  // Child View class describing the panel's title bar behavior
61  // and buttons, owned by the view hierarchy
62  views::Widget* frame_;
63  FrameCaptionButtonContainerView* caption_button_container_;
64  views::ImageView* window_icon_;
65  gfx::Rect client_view_bounds_;
66
67  // Helper class for painting the header.
68  scoped_ptr<DefaultHeaderPainter> header_painter_;
69
70  // Updates the hittest bounds overrides based on the window state type.
71  scoped_ptr<FrameBorderHitTestController> frame_border_hit_test_controller_;
72
73  DISALLOW_COPY_AND_ASSIGN(PanelFrameView);
74};
75
76}
77
78#endif // ASH_WM_PANELS_PANEL_FRAME_VIEW_H_
79