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
3 // found in the LICENSE file.
5 #ifndef APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_
6 #define APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_
10 #include "ui/gfx/path.h"
11 #include "ui/gfx/rect.h"
12 #include "ui/gfx/size.h"
13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/window/non_client_view.h"
32 class NativeAppWindow;
34 // A frameless or non-Ash, non-panel NonClientFrameView for app windows.
35 class ShellWindowFrameView : public views::NonClientFrameView,
36 public views::ButtonListener {
38 static const char kViewClassName[];
40 explicit ShellWindowFrameView(NativeAppWindow* window);
41 virtual ~ShellWindowFrameView();
43 // Initializes this for the window |frame|. Sets the number of pixels for
44 // which a click is interpreted as a resize for the inner and outer border of
45 // the window and the lower-right corner resize handle.
46 void Init(views::Widget* frame,
47 int resize_inside_bounds_size,
48 int resize_outside_bounds_size,
49 int resize_outside_scale_for_touch,
50 int resize_area_corner_size);
53 // views::NonClientFrameView implementation.
54 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
55 virtual gfx::Rect GetWindowBoundsForClientBounds(
56 const gfx::Rect& client_bounds) const OVERRIDE;
57 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
58 virtual void GetWindowMask(const gfx::Size& size,
59 gfx::Path* window_mask) OVERRIDE;
60 virtual void ResetWindowControls() OVERRIDE {}
61 virtual void UpdateWindowIcon() OVERRIDE {}
62 virtual void UpdateWindowTitle() OVERRIDE {}
64 // views::View implementation.
65 virtual gfx::Size GetPreferredSize() OVERRIDE;
66 virtual void Layout() OVERRIDE;
67 virtual const char* GetClassName() const OVERRIDE;
68 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
69 virtual gfx::Size GetMinimumSize() OVERRIDE;
70 virtual gfx::Size GetMaximumSize() OVERRIDE;
72 // views::ButtonListener implementation.
73 virtual void ButtonPressed(views::Button* sender, const ui::Event& event)
76 NativeAppWindow* window_;
77 views::Widget* frame_;
78 views::ImageButton* close_button_;
79 views::ImageButton* maximize_button_;
80 views::ImageButton* restore_button_;
81 views::ImageButton* minimize_button_;
83 // Allow resize for clicks this many pixels inside the bounds.
84 int resize_inside_bounds_size_;
86 // Size in pixels of the lower-right corner resize handle.
87 int resize_area_corner_size_;
89 DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView);
94 #endif // APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_