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

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

Issue 10834140: aura: Fix launcher tooltips: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 4 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_BORDER_GEOMETRIC_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_GEOMETRIC_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/gfx/shadow_value.h"
11 #include "ui/views/bubble/bubble_border.h"
12
13 namespace views {
14
15 // A BubbleBorder rendered with Skia drawing commands instead of images.
16 class VIEWS_EXPORT BubbleBorderGeometric : public BubbleBorder {
sky 2012/08/03 17:59:25 Surely there be a better name than this. I would t
msw 2012/08/03 18:08:26 Hahaha, sorry Scott, I didn't think it was that ba
varunjain 2012/08/03 18:22:42 BubbleBorder2 it is!
17 public:
18 explicit BubbleBorderGeometric(ArrowLocation arrow_location);
19 virtual ~BubbleBorderGeometric();
20
21 // Given the |bubble_rect| that this border encloses, and the bounds of the
22 // anchor view |anchor_view_rect|, compute the right offset to place the
23 // arrow at shifting the |bubble_rect| to fit inside the display area if
24 // needed. Returns the shifted |bubble_rect|.
25 gfx::Rect ComputeOffsetAndUpdateBubbleRect(gfx::Rect bubble_rect,
26 const gfx::Rect& anchor_view_rect);
27
28 // Returns the path in |mask| that would be created if this border were to be
29 // applied to the rect specified by |bounds|.
30 void GetMask(const gfx::Rect& bounds, gfx::Path* mask) const;
31
32 void set_anchor_edge_offset(int anchor_edge_offset) {
33 anchor_edge_offset_ = anchor_edge_offset;
34 }
35
36 void set_offset(const gfx::Point& offset) { offset_ = offset; }
37 const gfx::Point& offset() const { return offset_; }
38
39 void set_corner_radius(int corner_radius) { corner_radius_ = corner_radius; }
40 int corner_radius() { return corner_radius_; }
sky 2012/08/03 17:59:25 const (43, 46 and 49)
varunjain 2012/08/03 18:22:42 Done.
41
42 void set_border_size(int border_size) { border_size_ = border_size; }
43 int border_size() { return border_size_; }
44
45 void set_arrow_height(int arrow_height) { arrow_height_ = arrow_height; }
46 int arrow_height() { return arrow_height_; }
47
48 void set_arrow_width(int arrow_width) { arrow_width_ = arrow_width; }
49 int arrow_width() { return arrow_width_; }
50
51 void SetShadow(gfx::ShadowValue shadow);
52
53 // views::BubbleBorder overrides:
54 int border_thickness() const OVERRIDE;
55
56 protected:
57 void PaintBackground(gfx::Canvas* canvas,
58 const gfx::Rect& bounds) const;
59
60 private:
61 // Gets arrow offset based on arrow location and |offset_|.
62 int GetArrowOffset() const;
63
64 // views::BubbleBorder overrides:
65 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE;
66 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
67 const gfx::Size& contents_size) const OVERRIDE;
68 void GetInsetsForArrowLocation(gfx::Insets* insets,
69 ArrowLocation arrow_loc) const OVERRIDE;
70
71 // views::Border overrides:
72 virtual void Paint(const View& view,
73 gfx::Canvas* canvas) const OVERRIDE;
74
75 int corner_radius_;
76 int border_size_;
77 int arrow_height_;
78 int arrow_width_;
79 SkColor background_color_;
80 SkColor border_color_;
81
82 // Distance between the tip of the arrow and the anchor view's edge.
83 int anchor_edge_offset_;
msw 2012/08/03 18:08:26 From this new value and its uses, it looks like yo
varunjain 2012/08/03 18:22:42 I think it is better to provide the BubbleDelegate
msw 2012/08/03 19:55:46 To recap offline discussion (really for posterity)
varunjain 2012/08/03 20:29:26 Done.
84
85 // Offset in pixels by which the arrow is shifted relative the default middle
86 // position. If the arrow is placed horizontally (at top or bottom), the |x_|
87 // component of |offset_| specifies the offset, else, the |y_| component.
88 gfx::Point offset_;
89
90 gfx::ShadowValues shadows_;
91
92 DISALLOW_COPY_AND_ASSIGN(BubbleBorderGeometric);
93 };
94
95 } // namespace views
96
97 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_GEOMETRIC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698