OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_FRAME_VIEW_H_ | 5 #ifndef APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_FRAME_VIEW_H_ | 6 #define APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ui/gfx/path.h" | 10 #include "ui/gfx/path.h" |
11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/size.h" |
13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/button.h" |
14 #include "ui/views/window/non_client_view.h" | 14 #include "ui/views/window/non_client_view.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gfx { |
17 class Canvas; | 17 class Canvas; |
18 class Point; | 18 class Point; |
19 } | 19 } |
20 | 20 |
21 namespace ui { | 21 namespace ui { |
22 class Event; | 22 class Event; |
23 } | 23 } |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 class ImageButton; | 26 class ImageButton; |
27 class Widget; | 27 class Widget; |
28 } | 28 } |
29 | 29 |
30 class NativeAppWindowViews; | 30 namespace apps { |
| 31 |
| 32 class NativeAppWindow; |
31 | 33 |
32 // A frameless or non-Ash, non-panel NonClientFrameView for app windows. | 34 // A frameless or non-Ash, non-panel NonClientFrameView for app windows. |
33 class ShellWindowFrameView : public views::NonClientFrameView, | 35 class ShellWindowFrameView : public views::NonClientFrameView, |
34 public views::ButtonListener { | 36 public views::ButtonListener { |
35 public: | 37 public: |
36 static const char kViewClassName[]; | 38 static const char kViewClassName[]; |
37 | 39 |
38 explicit ShellWindowFrameView(NativeAppWindowViews* window); | 40 explicit ShellWindowFrameView(NativeAppWindow* window); |
39 virtual ~ShellWindowFrameView(); | 41 virtual ~ShellWindowFrameView(); |
40 | 42 |
41 void Init(views::Widget* frame); | 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); |
42 | 51 |
43 private: | 52 private: |
44 // views::NonClientFrameView implementation. | 53 // views::NonClientFrameView implementation. |
45 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 54 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
46 virtual gfx::Rect GetWindowBoundsForClientBounds( | 55 virtual gfx::Rect GetWindowBoundsForClientBounds( |
47 const gfx::Rect& client_bounds) const OVERRIDE; | 56 const gfx::Rect& client_bounds) const OVERRIDE; |
48 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 57 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
49 virtual void GetWindowMask(const gfx::Size& size, | 58 virtual void GetWindowMask(const gfx::Size& size, |
50 gfx::Path* window_mask) OVERRIDE; | 59 gfx::Path* window_mask) OVERRIDE; |
51 virtual void ResetWindowControls() OVERRIDE {} | 60 virtual void ResetWindowControls() OVERRIDE {} |
52 virtual void UpdateWindowIcon() OVERRIDE {} | 61 virtual void UpdateWindowIcon() OVERRIDE {} |
53 virtual void UpdateWindowTitle() OVERRIDE {} | 62 virtual void UpdateWindowTitle() OVERRIDE {} |
54 | 63 |
55 // views::View implementation. | 64 // views::View implementation. |
56 virtual gfx::Size GetPreferredSize() OVERRIDE; | 65 virtual gfx::Size GetPreferredSize() OVERRIDE; |
57 virtual void Layout() OVERRIDE; | 66 virtual void Layout() OVERRIDE; |
58 virtual const char* GetClassName() const OVERRIDE; | 67 virtual const char* GetClassName() const OVERRIDE; |
59 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 68 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
60 virtual gfx::Size GetMinimumSize() OVERRIDE; | 69 virtual gfx::Size GetMinimumSize() OVERRIDE; |
61 virtual gfx::Size GetMaximumSize() OVERRIDE; | 70 virtual gfx::Size GetMaximumSize() OVERRIDE; |
62 | 71 |
63 // views::ButtonListener implementation. | 72 // views::ButtonListener implementation. |
64 virtual void ButtonPressed(views::Button* sender, const ui::Event& event) | 73 virtual void ButtonPressed(views::Button* sender, const ui::Event& event) |
65 OVERRIDE; | 74 OVERRIDE; |
66 | 75 |
67 NativeAppWindowViews* window_; | 76 NativeAppWindow* window_; |
68 views::Widget* frame_; | 77 views::Widget* frame_; |
69 views::ImageButton* close_button_; | 78 views::ImageButton* close_button_; |
70 views::ImageButton* maximize_button_; | 79 views::ImageButton* maximize_button_; |
71 views::ImageButton* restore_button_; | 80 views::ImageButton* restore_button_; |
72 views::ImageButton* minimize_button_; | 81 views::ImageButton* minimize_button_; |
73 | 82 |
| 83 // Allow resize for clicks this many pixels inside the bounds. |
| 84 int resize_inside_bounds_size_; |
| 85 |
| 86 // Size in pixels of the lower-right corner resize handle. |
| 87 int resize_area_corner_size_; |
| 88 |
74 DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView); | 89 DISALLOW_COPY_AND_ASSIGN(ShellWindowFrameView); |
75 }; | 90 }; |
76 | 91 |
77 #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_FRAME_VIEW_H_ | 92 } // namespace apps |
| 93 |
| 94 #endif // APPS_UI_VIEWS_SHELL_WINDOW_FRAME_VIEW_H_ |
OLD | NEW |