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/status_area_widget_delegate.h" | 5 #include "ash/system/status_area_widget_delegate.h" |
6 | 6 |
7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/focus_cycler.h" | 9 #include "ash/focus_cycler.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 UpdateLayout(); | 106 UpdateLayout(); |
107 } | 107 } |
108 | 108 |
109 void StatusAreaWidgetDelegate::UpdateLayout() { | 109 void StatusAreaWidgetDelegate::UpdateLayout() { |
110 // Use a grid layout so that the trays can be centered in each cell, and | 110 // Use a grid layout so that the trays can be centered in each cell, and |
111 // so that the widget gets laid out correctly when tray sizes change. | 111 // so that the widget gets laid out correctly when tray sizes change. |
112 views::GridLayout* layout = new views::GridLayout(this); | 112 views::GridLayout* layout = new views::GridLayout(this); |
113 SetLayoutManager(layout); | 113 SetLayoutManager(layout); |
114 | 114 |
115 views::ColumnSet* columns = layout->AddColumnSet(0); | 115 views::ColumnSet* columns = layout->AddColumnSet(0); |
116 if (alignment_ == SHELF_ALIGNMENT_BOTTOM || | 116 if (alignment_ == SHELF_ALIGNMENT_BOTTOM) { |
117 alignment_ == SHELF_ALIGNMENT_TOP) { | |
118 bool is_first_visible_child = true; | 117 bool is_first_visible_child = true; |
119 for (int c = 0; c < child_count(); ++c) { | 118 for (int c = 0; c < child_count(); ++c) { |
120 views::View* child = child_at(c); | 119 views::View* child = child_at(c); |
121 if (!child->visible()) | 120 if (!child->visible()) |
122 continue; | 121 continue; |
123 if (!is_first_visible_child) | 122 if (!is_first_visible_child) |
124 columns->AddPaddingColumn(0, kTraySpacing); | 123 columns->AddPaddingColumn(0, kTraySpacing); |
125 is_first_visible_child = false; | 124 is_first_visible_child = false; |
126 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, | 125 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, |
127 0, /* resize percent */ | 126 0, /* resize percent */ |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { | 165 void StatusAreaWidgetDelegate::ChildVisibilityChanged(View* child) { |
167 UpdateLayout(); | 166 UpdateLayout(); |
168 } | 167 } |
169 | 168 |
170 void StatusAreaWidgetDelegate::UpdateWidgetSize() { | 169 void StatusAreaWidgetDelegate::UpdateWidgetSize() { |
171 if (GetWidget()) | 170 if (GetWidget()) |
172 GetWidget()->SetSize(GetPreferredSize()); | 171 GetWidget()->SetSize(GetPreferredSize()); |
173 } | 172 } |
174 | 173 |
175 } // namespace ash | 174 } // namespace ash |
OLD | NEW |