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_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/ui/views/constrained_window_views.h" | |
10 #include "ui/views/controls/button/button.h" | 9 #include "ui/views/controls/button/button.h" |
11 #include "ui/views/window/non_client_view.h" | 10 #include "ui/views/window/non_client_view.h" |
12 | 11 |
| 12 class ConstrainedWindowViews; |
| 13 |
13 namespace views { | 14 namespace views { |
14 class ImageButton; | 15 class ImageButton; |
15 class Label; | 16 class Label; |
| 17 class LayoutManager; |
16 } | 18 } |
17 | 19 |
18 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
19 // ConstrainedWindowFrameView | 21 // ConstrainedWindowFrameView |
20 // Provides a custom Window frame for ConstrainedWindowViews. | 22 // Provides a custom Window frame for ConstrainedWindowViews. |
21 // Implements a simple window with a minimal frame. | 23 // Implements a simple window with a minimal frame. |
22 class ConstrainedWindowFrameSimple : public views::NonClientFrameView, | 24 class ConstrainedWindowFrameSimple : public views::NonClientFrameView, |
23 public views::ButtonListener { | 25 public views::ButtonListener { |
24 public: | 26 public: |
25 explicit ConstrainedWindowFrameSimple( | 27 // Contains references to relevant views in the header. The header |
26 ConstrainedWindowViews* container, | 28 // must be non-NULL. |
27 ConstrainedWindowViews::ChromeStyleClientInsets client_insets); | 29 struct HeaderViews { |
| 30 HeaderViews(views::View* header, |
| 31 views::Label* title_label, |
| 32 views::Button* close_button); |
| 33 |
| 34 views::View* header; |
| 35 views::Label* title_label; |
| 36 views::Button* close_button; |
| 37 }; |
| 38 |
| 39 explicit ConstrainedWindowFrameSimple(ConstrainedWindowViews* container); |
28 virtual ~ConstrainedWindowFrameSimple(); | 40 virtual ~ConstrainedWindowFrameSimple(); |
29 | 41 |
| 42 // SetHeaderView assumes ownership of the passed parameter. |
| 43 void SetHeaderView(HeaderViews* header_views); |
| 44 |
30 private: | 45 private: |
31 // Overridden from views::NonClientFrameView: | 46 // Overridden from views::NonClientFrameView: |
32 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 47 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
33 virtual gfx::Rect GetWindowBoundsForClientBounds( | 48 virtual gfx::Rect GetWindowBoundsForClientBounds( |
34 const gfx::Rect& client_bounds) const OVERRIDE; | 49 const gfx::Rect& client_bounds) const OVERRIDE; |
35 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 50 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
36 virtual void GetWindowMask(const gfx::Size& size, | 51 virtual void GetWindowMask(const gfx::Size& size, |
37 gfx::Path* window_mask) OVERRIDE; | 52 gfx::Path* window_mask) OVERRIDE; |
38 virtual void ResetWindowControls() OVERRIDE; | 53 virtual void ResetWindowControls() OVERRIDE; |
39 virtual void UpdateWindowIcon() OVERRIDE; | 54 virtual void UpdateWindowIcon() OVERRIDE; |
40 virtual void UpdateWindowTitle() OVERRIDE; | 55 virtual void UpdateWindowTitle() OVERRIDE; |
41 | 56 |
42 // Overridden from View: | 57 // Overridden from View: |
43 virtual gfx::Size GetPreferredSize() OVERRIDE; | 58 virtual gfx::Size GetPreferredSize() OVERRIDE; |
44 | 59 |
45 // Overridden from ButtonListener | 60 // Overridden from ButtonListener |
46 virtual void ButtonPressed(views::Button* sender, | 61 virtual void ButtonPressed(views::Button* sender, |
47 const ui::Event& event) OVERRIDE; | 62 const ui::Event& event) OVERRIDE; |
48 | 63 |
| 64 HeaderViews* CreateDefaultHeaderView(); |
| 65 |
| 66 views::ImageButton* CreateCloseButton(); |
| 67 |
49 ConstrainedWindowViews* container_; | 68 ConstrainedWindowViews* container_; |
50 views::Label* title_label_; | 69 |
51 views::ImageButton* close_button_; | 70 views::LayoutManager* layout_; |
| 71 |
| 72 scoped_ptr<HeaderViews> header_views_; |
52 | 73 |
53 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameSimple); | 74 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameSimple); |
54 }; | 75 }; |
55 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ | 76 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ |
OLD | NEW |