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

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

Issue 8227003: Views Bubble API adjustments and cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add close_on_esc setting and fade-in functionality. Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « views/bubble/bubble_border.cc ('k') | 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 VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 5 #ifndef VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
6 #define VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 6 #define VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string>
10
11 #include "views/bubble/bubble_border.h" 9 #include "views/bubble/bubble_border.h"
12 #include "views/view.h"
13 #include "views/widget/widget_delegate.h" 10 #include "views/widget/widget_delegate.h"
14 11
15 namespace views { 12 namespace views {
16 class BubbleBorder; 13
17 class BubbleFrameView; 14 class BubbleFrameView;
18 class BubbleView; 15 class BubbleView;
19 class View;
20 16
21 // BubbleDelegate interface to create bubble frame view and bubble client view. 17 // BubbleDelegateView creates frame and client views for bubble Widgets.
18 // BubbleDelegateView itself is the client's contents view.
22 // 19 //
23 /////////////////////////////////////////////////////////////////////////////// 20 ///////////////////////////////////////////////////////////////////////////////
24 class VIEWS_EXPORT BubbleDelegate : public WidgetDelegate { 21 class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView {
25 public: 22 public:
26 virtual BubbleDelegate* AsBubbleDelegate() OVERRIDE; 23 virtual ~BubbleDelegateView();
24
25 // Create a bubble Widget from the argument BubbleDelegateView.
26 static Widget* CreateBubble(BubbleDelegateView* bubble_delegate,
27 Widget* parent_widget);
28
29 // WidgetDelegate overrides:
30 virtual View* GetContentsView() OVERRIDE { return this; }
27 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE; 31 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE;
28 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; 32 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE;
29 33
30 virtual SkColor GetFrameBackgroundColor() = 0; 34 // Get the arrow's anchor point in screen space.
31 virtual gfx::Rect GetBounds() = 0; 35 virtual gfx::Point GetAnchorPoint() const;
32 virtual BubbleBorder::ArrowLocation GetFrameArrowLocation() = 0;
33 36
34 const BubbleView* GetBubbleView() const; 37 // Get the arrow's location on the bubble.
35 BubbleView* GetBubbleView(); 38 virtual BubbleBorder::ArrowLocation GetArrowLocation() const {
39 return BubbleBorder::TOP_LEFT;
40 }
36 41
37 const BubbleFrameView* GetBubbleFrameView() const; 42 // Get the color used for the background and border.
38 BubbleFrameView* GetBubbleFrameView(); 43 virtual SkColor GetColor() const { return SK_ColorWHITE; }
39 44
40 protected: 45 protected:
41 virtual ~BubbleDelegate() {} 46 // Perform view initialization on the contents for bubble sizing.
42 }; 47 virtual void Init() {}
43
44 // BubbleDelegateView to create bubble frame view and bubble client view.
45 //
46 ///////////////////////////////////////////////////////////////////////////////
47 class VIEWS_EXPORT BubbleDelegateView : public BubbleDelegate, public View {
48 public:
49 explicit BubbleDelegateView(Widget* frame);
50 virtual ~BubbleDelegateView();
51
52 // Overridden from WidgetDelegate:
53 virtual Widget* GetWidget() OVERRIDE;
54 virtual const Widget* GetWidget() const OVERRIDE;
55 48
56 private: 49 private:
57 Widget* frame_; 50 const BubbleView* GetBubbleView() const;
58 DISALLOW_COPY_AND_ASSIGN(BubbleDelegateView); 51 const BubbleFrameView* GetBubbleFrameView() const;
52
53 // Get bubble bounds from the anchor point and client view's preferred size.
54 gfx::Rect GetBubbleBounds();
59 }; 55 };
60 56
61 } // namespace views 57 } // namespace views
62 58
63 #endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_ 59 #endif // VIEWS_BUBBLE_BUBBLE_DELEGATE_H_
OLDNEW
« no previous file with comments | « views/bubble/bubble_border.cc ('k') | views/bubble/bubble_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698