| 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 UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 5 #ifndef UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
| 6 #define UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 6 #define UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
| 13 #include "ui/views/controls/button/button.h" | 13 #include "ui/views/controls/button/image_button.h" |
| 14 #include "ui/views/window/frame_buttons.h" | 14 #include "ui/views/window/frame_buttons.h" |
| 15 #include "ui/views/window/non_client_view.h" | 15 #include "ui/views/window/non_client_view.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 class FrameBackground; | 19 class FrameBackground; |
| 20 class ImageButton; | |
| 21 class Widget; | 20 class Widget; |
| 22 | 21 |
| 23 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
| 24 // | 23 // |
| 25 // CustomFrameView | 24 // CustomFrameView |
| 26 // | 25 // |
| 27 // A view that provides the non client frame for Windows. This means | 26 // A view that provides the non client frame for Windows. This means |
| 28 // rendering the non-standard window caption, border, and controls. | 27 // rendering the non-standard window caption, border, and controls. |
| 29 // | 28 // |
| 30 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
| 31 class VIEWS_EXPORT CustomFrameView : public NonClientFrameView, | 30 class VIEWS_EXPORT CustomFrameView : public NonClientFrameView, |
| 32 public ButtonListener { | 31 public ImageButtonDelegate { |
| 33 public: | 32 public: |
| 34 CustomFrameView(); | 33 CustomFrameView(); |
| 35 ~CustomFrameView() override; | 34 ~CustomFrameView() override; |
| 36 | 35 |
| 37 void Init(Widget* frame); | 36 void Init(Widget* frame); |
| 38 | 37 |
| 39 // Overridden from NonClientFrameView: | 38 // NonClientFrameView: |
| 40 gfx::Rect GetBoundsForClientView() const override; | 39 gfx::Rect GetBoundsForClientView() const override; |
| 41 gfx::Rect GetWindowBoundsForClientBounds( | 40 gfx::Rect GetWindowBoundsForClientBounds( |
| 42 const gfx::Rect& client_bounds) const override; | 41 const gfx::Rect& client_bounds) const override; |
| 43 int NonClientHitTest(const gfx::Point& point) override; | 42 int NonClientHitTest(const gfx::Point& point) override; |
| 44 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | 43 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; |
| 45 void ResetWindowControls() override; | 44 void ResetWindowControls() override; |
| 46 void UpdateWindowIcon() override; | 45 void UpdateWindowIcon() override; |
| 47 void UpdateWindowTitle() override; | 46 void UpdateWindowTitle() override; |
| 48 void SizeConstraintsChanged() override; | 47 void SizeConstraintsChanged() override; |
| 49 void ActivationChanged(bool active) override; | 48 void ActivationChanged(bool active) override; |
| 50 | 49 |
| 51 // Overridden from View: | 50 // View: |
| 52 void OnPaint(gfx::Canvas* canvas) override; | 51 void OnPaint(gfx::Canvas* canvas) override; |
| 53 void Layout() override; | 52 void Layout() override; |
| 54 gfx::Size GetPreferredSize() const override; | 53 gfx::Size GetPreferredSize() const override; |
| 55 gfx::Size GetMinimumSize() const override; | 54 gfx::Size GetMinimumSize() const override; |
| 56 gfx::Size GetMaximumSize() const override; | 55 gfx::Size GetMaximumSize() const override; |
| 57 | 56 |
| 58 // Overridden from ButtonListener: | 57 // ImageButtonDelegate: |
| 59 void ButtonPressed(Button* sender, const ui::Event& event) override; | 58 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 60 | 59 |
| 61 private: | 60 private: |
| 62 friend class CustomFrameViewTest; | 61 friend class CustomFrameViewTest; |
| 63 | 62 |
| 64 // Returns the thickness of the border that makes up the window frame edges. | 63 // Returns the thickness of the border that makes up the window frame edges. |
| 65 // This does not include any client edge. | 64 // This does not include any client edge. |
| 66 int FrameBorderThickness() const; | 65 int FrameBorderThickness() const; |
| 67 | 66 |
| 68 // Returns the thickness of the entire nonclient left, right, and bottom | 67 // Returns the thickness of the entire nonclient left, right, and bottom |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // True if the frame containing this frameview is currently active. Updated in | 155 // True if the frame containing this frameview is currently active. Updated in |
| 157 // ActivationChanged(). | 156 // ActivationChanged(). |
| 158 bool active_ = false; | 157 bool active_ = false; |
| 159 | 158 |
| 160 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); | 159 DISALLOW_COPY_AND_ASSIGN(CustomFrameView); |
| 161 }; | 160 }; |
| 162 | 161 |
| 163 } // namespace views | 162 } // namespace views |
| 164 | 163 |
| 165 #endif // UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ | 164 #endif // UI_VIEWS_WINDOW_CUSTOM_FRAME_VIEW_H_ |
| OLD | NEW |