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

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

Issue 10834140: aura: Fix launcher tooltips: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor change in tooltip text color 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
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | ui/views/bubble/bubble_border_2.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_2_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_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 BubbleBorder2 : public BubbleBorder {
17 public:
18 explicit BubbleBorder2(ArrowLocation arrow_location);
19 virtual ~BubbleBorder2();
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_offset(const gfx::Point& offset) { offset_ = offset; }
33 const gfx::Point& offset() const { return offset_; }
34
35 void set_corner_radius(int corner_radius) { corner_radius_ = corner_radius; }
36 int corner_radius() const { return corner_radius_; }
37
38 void set_border_size(int border_size) { border_size_ = border_size; }
39 int border_size() const { return border_size_; }
40
41 void set_arrow_height(int arrow_height) { arrow_height_ = arrow_height; }
42 int arrow_height() const { return arrow_height_; }
43
44 void set_arrow_width(int arrow_width) { arrow_width_ = arrow_width; }
45 int arrow_width() const { return arrow_width_; }
46
47 void SetShadow(gfx::ShadowValue shadow);
48
49 // views::BubbleBorder overrides:
50 int GetBorderThickness() const OVERRIDE;
51
52 protected:
53 void PaintBackground(gfx::Canvas* canvas,
54 const gfx::Rect& bounds) const;
55
56 private:
57 // Gets arrow offset based on arrow location and |offset_|.
58 int GetArrowOffset() const;
59
60 // views::BubbleBorder overrides:
61 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE;
62 virtual gfx::Rect GetBounds(const gfx::Rect& position_relative_to,
63 const gfx::Size& contents_size) const OVERRIDE;
64 void GetInsetsForArrowLocation(gfx::Insets* insets,
65 ArrowLocation arrow_loc) const OVERRIDE;
66
67 // views::Border overrides:
68 virtual void Paint(const View& view,
69 gfx::Canvas* canvas) const OVERRIDE;
70
71 int corner_radius_;
72 int border_size_;
73 int arrow_height_;
74 int arrow_width_;
75 SkColor background_color_;
76 SkColor border_color_;
77
78 // Offset in pixels by which the arrow is shifted relative the default middle
79 // position. If the arrow is placed horizontally (at top or bottom), the |x_|
80 // component of |offset_| specifies the offset, else, the |y_| component.
81 gfx::Point offset_;
82
83 gfx::ShadowValues shadows_;
84
85 DISALLOW_COPY_AND_ASSIGN(BubbleBorder2);
86 };
87
88 } // namespace views
89
90 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_2_H_
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_border.cc ('k') | ui/views/bubble/bubble_border_2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698