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

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

Issue 2907983002: Allow dialogs to use a custom View as their title. (Closed)
Patch Set: WIP: second iteration Created 3 years, 6 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/font_list.h"
11 #include "ui/gfx/geometry/insets.h" 12 #include "ui/gfx/geometry/insets.h"
12 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/label.h"
13 #include "ui/views/window/non_client_view.h" 15 #include "ui/views/window/non_client_view.h"
14 16
15 namespace gfx {
16 class FontList;
17 }
18
19 namespace views { 17 namespace views {
20 18
21 class Label;
22 class BubbleBorder; 19 class BubbleBorder;
23 class ImageView; 20 class ImageView;
24 21
25 // The non-client frame view of bubble-styled widgets. 22 // The non-client frame view of bubble-styled widgets.
26 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, 23 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView,
27 public ButtonListener { 24 public ButtonListener {
28 public: 25 public:
29 // Internal class name. 26 // Internal class name.
30 static const char kViewClassName[]; 27 static const char kViewClassName[];
31 28
(...skipping 13 matching lines...) Expand all
45 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; 42 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
46 void ResetWindowControls() override; 43 void ResetWindowControls() override;
47 void UpdateWindowIcon() override; 44 void UpdateWindowIcon() override;
48 void UpdateWindowTitle() override; 45 void UpdateWindowTitle() override;
49 void SizeConstraintsChanged() override; 46 void SizeConstraintsChanged() override;
50 47
51 // Set the FontList to be used for the title of the bubble. 48 // Set the FontList to be used for the title of the bubble.
52 // Caller must arrange to update the layout to have the call take effect. 49 // Caller must arrange to update the layout to have the call take effect.
53 void SetTitleFontList(const gfx::FontList& font_list); 50 void SetTitleFontList(const gfx::FontList& font_list);
54 51
52 // Sets a custom view to be the dialog title instead of the |default_title_|
53 // label. The title view is owned by this BubbleFrameView. If there is an
54 // existing title view it will be deleted.
55 void SetTitleView(View* title_view);
56
55 // View: 57 // View:
56 const char* GetClassName() const override; 58 const char* GetClassName() const override;
57 gfx::Insets GetInsets() const override; 59 gfx::Insets GetInsets() const override;
58 gfx::Size CalculatePreferredSize() const override; 60 gfx::Size CalculatePreferredSize() const override;
59 gfx::Size GetMinimumSize() const override; 61 gfx::Size GetMinimumSize() const override;
60 gfx::Size GetMaximumSize() const override; 62 gfx::Size GetMaximumSize() const override;
61 void Layout() override; 63 void Layout() override;
62 void OnPaint(gfx::Canvas* canvas) override; 64 void OnPaint(gfx::Canvas* canvas) override;
63 void PaintChildren(const ui::PaintContext& context) override; 65 void PaintChildren(const ui::PaintContext& context) override;
64 void OnThemeChanged() override; 66 void OnThemeChanged() override;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 BubbleBorder* bubble_border_; 121 BubbleBorder* bubble_border_;
120 122
121 // Margins around the title label. 123 // Margins around the title label.
122 gfx::Insets title_margins_; 124 gfx::Insets title_margins_;
123 125
124 // Margins between the content and the inside of the border, in pixels. 126 // Margins between the content and the inside of the border, in pixels.
125 gfx::Insets content_margins_; 127 gfx::Insets content_margins_;
126 128
127 // The optional title icon, title, and (x) close button. 129 // The optional title icon, title, and (x) close button.
128 views::ImageView* title_icon_; 130 views::ImageView* title_icon_;
129 Label* title_; 131 Label* default_title_;
132 View* delegate_title_;
130 Button* close_; 133 Button* close_;
131 134
135 View* title() const {
sky 2017/06/09 23:49:16 Move above functions.
Bret 2017/06/15 22:20:35 Done.
136 return delegate_title_ ? delegate_title_ : default_title_;
137 }
138
132 // A view to contain the footnote view, if it exists. 139 // A view to contain the footnote view, if it exists.
133 View* footnote_container_; 140 View* footnote_container_;
134 141
135 // Whether the close button was clicked. 142 // Whether the close button was clicked.
136 bool close_button_clicked_; 143 bool close_button_clicked_;
137 144
138 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); 145 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
139 }; 146 };
140 147
141 } // namespace views 148 } // namespace views
142 149
143 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ 150 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698