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

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

Issue 8588064: views: Move bubble, events, focus and layout to ui/views/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/layout/layout_manager.cc ('k') | views/bubble/border_contents_view.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_BORDER_CONTENTS_VIEW_H_ 5 #ifndef VIEWS_BUBBLE_BORDER_CONTENTS_VIEW_H_
6 #define VIEWS_BUBBLE_BORDER_CONTENTS_VIEW_H_ 6 #define VIEWS_BUBBLE_BORDER_CONTENTS_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "views/bubble/bubble_border.h" 9 #include "ui/views/bubble/border_contents_view.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 // TODO(tfarina): remove this file once all includes have been updated.
11 #include "views/view.h"
12
13 namespace views {
14
15 // This is used to paint the border and background of the Bubble.
16 class VIEWS_EXPORT BorderContentsView : public View {
17 public:
18 BorderContentsView();
19 BorderContentsView(int top_margin,
20 int left_margin,
21 int bottom_margin,
22 int right_margin);
23
24 // Must be called before this object can be used.
25 void Init();
26
27 // Sets the background color.
28 void SetBackgroundColor(SkColor color);
29
30 // Sets the bubble alignment.
31 void SetAlignment(views::BubbleBorder::BubbleAlignment alignment);
32
33 // Given the size of the contents and the rect to point at, returns the bounds
34 // of both the border and the contents inside the bubble.
35 // |arrow_location| specifies the preferred location for the arrow
36 // anchor. If the bubble does not fit on the monitor and
37 // |allow_bubble_offscreen| is false, the arrow location may change so the
38 // bubble shows entirely.
39 virtual void SizeAndGetBounds(
40 const gfx::Rect& position_relative_to, // In screen coordinates
41 BubbleBorder::ArrowLocation arrow_location,
42 bool allow_bubble_offscreen,
43 const gfx::Size& contents_size,
44 gfx::Rect* contents_bounds, // Returned in window coordinates
45 gfx::Rect* window_bounds); // Returned in screen coordinates
46
47 // Sets content margins.
48 void set_content_margins(const gfx::Insets& margins) {
49 content_margins_ = margins;
50 }
51
52 // Accessor for |content_margins_|.
53 const gfx::Insets& content_margins() const {
54 return content_margins_;
55 }
56
57 protected:
58 virtual ~BorderContentsView();
59
60 // Returns the bounds for the monitor showing the specified |rect|.
61 virtual gfx::Rect GetMonitorBounds(const gfx::Rect& rect);
62
63 BubbleBorder* bubble_border() const { return bubble_border_; }
64
65 private:
66 // Changes |arrow_location| to its mirrored version, vertically if |vertical|
67 // is true, horizontally otherwise, if |window_bounds| don't fit in
68 // |monitor_bounds|.
69 void MirrorArrowIfOffScreen(
70 bool vertical,
71 const gfx::Rect& position_relative_to,
72 const gfx::Rect& monitor_bounds,
73 const gfx::Size& local_contents_size,
74 BubbleBorder::ArrowLocation* arrow_location,
75 gfx::Rect* window_bounds);
76
77 // The bubble border.
78 BubbleBorder* bubble_border_;
79
80 // Margins between the content and the inside of the border, in pixels.
81 gfx::Insets content_margins_;
82
83 DISALLOW_COPY_AND_ASSIGN(BorderContentsView);
84 };
85
86 } // namespace views
87 11
88 #endif // VIEWS_BUBBLE_BORDER_CONTENTS_VIEW_H_ 12 #endif // VIEWS_BUBBLE_BORDER_CONTENTS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/layout/layout_manager.cc ('k') | views/bubble/border_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698