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/button.h" | 12 #include "ui/views/controls/button/button.h" |
13 #include "ui/views/controls/button/image_button.h" | |
msw
2016/07/21 19:07:17
optional nit: forward declare here; include header
| |
13 #include "ui/views/window/non_client_view.h" | 14 #include "ui/views/window/non_client_view.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class FontList; | 17 class FontList; |
17 } | 18 } |
18 | 19 |
19 namespace views { | 20 namespace views { |
20 | 21 |
21 class Label; | 22 class Label; |
22 class LabelButton; | 23 class LabelButton; |
msw
2016/07/21 19:07:17
nit: remove
| |
23 class BubbleBorder; | 24 class BubbleBorder; |
24 class ImageView; | 25 class ImageView; |
25 | 26 |
26 // The non-client frame view of bubble-styled widgets. | 27 // The non-client frame view of bubble-styled widgets. |
27 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, | 28 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView, |
28 public ButtonListener { | 29 public ButtonListener { |
29 public: | 30 public: |
30 // Internal class name. | 31 // Internal class name. |
31 static const char kViewClassName[]; | 32 static const char kViewClassName[]; |
32 | 33 |
33 BubbleFrameView(const gfx::Insets& title_margins, | 34 BubbleFrameView(const gfx::Insets& title_margins, |
34 const gfx::Insets& content_margins); | 35 const gfx::Insets& content_margins); |
35 ~BubbleFrameView() override; | 36 ~BubbleFrameView() override; |
36 | 37 |
37 // Creates a close button used in the corner of the dialog. | 38 // Creates a close button used in the corner of the dialog. |
38 static LabelButton* CreateCloseButton(ButtonListener* listener); | 39 static ImageButton* CreateCloseButton(ButtonListener* listener); |
39 | 40 |
40 // NonClientFrameView overrides: | 41 // NonClientFrameView overrides: |
41 gfx::Rect GetBoundsForClientView() const override; | 42 gfx::Rect GetBoundsForClientView() const override; |
42 gfx::Rect GetWindowBoundsForClientBounds( | 43 gfx::Rect GetWindowBoundsForClientBounds( |
43 const gfx::Rect& client_bounds) const override; | 44 const gfx::Rect& client_bounds) const override; |
44 bool GetClientMask(const gfx::Size& size, gfx::Path* path) const override; | 45 bool GetClientMask(const gfx::Size& size, gfx::Path* path) const override; |
45 int NonClientHitTest(const gfx::Point& point) override; | 46 int NonClientHitTest(const gfx::Point& point) override; |
46 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | 47 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; |
47 void ResetWindowControls() override; | 48 void ResetWindowControls() override; |
48 void UpdateWindowIcon() override; | 49 void UpdateWindowIcon() override; |
(...skipping 29 matching lines...) Expand all Loading... | |
78 | 79 |
79 // Given the size of the contents and the rect to point at, returns the bounds | 80 // 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 | 81 // 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. | 82 // does not fit on the monitor and |adjust_if_offscreen| is true. |
82 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, | 83 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, |
83 gfx::Size client_size, | 84 gfx::Size client_size, |
84 bool adjust_if_offscreen); | 85 bool adjust_if_offscreen); |
85 | 86 |
86 bool close_button_clicked() const { return close_button_clicked_; } | 87 bool close_button_clicked() const { return close_button_clicked_; } |
87 | 88 |
88 LabelButton* GetCloseButtonForTest() { return close_; } | 89 ImageButton* GetCloseButtonForTest() { return close_; } |
89 | 90 |
90 protected: | 91 protected: |
91 // Returns the available screen bounds if the frame were to show in |rect|. | 92 // Returns the available screen bounds if the frame were to show in |rect|. |
92 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; | 93 virtual gfx::Rect GetAvailableScreenBounds(const gfx::Rect& rect) const; |
93 | 94 |
94 bool IsCloseButtonVisible() const; | 95 bool IsCloseButtonVisible() const; |
95 gfx::Rect GetCloseButtonMirroredBounds() const; | 96 gfx::Rect GetCloseButtonMirroredBounds() const; |
96 | 97 |
97 private: | 98 private: |
98 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); | 99 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, GetBoundsForClientView); |
(...skipping 19 matching lines...) Expand all Loading... | |
118 | 119 |
119 // Margins around the title label. | 120 // Margins around the title label. |
120 gfx::Insets title_margins_; | 121 gfx::Insets title_margins_; |
121 | 122 |
122 // Margins between the content and the inside of the border, in pixels. | 123 // Margins between the content and the inside of the border, in pixels. |
123 gfx::Insets content_margins_; | 124 gfx::Insets content_margins_; |
124 | 125 |
125 // The optional title icon, title, and (x) close button. | 126 // The optional title icon, title, and (x) close button. |
126 views::ImageView* title_icon_; | 127 views::ImageView* title_icon_; |
127 Label* title_; | 128 Label* title_; |
128 LabelButton* close_; | 129 ImageButton* close_; |
129 | 130 |
130 // A view to contain the footnote view, if it exists. | 131 // A view to contain the footnote view, if it exists. |
131 View* footnote_container_; | 132 View* footnote_container_; |
132 | 133 |
133 // Whether the close button was clicked. | 134 // Whether the close button was clicked. |
134 bool close_button_clicked_; | 135 bool close_button_clicked_; |
135 | 136 |
136 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); | 137 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); |
137 }; | 138 }; |
138 | 139 |
139 } // namespace views | 140 } // namespace views |
140 | 141 |
141 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ | 142 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ |
OLD | NEW |