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
ash / quick_insert / views / quick_insert_badge_view.h [blame]
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_QUICK_INSERT_VIEWS_QUICK_INSERT_BADGE_VIEW_H_
#define ASH_QUICK_INSERT_VIEWS_QUICK_INSERT_BADGE_VIEW_H_
#include <string>
#include "ash/ash_export.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/metadata/view_factory.h"
namespace views {
class Label;
}
namespace ash {
// View for a badge containing a label with an icon after it.
class ASH_EXPORT QuickInsertBadgeView : public views::BoxLayoutView {
METADATA_HEADER(QuickInsertBadgeView, views::BoxLayoutView)
public:
QuickInsertBadgeView();
QuickInsertBadgeView(const QuickInsertBadgeView&) = delete;
QuickInsertBadgeView& operator=(const QuickInsertBadgeView&) = delete;
~QuickInsertBadgeView() override;
const std::u16string& GetText() const;
void SetText(const std::u16string& text);
// views::BoxLayoutView:
gfx::Size CalculatePreferredSize(
const views::SizeBounds& available_size) const override;
private:
raw_ptr<views::Label> label_ = nullptr;
};
BEGIN_VIEW_BUILDER(ASH_EXPORT, QuickInsertBadgeView, views::BoxLayoutView)
VIEW_BUILDER_PROPERTY(const std::u16string&, Text)
END_VIEW_BUILDER
} // namespace ash
DEFINE_VIEW_BUILDER(ASH_EXPORT, ash::QuickInsertBadgeView)
#endif // ASH_QUICK_INSERT_VIEWS_QUICK_INSERT_BADGE_VIEW_H_