OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/ime/candidate_view.h" | 5 #include "ash/ime/candidate_view.h" |
6 | 6 |
7 #include "ash/ime/candidate_window_constants.h" | 7 #include "ash/ime/candidate_window_constants.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "ui/base/ime/candidate_window.h" | 9 #include "ui/base/ime/candidate_window.h" |
10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
11 #include "ui/native_theme/native_theme.h" | 11 #include "ui/native_theme/native_theme.h" |
12 #include "ui/views/background.h" | 12 #include "ui/views/background.h" |
13 #include "ui/views/border.h" | 13 #include "ui/views/border.h" |
14 #include "ui/views/controls/label.h" | 14 #include "ui/views/controls/label.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 namespace ash { | 17 namespace ash { |
18 namespace ime { | 18 namespace ime { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // VerticalCandidateLabel is used for rendering candidate text in | 22 // VerticalCandidateLabel is used for rendering candidate text in |
23 // the vertical candidate window. | 23 // the vertical candidate window. |
24 class VerticalCandidateLabel : public views::Label { | 24 class VerticalCandidateLabel : public views::Label { |
25 public: | 25 public: |
26 VerticalCandidateLabel() {} | 26 VerticalCandidateLabel() {} |
27 | 27 |
28 private: | 28 private: |
29 virtual ~VerticalCandidateLabel() {} | 29 ~VerticalCandidateLabel() override {} |
30 | 30 |
31 // Returns the preferred size, but guarantees that the width has at | 31 // Returns the preferred size, but guarantees that the width has at |
32 // least kMinCandidateLabelWidth pixels. | 32 // least kMinCandidateLabelWidth pixels. |
33 virtual gfx::Size GetPreferredSize() const override { | 33 gfx::Size GetPreferredSize() const override { |
34 gfx::Size size = Label::GetPreferredSize(); | 34 gfx::Size size = Label::GetPreferredSize(); |
35 size.SetToMax(gfx::Size(kMinCandidateLabelWidth, 0)); | 35 size.SetToMax(gfx::Size(kMinCandidateLabelWidth, 0)); |
36 size.SetToMin(gfx::Size(kMaxCandidateLabelWidth, size.height())); | 36 size.SetToMin(gfx::Size(kMaxCandidateLabelWidth, size.height())); |
37 return size; | 37 return size; |
38 } | 38 } |
39 | 39 |
40 DISALLOW_COPY_AND_ASSIGN(VerticalCandidateLabel); | 40 DISALLOW_COPY_AND_ASSIGN(VerticalCandidateLabel); |
41 }; | 41 }; |
42 | 42 |
43 // Creates the shortcut label, and returns it (never returns NULL). | 43 // Creates the shortcut label, and returns it (never returns NULL). |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 292 } |
293 | 293 |
294 // Reserves the margin for infolist_icon even if it's not visible. | 294 // Reserves the margin for infolist_icon even if it's not visible. |
295 size.Enlarge( | 295 size.Enlarge( |
296 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); | 296 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); |
297 return size; | 297 return size; |
298 } | 298 } |
299 | 299 |
300 } // namespace ime | 300 } // namespace ime |
301 } // namespace ash | 301 } // namespace ash |
OLD | NEW |