blob: 3da1615f3370a5ea471da11a37a76edfae9fe850 (
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
|
// Copyright (c) 2014 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 ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_
#define ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_
#include "base/macros.h"
#include "ui/views/view.h"
namespace ash {
// A view which can optionally change the background color when a mouse is
// hovering or a user is interacting via touch.
class TrayPopupItemContainer : public views::View {
public:
TrayPopupItemContainer(views::View* view,
bool change_background,
bool draw_border);
~TrayPopupItemContainer() override;
bool active() {
return active_;
}
private:
// Sets whether the active background is to be used, and triggers a paint.
void SetActive(bool active);
// views::View:
void ChildVisibilityChanged(views::View* child) override;
void ChildPreferredSizeChanged(views::View* child) override;
void OnMouseEntered(const ui::MouseEvent& event) override;
void OnMouseExited(const ui::MouseEvent& event) override;
void OnGestureEvent(ui::GestureEvent* event) override;
void OnPaintBackground(gfx::Canvas* canvas) override;
// True if either a mouse is hovering over this view, or if a user has touched
// down.
bool active_;
// True if mouse hover and touch feedback can alter the background color of
// the container.
bool change_background_;
DISALLOW_COPY_AND_ASSIGN(TrayPopupItemContainer);
};
} // namespace ash
#endif // ASH_SYSTEM_TRAY_TRAY_POPUP_ITEM_CONTAINER_H_
|