Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: ui/views/bubble/bubble_frame_view.h

Issue 2305933002: Update dialog close buttons to use vector icons and ripples. (Closed)
Patch Set: always good to compile Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/button.h" 12 #include "ui/views/controls/button/vector_icon_button_delegate.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 LabelButton; 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 ButtonListener { 28 public VectorIconButtonDelegate {
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 LabelButton* CreateCloseButton(ButtonListener* listener); 38 static Button* CreateCloseButton(VectorIconButtonDelegate* delegate);
39 39
40 // NonClientFrameView overrides: 40 // NonClientFrameView overrides:
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 overrides:
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 ButtonListener: 68 // Overridden from VectorIconButtonDelegate:
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
79 // Given the size of the contents and the rect to point at, returns the bounds 79 // Given the size of the contents and the rect to point at, returns the bounds
80 // of the bubble window. The bubble's arrow location may change if the bubble 80 // of the bubble window. The bubble's arrow location may change if the bubble
81 // does not fit on the monitor and |adjust_if_offscreen| is true. 81 // does not fit on the monitor and |adjust_if_offscreen| is true.
82 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, 82 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
83 gfx::Size client_size, 83 gfx::Size client_size,
84 bool adjust_if_offscreen); 84 bool adjust_if_offscreen);
85 85
86 bool close_button_clicked() const { return close_button_clicked_; } 86 bool close_button_clicked() const { return close_button_clicked_; }
87 87
88 LabelButton* GetCloseButtonForTest() { return close_; } 88 Button* GetCloseButtonForTest() { return close_; }
89 89
90 protected: 90 protected:
91 // Returns the available screen bounds if the frame were to show in |rect|. 91 // Returns the available screen bounds if the frame were to show in |rect|.
92 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; 92 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const;
93 93
94 bool IsCloseButtonVisible() const; 94 bool IsCloseButtonVisible() const;
95 gfx::Rect GetCloseButtonMirroredBounds() const; 95 gfx::Rect GetCloseButtonMirroredBounds() const;
96 96
97 private: 97 private:
98 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); 98 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView);
(...skipping 19 matching lines...) Expand all
118 118
119 // Margins around the title label. 119 // Margins around the title label.
120 gfx::Insets title_margins_; 120 gfx::Insets title_margins_;
121 121
122 // Margins between the content and the inside of the border, in pixels. 122 // Margins between the content and the inside of the border, in pixels.
123 gfx::Insets content_margins_; 123 gfx::Insets content_margins_;
124 124
125 // The optional title icon, title, and (x) close button. 125 // The optional title icon, title, and (x) close button.
126 views::ImageView* title_icon_; 126 views::ImageView* title_icon_;
127 Label* title_; 127 Label* title_;
128 LabelButton* close_; 128 Button* close_;
129 129
130 // A view to contain the footnote view, if it exists. 130 // A view to contain the footnote view, if it exists.
131 View* footnote_container_; 131 View* footnote_container_;
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_
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_dialog_delegate_unittest.cc ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698