OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "ui/views/examples/bubble_example.h" | 5 #include "ui/views/examples/bubble_example.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "ui/views/bubble/bubble_delegate.h" | 8 #include "ui/views/bubble/bubble_delegate.h" |
9 #include "ui/views/controls/button/label_button.h" | 9 #include "ui/views/controls/button/label_button.h" |
10 #include "ui/views/controls/label.h" | 10 #include "ui/views/controls/label.h" |
11 #include "ui/views/layout/box_layout.h" | 11 #include "ui/views/layout/box_layout.h" |
12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 namespace examples { | 15 namespace examples { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 SkColor colors[] = { SK_ColorWHITE, SK_ColorGRAY, SK_ColorCYAN, 0xFFC1B1E1 }; | 19 SkColor colors[] = { SK_ColorWHITE, SK_ColorGRAY, SK_ColorCYAN, 0xFFC1B1E1 }; |
20 | 20 |
21 BubbleBorder::Arrow arrows[] = { | 21 BubbleBorder::Arrow arrows[] = { |
22 BubbleBorder::TOP_LEFT, BubbleBorder::TOP_CENTER, | 22 BubbleBorder::TOP_LEFT, BubbleBorder::TOP_CENTER, |
23 BubbleBorder::TOP_RIGHT, BubbleBorder::RIGHT_TOP, | 23 BubbleBorder::TOP_RIGHT, BubbleBorder::RIGHT_TOP, |
24 BubbleBorder::RIGHT_CENTER, BubbleBorder::RIGHT_BOTTOM, | 24 BubbleBorder::RIGHT_CENTER, BubbleBorder::RIGHT_BOTTOM, |
25 BubbleBorder::BOTTOM_RIGHT, BubbleBorder::BOTTOM_CENTER, | 25 BubbleBorder::BOTTOM_RIGHT, BubbleBorder::BOTTOM_CENTER, |
26 BubbleBorder::BOTTOM_LEFT, BubbleBorder::LEFT_BOTTOM, | 26 BubbleBorder::BOTTOM_LEFT, BubbleBorder::LEFT_BOTTOM, |
27 BubbleBorder::LEFT_CENTER, BubbleBorder::LEFT_TOP }; | 27 BubbleBorder::LEFT_CENTER, BubbleBorder::LEFT_TOP }; |
28 | 28 |
29 string16 GetArrowName(BubbleBorder::Arrow arrow) { | 29 base::string16 GetArrowName(BubbleBorder::Arrow arrow) { |
30 switch (arrow) { | 30 switch (arrow) { |
31 case BubbleBorder::TOP_LEFT: return ASCIIToUTF16("TOP_LEFT"); | 31 case BubbleBorder::TOP_LEFT: return ASCIIToUTF16("TOP_LEFT"); |
32 case BubbleBorder::TOP_RIGHT: return ASCIIToUTF16("TOP_RIGHT"); | 32 case BubbleBorder::TOP_RIGHT: return ASCIIToUTF16("TOP_RIGHT"); |
33 case BubbleBorder::BOTTOM_LEFT: return ASCIIToUTF16("BOTTOM_LEFT"); | 33 case BubbleBorder::BOTTOM_LEFT: return ASCIIToUTF16("BOTTOM_LEFT"); |
34 case BubbleBorder::BOTTOM_RIGHT: return ASCIIToUTF16("BOTTOM_RIGHT"); | 34 case BubbleBorder::BOTTOM_RIGHT: return ASCIIToUTF16("BOTTOM_RIGHT"); |
35 case BubbleBorder::LEFT_TOP: return ASCIIToUTF16("LEFT_TOP"); | 35 case BubbleBorder::LEFT_TOP: return ASCIIToUTF16("LEFT_TOP"); |
36 case BubbleBorder::RIGHT_TOP: return ASCIIToUTF16("RIGHT_TOP"); | 36 case BubbleBorder::RIGHT_TOP: return ASCIIToUTF16("RIGHT_TOP"); |
37 case BubbleBorder::LEFT_BOTTOM: return ASCIIToUTF16("LEFT_BOTTOM"); | 37 case BubbleBorder::LEFT_BOTTOM: return ASCIIToUTF16("LEFT_BOTTOM"); |
38 case BubbleBorder::RIGHT_BOTTOM: return ASCIIToUTF16("RIGHT_BOTTOM"); | 38 case BubbleBorder::RIGHT_BOTTOM: return ASCIIToUTF16("RIGHT_BOTTOM"); |
39 case BubbleBorder::TOP_CENTER: return ASCIIToUTF16("TOP_CENTER"); | 39 case BubbleBorder::TOP_CENTER: return ASCIIToUTF16("TOP_CENTER"); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bubble->SetAlignment(BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); | 115 bubble->SetAlignment(BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE); |
116 | 116 |
117 if (sender == fade_in_) | 117 if (sender == fade_in_) |
118 bubble->StartFade(true); | 118 bubble->StartFade(true); |
119 else | 119 else |
120 bubble->GetWidget()->Show(); | 120 bubble->GetWidget()->Show(); |
121 } | 121 } |
122 | 122 |
123 } // namespace examples | 123 } // namespace examples |
124 } // namespace views | 124 } // namespace views |
OLD | NEW |