blob: 2febe832a590cbe29fceaadfbb3c695beb4a4818 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
#ifndef CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
#define CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
#include "third_party/skia/include/core/SkColor.h"
#include "views/border.h"
class SkBitmap;
// Renders a round-rect border and a custom dropshadow. This can be used to
// produce floating "bubble" objects.
class BubbleBorder : public views::Border {
public:
BubbleBorder() {
InitClass();
}
// Returns the radius of the corner of the border.
static int GetCornerRadius() {
// We can't safely calculate a border radius by comparing the sizes of the
// side and corner images, because either may have been extended in various
// directions in order to do more subtle dropshadow fading or other effects.
// So we hardcode the most accurate value.
return 4;
}
// Overridden from views::Border:
virtual void GetInsets(gfx::Insets* insets) const;
private:
// Loads images if necessary.
static void InitClass();
virtual ~BubbleBorder() { }
// Overridden from views::Border:
virtual void Paint(const views::View& view, gfx::Canvas* canvas) const;
// Border graphics.
static SkBitmap* left_;
static SkBitmap* top_left_;
static SkBitmap* top_;
static SkBitmap* top_right_;
static SkBitmap* right_;
static SkBitmap* bottom_right_;
static SkBitmap* bottom_;
static SkBitmap* bottom_left_;
DISALLOW_COPY_AND_ASSIGN(BubbleBorder);
};
#endif // #ifndef CHROME_BROWSER_VIEWS_BUBBLE_BORDER_H_
|