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