| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 views::Label* CreateShortcutLabel( | 45 views::Label* CreateShortcutLabel( |
| 46 ui::CandidateWindow::Orientation orientation, | 46 ui::CandidateWindow::Orientation orientation, |
| 47 const ui::NativeTheme& theme) { | 47 const ui::NativeTheme& theme) { |
| 48 // Create the shortcut label. The label will be owned by | 48 // Create the shortcut label. The label will be owned by |
| 49 // |wrapped_shortcut_label|, hence it's deleted when | 49 // |wrapped_shortcut_label|, hence it's deleted when |
| 50 // |wrapped_shortcut_label| is deleted. | 50 // |wrapped_shortcut_label| is deleted. |
| 51 views::Label* shortcut_label = new views::Label; | 51 views::Label* shortcut_label = new views::Label; |
| 52 | 52 |
| 53 if (orientation == ui::CandidateWindow::VERTICAL) { | 53 if (orientation == ui::CandidateWindow::VERTICAL) { |
| 54 shortcut_label->SetFontList( | 54 shortcut_label->SetFontList( |
| 55 shortcut_label->font_list().DeriveFontListWithSizeDeltaAndStyle( | 55 shortcut_label->font_list().Derive(kFontSizeDelta, gfx::Font::BOLD)); |
| 56 kFontSizeDelta, gfx::Font::BOLD)); | |
| 57 } else { | 56 } else { |
| 58 shortcut_label->SetFontList( | 57 shortcut_label->SetFontList( |
| 59 shortcut_label->font_list().DeriveFontListWithSizeDelta( | 58 shortcut_label->font_list().DeriveWithSizeDelta(kFontSizeDelta)); |
| 60 kFontSizeDelta)); | |
| 61 } | 59 } |
| 62 // TODO(satorux): Maybe we need to use language specific fonts for | 60 // TODO(satorux): Maybe we need to use language specific fonts for |
| 63 // candidate_label, like Chinese font for Chinese input method? | 61 // candidate_label, like Chinese font for Chinese input method? |
| 64 shortcut_label->SetEnabledColor(theme.GetSystemColor( | 62 shortcut_label->SetEnabledColor(theme.GetSystemColor( |
| 65 ui::NativeTheme::kColorId_LabelEnabledColor)); | 63 ui::NativeTheme::kColorId_LabelEnabledColor)); |
| 66 shortcut_label->SetDisabledColor(theme.GetSystemColor( | 64 shortcut_label->SetDisabledColor(theme.GetSystemColor( |
| 67 ui::NativeTheme::kColorId_LabelDisabledColor)); | 65 ui::NativeTheme::kColorId_LabelDisabledColor)); |
| 68 | 66 |
| 69 // Setup paddings. | 67 // Setup paddings. |
| 70 const gfx::Insets kVerticalShortcutLabelInsets(1, 6, 1, 6); | 68 const gfx::Insets kVerticalShortcutLabelInsets(1, 6, 1, 6); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 101 // Create the candidate label. The label will be added to |this| as a | 99 // Create the candidate label. The label will be added to |this| as a |
| 102 // child view, hence it's deleted when |this| is deleted. | 100 // child view, hence it's deleted when |this| is deleted. |
| 103 if (orientation == ui::CandidateWindow::VERTICAL) { | 101 if (orientation == ui::CandidateWindow::VERTICAL) { |
| 104 candidate_label = new VerticalCandidateLabel; | 102 candidate_label = new VerticalCandidateLabel; |
| 105 } else { | 103 } else { |
| 106 candidate_label = new views::Label; | 104 candidate_label = new views::Label; |
| 107 } | 105 } |
| 108 | 106 |
| 109 // Change the font size. | 107 // Change the font size. |
| 110 candidate_label->SetFontList( | 108 candidate_label->SetFontList( |
| 111 candidate_label->font_list().DeriveFontListWithSizeDelta(kFontSizeDelta)); | 109 candidate_label->font_list().DeriveWithSizeDelta(kFontSizeDelta)); |
| 112 candidate_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 110 candidate_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 113 | 111 |
| 114 return candidate_label; | 112 return candidate_label; |
| 115 } | 113 } |
| 116 | 114 |
| 117 // Creates the annotation label, and return it (never returns NULL). | 115 // Creates the annotation label, and return it (never returns NULL). |
| 118 // The label text is not set in this function. | 116 // The label text is not set in this function. |
| 119 views::Label* CreateAnnotationLabel( | 117 views::Label* CreateAnnotationLabel( |
| 120 ui::CandidateWindow::Orientation orientation, | 118 ui::CandidateWindow::Orientation orientation, |
| 121 const ui::NativeTheme& theme) { | 119 const ui::NativeTheme& theme) { |
| 122 // Create the annotation label. | 120 // Create the annotation label. |
| 123 views::Label* annotation_label = new views::Label; | 121 views::Label* annotation_label = new views::Label; |
| 124 | 122 |
| 125 // Change the font size and color. | 123 // Change the font size and color. |
| 126 annotation_label->SetFontList( | 124 annotation_label->SetFontList( |
| 127 annotation_label->font_list().DeriveFontListWithSizeDelta( | 125 annotation_label->font_list().DeriveWithSizeDelta(kFontSizeDelta)); |
| 128 kFontSizeDelta)); | |
| 129 annotation_label->SetEnabledColor(theme.GetSystemColor( | 126 annotation_label->SetEnabledColor(theme.GetSystemColor( |
| 130 ui::NativeTheme::kColorId_LabelDisabledColor)); | 127 ui::NativeTheme::kColorId_LabelDisabledColor)); |
| 131 annotation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 128 annotation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 132 | 129 |
| 133 return annotation_label; | 130 return annotation_label; |
| 134 } | 131 } |
| 135 | 132 |
| 136 } // namespace | 133 } // namespace |
| 137 | 134 |
| 138 CandidateView::CandidateView( | 135 CandidateView::CandidateView( |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 277 } |
| 281 | 278 |
| 282 // Reserves the margin for infolist_icon even if it's not visible. | 279 // Reserves the margin for infolist_icon even if it's not visible. |
| 283 size.Enlarge( | 280 size.Enlarge( |
| 284 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); | 281 kInfolistIndicatorIconWidth + kInfolistIndicatorIconPadding * 2, 0); |
| 285 return size; | 282 return size; |
| 286 } | 283 } |
| 287 | 284 |
| 288 } // namespace ime | 285 } // namespace ime |
| 289 } // namespace ash | 286 } // namespace ash |
| OLD | NEW |