forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtab_strip.h
87 lines (63 loc) · 2.08 KB
/
tab_strip.h
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
// Copyright 2020 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_HUD_DISPLAY_TAB_STRIP_H_
#define ASH_HUD_DISPLAY_TAB_STRIP_H_
#include <string>
#include "ash/hud_display/hud_constants.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h"
namespace gfx {
class Canvas;
}
namespace views {
class View;
}
namespace ash {
namespace hud_display {
class HUDDisplayView;
class HUDTabStrip;
class HUDTabButton : public views::LabelButton {
public:
// Defines tab paint style.
enum class Style {
LEFT, // Tab to the left of the active tab.
ACTIVE, // Active tab.
RIGHT // Tab to the right of the active tab.
};
METADATA_HEADER(HUDTabButton);
HUDTabButton(Style style,
const DisplayMode display_mode,
const std::u16string& text);
HUDTabButton(const HUDTabButton&) = delete;
HUDTabButton& operator=(const HUDTabButton&) = delete;
~HUDTabButton() override = default;
void SetStyle(Style style);
DisplayMode display_mode() const { return display_mode_; }
protected:
// views::LabelButton:
void PaintButtonContents(gfx::Canvas* canvas) override;
private:
Style style_ = Style::LEFT;
// Tab activation sends this display mode to the HUD.
DisplayMode display_mode_;
};
class HUDTabStrip : public views::View {
public:
METADATA_HEADER(HUDTabStrip);
explicit HUDTabStrip(HUDDisplayView* hud);
HUDTabStrip(const HUDTabStrip&) = delete;
HUDTabStrip& operator=(const HUDTabStrip&) = delete;
~HUDTabStrip() override;
HUDTabButton* AddTabButton(const DisplayMode display_mode,
const std::u16string& label);
// Mark tabs around the active one need repaint to modify borders.
void ActivateTab(DisplayMode mode);
private:
HUDDisplayView* hud_;
std::vector<HUDTabButton*> tabs_; // Ordered list of child tabs.
};
} // namespace hud_display
} // namespace ash
#endif // ASH_HUD_DISPLAY_TAB_STRIP_H_