| 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_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
| 6 #define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/gfx/geometry/insets.h" | 11 #include "ui/gfx/geometry/insets.h" |
| 12 #include "ui/views/controls/button/vector_icon_button_delegate.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/window/non_client_view.h" | 13 #include "ui/views/window/non_client_view.h" |
| 14 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class FontList; | 16 class FontList; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 | 20 |
| 21 class Label; | 21 class Label; |
| 22 class Button; | |
| 23 class BubbleBorder; | 22 class BubbleBorder; |
| 24 class ImageView; | 23 class ImageView; |
| 25 | 24 |
| 26 // The non-client frame view of bubble-styled widgets. | 25 // The non-client frame view of bubble-styled widgets. |
| 27 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, | 26 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
| 28 public VectorIconButtonDelegate { | 27 public ButtonListener { |
| 29 public: | 28 public: |
| 30 // Internal class name. | 29 // Internal class name. |
| 31 static const char kViewClassName[]; | 30 static const char kViewClassName[]; |
| 32 | 31 |
| 33 BubbleFrameView(const gfx::Insets& title_margins, | 32 BubbleFrameView(const gfx::Insets& title_margins, |
| 34 const gfx::Insets& content_margins); | 33 const gfx::Insets& content_margins); |
| 35 ~BubbleFrameView() override; | 34 ~BubbleFrameView() override; |
| 36 | 35 |
| 37 // Creates a close button used in the corner of the dialog. | 36 // Creates a close button used in the corner of the dialog. |
| 38 static Button* CreateCloseButton(VectorIconButtonDelegate* delegate); | 37 static Button* CreateCloseButton(ButtonListener* listener); |
| 39 | 38 |
| 40 // NonClientFrameView overrides: | 39 // NonClientFrameView: |
| 41 gfx::Rect GetBoundsForClientView() const override; | 40 gfx::Rect GetBoundsForClientView() const override; |
| 42 gfx::Rect GetWindowBoundsForClientBounds( | 41 gfx::Rect GetWindowBoundsForClientBounds( |
| 43 const gfx::Rect& client_bounds) const override; | 42 const gfx::Rect& client_bounds) const override; |
| 44 bool GetClientMask(const gfx::Size& size, gfx::Path* path) const override; | 43 bool GetClientMask(const gfx::Size& size, gfx::Path* path) const override; |
| 45 int NonClientHitTest(const gfx::Point& point) override; | 44 int NonClientHitTest(const gfx::Point& point) override; |
| 46 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | 45 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; |
| 47 void ResetWindowControls() override; | 46 void ResetWindowControls() override; |
| 48 void UpdateWindowIcon() override; | 47 void UpdateWindowIcon() override; |
| 49 void UpdateWindowTitle() override; | 48 void UpdateWindowTitle() override; |
| 50 void SizeConstraintsChanged() override; | 49 void SizeConstraintsChanged() override; |
| 51 | 50 |
| 52 // Set the FontList to be used for the title of the bubble. | 51 // Set the FontList to be used for the title of the bubble. |
| 53 // Caller must arrange to update the layout to have the call take effect. | 52 // Caller must arrange to update the layout to have the call take effect. |
| 54 void SetTitleFontList(const gfx::FontList& font_list); | 53 void SetTitleFontList(const gfx::FontList& font_list); |
| 55 | 54 |
| 56 // View overrides: | 55 // View: |
| 57 const char* GetClassName() const override; | 56 const char* GetClassName() const override; |
| 58 gfx::Insets GetInsets() const override; | 57 gfx::Insets GetInsets() const override; |
| 59 gfx::Size GetPreferredSize() const override; | 58 gfx::Size GetPreferredSize() const override; |
| 60 gfx::Size GetMinimumSize() const override; | 59 gfx::Size GetMinimumSize() const override; |
| 61 gfx::Size GetMaximumSize() const override; | 60 gfx::Size GetMaximumSize() const override; |
| 62 void Layout() override; | 61 void Layout() override; |
| 63 void OnPaint(gfx::Canvas* canvas) override; | 62 void OnPaint(gfx::Canvas* canvas) override; |
| 64 void PaintChildren(const ui::PaintContext& context) override; | 63 void PaintChildren(const ui::PaintContext& context) override; |
| 65 void OnThemeChanged() override; | 64 void OnThemeChanged() override; |
| 66 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 65 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 67 | 66 |
| 68 // Overridden from VectorIconButtonDelegate: | 67 // ButtonListener: |
| 69 void ButtonPressed(Button* sender, const ui::Event& event) override; | 68 void ButtonPressed(Button* sender, const ui::Event& event) override; |
| 70 | 69 |
| 71 // Use bubble_border() and SetBubbleBorder(), not border() and SetBorder(). | 70 // Use bubble_border() and SetBubbleBorder(), not border() and SetBorder(). |
| 72 BubbleBorder* bubble_border() const { return bubble_border_; } | 71 BubbleBorder* bubble_border() const { return bubble_border_; } |
| 73 void SetBubbleBorder(std::unique_ptr<BubbleBorder> border); | 72 void SetBubbleBorder(std::unique_ptr<BubbleBorder> border); |
| 74 | 73 |
| 75 gfx::Insets content_margins() const { return content_margins_; } | 74 gfx::Insets content_margins() const { return content_margins_; } |
| 76 | 75 |
| 77 void SetFootnoteView(View* view); | 76 void SetFootnoteView(View* view); |
| 78 | 77 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 131 |
| 133 // Whether the close button was clicked. | 132 // Whether the close button was clicked. |
| 134 bool close_button_clicked_; | 133 bool close_button_clicked_; |
| 135 | 134 |
| 136 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 135 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 } // namespace views | 138 } // namespace views |
| 140 | 139 |
| 141 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 140 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
| OLD | NEW |