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

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

Issue 8870003: Merge BorderContentsView into BubbleFrameView; simplify. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_DELEGATE_H_ 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 6 #define UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "ui/base/animation/animation_delegate.h" 10 #include "ui/base/animation/animation_delegate.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; 49 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE;
50 50
51 bool close_on_esc() const { return close_on_esc_; } 51 bool close_on_esc() const { return close_on_esc_; }
52 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; } 52 void set_close_on_esc(bool close_on_esc) { close_on_esc_ = close_on_esc; }
53 53
54 bool close_on_deactivate() const { return close_on_deactivate_; } 54 bool close_on_deactivate() const { return close_on_deactivate_; }
55 void set_close_on_deactivate(bool close_on_deactivate) { 55 void set_close_on_deactivate(bool close_on_deactivate) {
56 close_on_deactivate_ = close_on_deactivate; 56 close_on_deactivate_ = close_on_deactivate;
57 } 57 }
58 58
59 bool allow_bubble_offscreen() const { return allow_bubble_offscreen_; }
60 void set_allow_bubble_offscreen(bool allow_bubble_offscreen) {
61 allow_bubble_offscreen_ = allow_bubble_offscreen;
62 }
63
64 View* anchor_view() const { return anchor_view_; } 59 View* anchor_view() const { return anchor_view_; }
65 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } 60 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; }
66 61
62 BubbleBorder::ArrowLocation arrow_location() const { return arrow_location_; }
63 void set_arrow_location(BubbleBorder::ArrowLocation arrow_location) {
64 arrow_location_ = arrow_location;
65 }
66
67 SkColor color() const { return color_; } 67 SkColor color() const { return color_; }
68 void set_color(SkColor color) { color_ = color; } 68 void set_color(SkColor color) { color_ = color; }
69 69
70 bool use_focusless() const { return use_focusless_; } 70 bool use_focusless() const { return use_focusless_; }
71 void set_use_focusless(bool use_focusless) { 71 void set_use_focusless(bool use_focusless) {
72 use_focusless_ = use_focusless; 72 use_focusless_ = use_focusless;
73 } 73 }
74 74
75 // Get the arrow's anchor rect in screen space. 75 // Get the arrow's anchor rect in screen space.
76 virtual gfx::Rect GetAnchorRect(); 76 virtual gfx::Rect GetAnchorRect();
77 77
78 // Get the arrow's location on the bubble.
79 virtual BubbleBorder::ArrowLocation GetArrowLocation() const;
80
81 // Show the bubble's widget (and |border_widget_| on Windows). 78 // Show the bubble's widget (and |border_widget_| on Windows).
82 void Show(); 79 void Show();
83 80
84 // Fade the bubble in or out via Widget transparency. 81 // Fade the bubble in or out via Widget transparency.
85 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. 82 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion.
86 void StartFade(bool fade_in); 83 void StartFade(bool fade_in);
87 84
88 // Reset fade and opacity of bubble. Restore the opacity of the 85 // Reset fade and opacity of bubble. Restore the opacity of the
89 // bubble to the setting before StartFade() was called. 86 // bubble to the setting before StartFade() was called.
90 void ResetFade(); 87 void ResetFade();
(...skipping 12 matching lines...) Expand all
103 // Perform view initialization on the contents for bubble sizing. 100 // Perform view initialization on the contents for bubble sizing.
104 virtual void Init(); 101 virtual void Init();
105 102
106 // Resizes and potentially moves the Bubble to best accommodate the 103 // Resizes and potentially moves the Bubble to best accommodate the
107 // contents preferred size. 104 // contents preferred size.
108 void SizeToContents(); 105 void SizeToContents();
109 106
110 BubbleFrameView* GetBubbleFrameView() const; 107 BubbleFrameView* GetBubbleFrameView() const;
111 108
112 private: 109 private:
113 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewBasicTest, NonClientHitTest); 110 FRIEND_TEST_ALL_PREFIXES(BubbleFrameViewTest, NonClientHitTest);
114 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate); 111 FRIEND_TEST_ALL_PREFIXES(BubbleDelegateTest, CreateDelegate);
115 112
116 // Get bubble bounds from the anchor point and client view's preferred size. 113 // Get bubble bounds from the anchor point and client view's preferred size.
117 gfx::Rect GetBubbleBounds(); 114 gfx::Rect GetBubbleBounds();
118 115
119 #if defined(OS_WIN) && !defined(USE_AURA) 116 #if defined(OS_WIN) && !defined(USE_AURA)
120 // Get bounds for the Windows-only widget that hosts the bubble's contents. 117 // Get bounds for the Windows-only widget that hosts the bubble's contents.
121 gfx::Rect GetBubbleClientBounds() const; 118 gfx::Rect GetBubbleClientBounds() const;
122 #endif 119 #endif
123 120
124 // Fade animation for bubble. 121 // Fade animation for bubble.
125 scoped_ptr<ui::SlideAnimation> fade_animation_; 122 scoped_ptr<ui::SlideAnimation> fade_animation_;
126 123
127 // Flags controlling bubble closure on the escape key and deactivation. 124 // Flags controlling bubble closure on the escape key and deactivation.
128 bool close_on_esc_; 125 bool close_on_esc_;
129 bool close_on_deactivate_; 126 bool close_on_deactivate_;
130 127
131 // Whether the bubble is allowed to be displayed offscreen, or if auto
132 // re-positioning should be performed.
133 bool allow_bubble_offscreen_;
134
135 // The view hosting this bubble; the arrow is anchored to this view. 128 // The view hosting this bubble; the arrow is anchored to this view.
136 View* anchor_view_; 129 View* anchor_view_;
137 130
138 // The arrow's location on the bubble. 131 // The arrow's location on the bubble.
139 BubbleBorder::ArrowLocation arrow_location_; 132 BubbleBorder::ArrowLocation arrow_location_;
140 133
141 // The background color of the bubble. 134 // The background color of the bubble.
142 SkColor color_; 135 SkColor color_;
143 136
144 // Original opacity of the bubble. 137 // Original opacity of the bubble.
145 int original_opacity_; 138 int original_opacity_;
146 139
147 // The widget hosting the border for this bubble (non-Aura Windows only). 140 // The widget hosting the border for this bubble (non-Aura Windows only).
148 Widget* border_widget_; 141 Widget* border_widget_;
149 142
150 // Create a popup window for focusless bubbles on Linux/ChromeOS. 143 // Create a popup window for focusless bubbles on Linux/ChromeOS.
151 // These bubbles are not interactive and should not gain focus. 144 // These bubbles are not interactive and should not gain focus.
152 bool use_focusless_; 145 bool use_focusless_;
153 146
154 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); 147 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
155 }; 148 };
156 149
157 } // namespace views 150 } // namespace views
158 151
159 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 152 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698