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 "ash/system/ime/tray_ime.h" | 5 #include "ash/system/ime/tray_ime.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 AddChildView(header_); | 94 AddChildView(header_); |
95 } | 95 } |
96 | 96 |
97 void AppendIMEList(const IMEInfoList& list) { | 97 void AppendIMEList(const IMEInfoList& list) { |
98 ime_map_.clear(); | 98 ime_map_.clear(); |
99 views::View* imes = new views::View; | 99 views::View* imes = new views::View; |
100 imes->SetLayoutManager(new views::BoxLayout( | 100 imes->SetLayoutManager(new views::BoxLayout( |
101 views::BoxLayout::kVertical, 0, 0, 1)); | 101 views::BoxLayout::kVertical, 0, 0, 1)); |
102 for (size_t i = 0; i < list.size(); i++) { | 102 for (size_t i = 0; i < list.size(); i++) { |
103 HoverHighlightView* container = new HoverHighlightView(this); | 103 HoverHighlightView* container = new HoverHighlightView(this); |
| 104 container->set_fixed_height(kTrayPopupItemHeight); |
104 container->AddLabel(list[i].name, | 105 container->AddLabel(list[i].name, |
105 list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); | 106 list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); |
106 imes->AddChildView(container); | 107 imes->AddChildView(container); |
107 ime_map_[container] = list[i].id; | 108 ime_map_[container] = list[i].id; |
108 } | 109 } |
109 imes->set_border(views::Border::CreateSolidSidedBorder(1, 0, 1, 0, | 110 imes->set_border(views::Border::CreateSolidSidedBorder(1, 0, 1, 0, |
110 kBorderLightColor)); | 111 kBorderLightColor)); |
111 AddChildView(imes); | 112 AddChildView(imes); |
112 } | 113 } |
113 | 114 |
114 void AppendIMEProperties(const IMEPropertyInfoList& property_list) { | 115 void AppendIMEProperties(const IMEPropertyInfoList& property_list) { |
115 property_map_.clear(); | 116 property_map_.clear(); |
116 views::View* properties = new views::View; | 117 views::View* properties = new views::View; |
117 properties->SetLayoutManager(new views::BoxLayout( | 118 properties->SetLayoutManager(new views::BoxLayout( |
118 views::BoxLayout::kVertical, 0, 0, 1)); | 119 views::BoxLayout::kVertical, 0, 0, 1)); |
119 for (size_t i = 0; i < property_list.size(); i++) { | 120 for (size_t i = 0; i < property_list.size(); i++) { |
120 HoverHighlightView* container = new HoverHighlightView(this); | 121 HoverHighlightView* container = new HoverHighlightView(this); |
| 122 container->set_fixed_height(kTrayPopupItemHeight); |
121 container->AddLabel( | 123 container->AddLabel( |
122 property_list[i].name, | 124 property_list[i].name, |
123 property_list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); | 125 property_list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL); |
124 properties->AddChildView(container); | 126 properties->AddChildView(container); |
125 property_map_[container] = property_list[i].key; | 127 property_map_[container] = property_list[i].key; |
126 } | 128 } |
127 properties->set_border(views::Border::CreateSolidSidedBorder( | 129 properties->set_border(views::Border::CreateSolidSidedBorder( |
128 0, 0, 1, 0, kBorderLightColor)); | 130 0, 0, 1, 0, kBorderLightColor)); |
129 AddChildView(properties); | 131 AddChildView(properties); |
130 } | 132 } |
131 | 133 |
132 void AppendSettings() { | 134 void AppendSettings() { |
133 HoverHighlightView* container = new HoverHighlightView(this); | 135 HoverHighlightView* container = new HoverHighlightView(this); |
| 136 container->set_fixed_height(kTrayPopupItemHeight); |
134 container->AddLabel(ui::ResourceBundle::GetSharedInstance(). | 137 container->AddLabel(ui::ResourceBundle::GetSharedInstance(). |
135 GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS), | 138 GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS), |
136 gfx::Font::NORMAL); | 139 gfx::Font::NORMAL); |
137 AddChildView(container); | 140 AddChildView(container); |
138 settings_ = container; | 141 settings_ = container; |
139 } | 142 } |
140 | 143 |
141 // Overridden from ViewClickListener. | 144 // Overridden from ViewClickListener. |
142 virtual void ClickedOn(views::View* sender) OVERRIDE { | 145 virtual void ClickedOn(views::View* sender) OVERRIDE { |
143 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 146 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 UpdateTrayLabel(current, list.size()); | 232 UpdateTrayLabel(current, list.size()); |
230 | 233 |
231 if (default_.get()) | 234 if (default_.get()) |
232 default_->UpdateLabel(current); | 235 default_->UpdateLabel(current); |
233 if (detailed_.get()) | 236 if (detailed_.get()) |
234 detailed_->Update(list, property_list); | 237 detailed_->Update(list, property_list); |
235 } | 238 } |
236 | 239 |
237 } // namespace internal | 240 } // namespace internal |
238 } // namespace ash | 241 } // namespace ash |
OLD | NEW |