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 ASH_WM_DIALOG_FRAME_VIEW_H_ | 5 #ifndef ASH_WM_DIALOG_FRAME_VIEW_H_ |
6 #define ASH_WM_DIALOG_FRAME_VIEW_H_ | 6 #define ASH_WM_DIALOG_FRAME_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "ui/views/controls/button/button.h" |
9 #include "ui/views/window/non_client_view.h" | 10 #include "ui/views/window/non_client_view.h" |
10 | 11 |
| 12 class SkBitmap; |
| 13 |
11 namespace gfx { | 14 namespace gfx { |
12 class Font; | 15 class Font; |
13 } | 16 } |
14 | 17 |
| 18 namespace views { |
| 19 class ImageButton; |
| 20 } |
| 21 |
15 namespace ash { | 22 namespace ash { |
16 namespace internal { | 23 namespace internal { |
17 | 24 |
18 // A NonClientFrameView that implements a Google-style for dialogs. | 25 // A NonClientFrameView that implements a Google-style for dialogs. |
19 class DialogFrameView : public views::NonClientFrameView { | 26 class DialogFrameView : public views::NonClientFrameView, |
| 27 public views::ButtonListener { |
20 public: | 28 public: |
21 // Internal class name. | 29 // Internal class name. |
22 static const char kViewClassName[]; | 30 static const char kViewClassName[]; |
23 | 31 |
24 DialogFrameView(); | 32 DialogFrameView(); |
25 virtual ~DialogFrameView(); | 33 virtual ~DialogFrameView(); |
26 | 34 |
27 // Overridden from views::NonClientFrameView: | 35 // Overridden from views::NonClientFrameView: |
28 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 36 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
29 virtual gfx::Rect GetWindowBoundsForClientBounds( | 37 virtual gfx::Rect GetWindowBoundsForClientBounds( |
30 const gfx::Rect& client_bounds) const OVERRIDE; | 38 const gfx::Rect& client_bounds) const OVERRIDE; |
31 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 39 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
32 virtual void GetWindowMask(const gfx::Size& size, | 40 virtual void GetWindowMask(const gfx::Size& size, |
33 gfx::Path* window_mask) OVERRIDE; | 41 gfx::Path* window_mask) OVERRIDE; |
34 virtual void ResetWindowControls() OVERRIDE; | 42 virtual void ResetWindowControls() OVERRIDE; |
35 virtual void UpdateWindowIcon() OVERRIDE; | 43 virtual void UpdateWindowIcon() OVERRIDE; |
36 | 44 |
37 // Overridden from View: | 45 // Overridden from View: |
38 virtual std::string GetClassName() const OVERRIDE; | 46 virtual std::string GetClassName() const OVERRIDE; |
39 virtual void Layout() OVERRIDE; | 47 virtual void Layout() OVERRIDE; |
40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 48 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
41 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 49 |
42 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 50 // Overridden from views::ButtonListener: |
| 51 virtual void ButtonPressed(views::Button* sender, |
| 52 const views::Event& event) OVERRIDE; |
43 | 53 |
44 private: | 54 private: |
45 int GetNonClientTopHeight() const; | 55 gfx::Insets GetPaddingInsets() const; |
| 56 gfx::Insets GetClientInsets() const; |
46 | 57 |
47 gfx::Rect title_display_rect_; | 58 gfx::Rect title_display_rect_; |
48 gfx::Rect close_button_rect_; | 59 |
| 60 views::ImageButton* close_button_; |
49 | 61 |
50 static gfx::Font* title_font_; | 62 static gfx::Font* title_font_; |
51 | 63 |
52 DISALLOW_COPY_AND_ASSIGN(DialogFrameView); | 64 DISALLOW_COPY_AND_ASSIGN(DialogFrameView); |
53 }; | 65 }; |
54 | 66 |
55 } // namespace internal | 67 } // namespace internal |
56 } // namespace views | 68 } // namespace views |
57 | 69 |
58 #endif // ASH_WM_DIALOG_FRAME_VIEW_H_ | 70 #endif // ASH_WM_DIALOG_FRAME_VIEW_H_ |
OLD | NEW |