blob: e5f8ea62e6cb856564bad9983595130ab63a573d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/status_area_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/system/status_area_widget_delegate.h"
#include "ui/aura/window.h"
namespace ash {
namespace internal {
StatusAreaWidget::StatusAreaWidget() {
widget_delegate_ = new internal::StatusAreaWidgetDelegate;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.delegate = widget_delegate_;
params.parent = Shell::GetInstance()->GetContainer(
ash::internal::kShellWindowId_StatusContainer);
params.transparent = true;
Init(params);
set_focus_on_creation(false);
SetContentsView(widget_delegate_);
GetNativeView()->SetName("StatusAreaWidget");
}
StatusAreaWidget::~StatusAreaWidget() {
}
void StatusAreaWidget::AddTray(views::View* tray) {
widget_delegate_->AddChildView(tray);
widget_delegate_->Layout();
}
void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) {
if (alignment == SHELF_ALIGNMENT_BOTTOM)
widget_delegate_->SetLayout(views::BoxLayout::kHorizontal);
else
widget_delegate_->SetLayout(views::BoxLayout::kVertical);
}
} // namespace internal
} // namespace ash
|