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" | |
9 #include "ui/views/controls/button/button.h" | |
8 #include "ui/views/window/non_client_view.h" | 10 #include "ui/views/window/non_client_view.h" |
9 | 11 |
10 class ConstrainedWindowViews; | 12 class ConstrainedWindowViews; |
11 | 13 |
14 namespace views { | |
15 class ImageButton; | |
16 class LayoutManager; | |
17 } | |
18 | |
12 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
13 // ConstrainedWindowFrameView | 20 // ConstrainedWindowFrameView |
14 // Provides a custom Window frame for ConstrainedWindowViews. | 21 // Provides a custom Window frame for ConstrainedWindowViews. |
15 // Implements a simple window with a minimal frame. | 22 // Implements a simple window with a minimal frame. |
16 class ConstrainedWindowFrameSimple : public views::NonClientFrameView { | 23 class ConstrainedWindowFrameSimple : public views::NonClientFrameView, |
24 public views::ButtonListener { | |
17 public: | 25 public: |
18 explicit ConstrainedWindowFrameSimple(ConstrainedWindowViews* container); | 26 explicit ConstrainedWindowFrameSimple(ConstrainedWindowViews* container); |
19 virtual ~ConstrainedWindowFrameSimple() {} | 27 virtual ~ConstrainedWindowFrameSimple() {} |
20 | 28 |
29 void SetHeaderView(views::View* view); | |
30 | |
31 enum ButtonTag { | |
32 CLOSE_WIDGET | |
Ben Goodger (Google)
2012/09/27 16:16:12
rather than use tag (which we are moving away from
Mike Wittman
2012/09/28 22:46:09
Done.
| |
33 }; | |
34 | |
21 private: | 35 private: |
22 // Overridden from views::NonClientFrameView: | 36 // Overridden from views::NonClientFrameView: |
23 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 37 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
24 virtual gfx::Rect GetWindowBoundsForClientBounds( | 38 virtual gfx::Rect GetWindowBoundsForClientBounds( |
25 const gfx::Rect& client_bounds) const OVERRIDE; | 39 const gfx::Rect& client_bounds) const OVERRIDE; |
26 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 40 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
27 virtual void GetWindowMask(const gfx::Size& size, | 41 virtual void GetWindowMask(const gfx::Size& size, |
28 gfx::Path* window_mask) OVERRIDE {} | 42 gfx::Path* window_mask) OVERRIDE; |
29 virtual void ResetWindowControls() OVERRIDE {} | 43 virtual void ResetWindowControls() OVERRIDE; |
30 virtual void UpdateWindowIcon() OVERRIDE {} | 44 virtual void UpdateWindowIcon() OVERRIDE; |
45 | |
46 // Overridden from View: | |
47 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
48 | |
49 // Overridden from ButtonListener | |
50 virtual void ButtonPressed(views::Button* sender, | |
51 const ui::Event& event) OVERRIDE; | |
52 | |
53 views::View* CreateDefaultHeaderView(); | |
54 | |
55 views::ImageButton* CreateCloseButton(); | |
56 | |
57 ConstrainedWindowViews* container_; | |
58 | |
59 views::LayoutManager* layout_; | |
60 | |
61 // A weak pointer to the view used to render the header. | |
62 View* header_view_; | |
31 | 63 |
32 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameSimple); | 64 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameSimple); |
33 }; | 65 }; |
34 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ | 66 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ |
OLD | NEW |