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

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

Issue 8833004: Remove BubbleDelegateView ctor color arg, add simple setter/getter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass set_color SkColor arg by value. 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/aura_shell/examples/bubble.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 10 matching lines...) Expand all
21 class BubbleFrameView; 21 class BubbleFrameView;
22 22
23 // BubbleDelegateView creates frame and client views for bubble Widgets. 23 // BubbleDelegateView creates frame and client views for bubble Widgets.
24 // BubbleDelegateView itself is the client's contents view. 24 // BubbleDelegateView itself is the client's contents view.
25 // 25 //
26 /////////////////////////////////////////////////////////////////////////////// 26 ///////////////////////////////////////////////////////////////////////////////
27 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, 27 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView,
28 public ui::AnimationDelegate, 28 public ui::AnimationDelegate,
29 public Widget::Observer { 29 public Widget::Observer {
30 public: 30 public:
31 // The default bubble background color.
32 static const SkColor kBackgroundColor;
33
31 BubbleDelegateView(); 34 BubbleDelegateView();
32 BubbleDelegateView(View* anchor_view, 35 BubbleDelegateView(View* anchor_view,
33 BubbleBorder::ArrowLocation arrow_location, 36 BubbleBorder::ArrowLocation arrow_location);
34 const SkColor& color);
35 virtual ~BubbleDelegateView(); 37 virtual ~BubbleDelegateView();
36 38
37 // Create and initialize the bubble Widget(s) with proper bounds. 39 // Create and initialize the bubble Widget(s) with proper bounds.
38 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate); 40 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate);
39 41
40 // WidgetDelegate overrides: 42 // WidgetDelegate overrides:
41 virtual View* GetInitiallyFocusedView() OVERRIDE; 43 virtual View* GetInitiallyFocusedView() OVERRIDE;
42 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE; 44 virtual BubbleDelegateView* AsBubbleDelegate() OVERRIDE;
43 virtual View* GetContentsView() OVERRIDE; 45 virtual View* GetContentsView() OVERRIDE;
44 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; 46 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
(...skipping 10 matching lines...) Expand all
55 } 57 }
56 58
57 bool allow_bubble_offscreen() const { return allow_bubble_offscreen_; } 59 bool allow_bubble_offscreen() const { return allow_bubble_offscreen_; }
58 void set_allow_bubble_offscreen(bool allow_bubble_offscreen) { 60 void set_allow_bubble_offscreen(bool allow_bubble_offscreen) {
59 allow_bubble_offscreen_ = allow_bubble_offscreen; 61 allow_bubble_offscreen_ = allow_bubble_offscreen;
60 } 62 }
61 63
62 View* anchor_view() const { return anchor_view_; } 64 View* anchor_view() const { return anchor_view_; }
63 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; } 65 void set_anchor_view(View* anchor_view) { anchor_view_ = anchor_view; }
64 66
67 SkColor color() const { return color_; }
68 void set_color(SkColor color) { color_ = color; }
69
65 bool use_focusless() const { return use_focusless_; } 70 bool use_focusless() const { return use_focusless_; }
66 void set_use_focusless(bool use_focusless) { 71 void set_use_focusless(bool use_focusless) {
67 use_focusless_ = use_focusless; 72 use_focusless_ = use_focusless;
68 } 73 }
69 74
70 // Get the arrow's anchor point in screen space. 75 // Get the arrow's anchor point in screen space.
71 virtual gfx::Point GetAnchorPoint(); 76 virtual gfx::Point GetAnchorPoint();
72 77
73 // Get the arrow's location on the bubble. 78 // Get the arrow's location on the bubble.
74 virtual BubbleBorder::ArrowLocation GetArrowLocation() const; 79 virtual BubbleBorder::ArrowLocation GetArrowLocation() const;
75 80
76 // Get the color used for the background and border.
77 virtual SkColor GetColor() const;
78
79 // Show the bubble's widget (and |border_widget_| on Windows). 81 // Show the bubble's widget (and |border_widget_| on Windows).
80 void Show(); 82 void Show();
81 83
82 // Fade the bubble in or out via Widget transparency. 84 // Fade the bubble in or out via Widget transparency.
83 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion. 85 // Fade in calls Widget::Show; fade out calls Widget::Close upon completion.
84 void StartFade(bool fade_in); 86 void StartFade(bool fade_in);
85 87
86 // Reset fade and opacity of bubble. Restore the opacity of the 88 // Reset fade and opacity of bubble. Restore the opacity of the
87 // bubble to the setting before StartFade() was called. 89 // bubble to the setting before StartFade() was called.
88 void ResetFade(); 90 void ResetFade();
89 91
90 // The default bubble background color.
91 static const SkColor kBackgroundColor;
92
93 protected: 92 protected:
94 // View overrides: 93 // View overrides:
95 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 94 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
96 95
97 // ui::AnimationDelegate overrides: 96 // ui::AnimationDelegate overrides:
98 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; 97 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE;
99 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 98 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
100 99
101 // Perform view initialization on the contents for bubble sizing. 100 // Perform view initialization on the contents for bubble sizing.
102 virtual void Init(); 101 virtual void Init();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Create a popup window for focusless bubbles on Linux/ChromeOS. 147 // Create a popup window for focusless bubbles on Linux/ChromeOS.
149 // These bubbles are not interactive and should not gain focus. 148 // These bubbles are not interactive and should not gain focus.
150 bool use_focusless_; 149 bool use_focusless_;
151 150
152 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); 151 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView);
153 }; 152 };
154 153
155 } // namespace views 154 } // namespace views
156 155
157 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 156 #endif // UI_VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW
« no previous file with comments | « ui/aura_shell/examples/bubble.cc ('k') | ui/views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698