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 "chrome/browser/ui/views/constrained_window_views.h" |
10 #include "ui/views/controls/button/button.h" | 10 #include "ui/views/controls/button/button.h" |
11 #include "ui/views/window/non_client_view.h" | 11 #include "ui/views/window/non_client_view.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 class ImageButton; | 14 class ImageButton; |
15 class Label; | 15 class Label; |
16 } | 16 } |
17 | 17 |
18 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
19 // ConstrainedWindowFrameView | 19 // ConstrainedWindowFrameView |
20 // Provides a custom Window frame for ConstrainedWindowViews. | 20 // Provides a custom Window frame for ConstrainedWindowViews. |
21 // Implements a simple window with a minimal frame. | 21 // Implements a simple window with a minimal frame. |
22 class ConstrainedWindowFrameSimple : public views::NonClientFrameView, | 22 class ConstrainedWindowFrameSimple : public views::NonClientFrameView, |
23 public views::ButtonListener { | 23 public views::ButtonListener { |
24 public: | 24 public: |
25 explicit ConstrainedWindowFrameSimple( | 25 explicit ConstrainedWindowFrameSimple( |
26 ConstrainedWindowViews* container, | 26 ConstrainedWindowViews* container, |
27 ConstrainedWindowViews::ChromeStyleClientInsets client_insets); | 27 ConstrainedWindowViews::ChromeStyleFrameLayout frame_layout); |
28 virtual ~ConstrainedWindowFrameSimple(); | 28 virtual ~ConstrainedWindowFrameSimple(); |
29 | 29 |
30 void set_bottom_margin(int margin) { bottom_margin_ = margin; } | 30 void set_bottom_margin(int margin) { bottom_margin_ = margin; } |
31 | 31 |
32 private: | 32 private: |
33 gfx::Insets GetClientInsets() const; | 33 gfx::Insets GetClientInsets() const; |
34 | 34 |
35 // Overridden from views::NonClientFrameView: | 35 // Overridden from views::NonClientFrameView: |
36 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; | 36 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
37 virtual gfx::Rect GetWindowBoundsForClientBounds( | 37 virtual gfx::Rect GetWindowBoundsForClientBounds( |
38 const gfx::Rect& client_bounds) const OVERRIDE; | 38 const gfx::Rect& client_bounds) const OVERRIDE; |
39 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; | 39 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; |
40 virtual void GetWindowMask(const gfx::Size& size, | 40 virtual void GetWindowMask(const gfx::Size& size, |
41 gfx::Path* window_mask) OVERRIDE; | 41 gfx::Path* window_mask) OVERRIDE; |
42 virtual void ResetWindowControls() OVERRIDE; | 42 virtual void ResetWindowControls() OVERRIDE; |
43 virtual void UpdateWindowIcon() OVERRIDE; | 43 virtual void UpdateWindowIcon() OVERRIDE; |
44 virtual void UpdateWindowTitle() OVERRIDE; | 44 virtual void UpdateWindowTitle() OVERRIDE; |
45 | 45 |
46 // Overridden from View: | 46 // Overridden from View: |
47 virtual gfx::Size GetPreferredSize() OVERRIDE; | 47 virtual gfx::Size GetPreferredSize() OVERRIDE; |
48 | 48 |
49 // Overridden from ButtonListener | 49 // Overridden from ButtonListener |
50 virtual void ButtonPressed(views::Button* sender, | 50 virtual void ButtonPressed(views::Button* sender, |
51 const ui::Event& event) OVERRIDE; | 51 const ui::Event& event) OVERRIDE; |
52 | 52 |
53 ConstrainedWindowViews* container_; | 53 ConstrainedWindowViews* container_; |
54 ConstrainedWindowViews::ChromeStyleClientInsets client_insets_; | 54 ConstrainedWindowViews::ChromeStyleFrameLayout frame_layout_; |
55 views::Label* title_label_; | 55 views::Label* title_label_; |
56 views::ImageButton* close_button_; | 56 views::ImageButton* close_button_; |
57 // Number of margin pixels between the client area and the bottom part of the | 57 // Number of margin pixels between the client area and the bottom part of the |
58 // frame. These are visually part of the frame, but are actually rendered by | 58 // frame. These are visually part of the frame, but are actually rendered by |
59 // the client area. | 59 // the client area. |
60 int bottom_margin_; | 60 int bottom_margin_; |
61 | 61 |
62 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameSimple); | 62 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowFrameSimple); |
63 }; | 63 }; |
64 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ | 64 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_FRAME_SIMPLE_H_ |
OLD | NEW |