blob: 176221ee9721afe81df7cbceea9d9d47a6f8fdfe (
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
|
// Copyright 2017 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.
#ifndef UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_CONTROL_BUTTONS_VIEW_H_
#define UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_CONTROL_BUTTONS_VIEW_H_
#include "base/macros.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/animation/animation_delegate.h"
#include "ui/message_center/message_center_export.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/view.h"
namespace ui {
class Event;
}
namespace gfx {
class LinearAnimation;
}
namespace views {
class Button;
}
namespace message_center {
class MessageView;
class PaddedButton;
class MESSAGE_CENTER_EXPORT NotificationControlButtonsView
: public views::View,
public views::ButtonListener,
public gfx::AnimationDelegate {
public:
// String to be returned by GetClassName() method.
static const char kViewClassName[];
explicit NotificationControlButtonsView(MessageView* message_view);
~NotificationControlButtonsView() override;
// Change the visibility of the close button. True to show, false to hide.
void ShowCloseButton(bool show);
// Change the visibility of the settings button. True to show, false to hide.
void ShowSettingsButton(bool show);
// Set the background color of the view.
void SetBackgroundColor(const SkColor& target_bgcolor);
// Request the focus on the close button.
void RequestFocusOnCloseButton();
// Return the focus status of the close button. True if the focus is on the
// close button, false otherwise.
bool IsCloseButtonFocused() const;
// Return the focus status of the settings button. True if the focus is on the
// close button, false otherwise.
bool IsSettingsButtonFocused() const;
// Methods for retrieving the control buttons directly.
views::Button* close_button() const;
views::Button* settings_button() const;
// views::View
const char* GetClassName() const override;
void SetVisible(bool visible) override;
// views::ButtonListener
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// gfx::AnimationDelegate
void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
void AnimationCanceled(const gfx::Animation* animation) override;
private:
MessageView* message_view_;
std::unique_ptr<PaddedButton> close_button_;
std::unique_ptr<PaddedButton> settings_button_;
std::unique_ptr<gfx::LinearAnimation> bgcolor_animation_;
SkColor bgcolor_origin_;
SkColor bgcolor_target_;
DISALLOW_COPY_AND_ASSIGN(NotificationControlButtonsView);
};
} // namespace message_center
#endif // UI_MESSAGE_CENTER_VIEWS_NOTIFICATION_CONTROL_BUTTONS_VIEW_H_
|