blob: 218ab7a4db552102ff805afbd0d7ae206b11f6ee (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// 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/settings/tray_settings.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "grit/ash_strings.h"
#include "grit/ui_resources.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view.h"
namespace {
class SettingsView : public views::View {
public:
SettingsView() {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
0, 0, 3));
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
views::ImageView* icon = new views::ImageView;
icon->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SETTINGS).
ToSkBitmap());
AddChildView(icon);
label_ = new views::Label(bundle.GetLocalizedString(
IDS_ASH_STATUS_TRAY_HELP_AND_SETTINGS));
AddChildView(label_);
}
// Overridden from views::View.
virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE {
ash::Shell::GetInstance()->tray_delegate()->ShowSettings();
return true;
}
virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE {
gfx::Font font = label_->font();
label_->SetFont(font.DeriveFont(0,
font.GetStyle() | gfx::Font::UNDERLINED));
SchedulePaint();
}
virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE {
gfx::Font font = label_->font();
label_->SetFont(font.DeriveFont(0,
font.GetStyle() & ~gfx::Font::UNDERLINED));
SchedulePaint();
}
private:
views::Label* label_;
DISALLOW_COPY_AND_ASSIGN(SettingsView);
};
} // namespace
namespace ash {
namespace internal {
TraySettings::TraySettings() {}
TraySettings::~TraySettings() {}
views::View* TraySettings::CreateTrayView(user::LoginStatus status) {
return NULL;
}
views::View* TraySettings::CreateDefaultView(user::LoginStatus status) {
if (status == user::LOGGED_IN_NONE)
return NULL;
views::View* container = new views::View;
views::BoxLayout* layout =
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 5);
layout->set_spread_blank_space(true);
container->SetLayoutManager(layout);
views::View* settings = new SettingsView;
container->AddChildView(settings);
return container;
}
views::View* TraySettings::CreateDetailedView(user::LoginStatus status) {
NOTIMPLEMENTED();
return NULL;
}
void TraySettings::DestroyTrayView() {
}
void TraySettings::DestroyDefaultView() {
}
void TraySettings::DestroyDetailedView() {
}
} // namespace internal
} // namespace ash
|