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