#ifndef ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_
#define ASH_SYSTEM_TRAY_HOVER_HIGHLIGHT_VIEW_H_
#include <memory>
#include "ash/system/tray/actionable_view.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "ui/base/models/image_model.h"
#include "ui/gfx/font.h"
#include "ui/gfx/text_constants.h"
namespace views {
class Border;
class Label;
}
namespace ash {
class TriView;
class ViewClickListener;
class ASH_EXPORT HoverHighlightView : public ActionableView {
public:
enum class AccessibilityState {
DEFAULT,
CHECKED_CHECKBOX,
UNCHECKED_CHECKBOX
};
explicit HoverHighlightView(ViewClickListener* listener);
HoverHighlightView(const HoverHighlightView&) = delete;
HoverHighlightView& operator=(const HoverHighlightView&) = delete;
~HoverHighlightView() override;
void AddIconAndLabel(const gfx::ImageSkia& image, const std::u16string& text);
void AddIconAndLabel(const ui::ImageModel& image, const std::u16string& text);
void AddViewAndLabel(std::unique_ptr<views::View> view,
const std::u16string& text);
void AddLabelRow(const std::u16string& text);
void AddLabelRow(const std::u16string& text, int start_inset);
void AddRightIcon(const ui::ImageModel& image, int icon_size);
void AddRightView(views::View* view,
std::unique_ptr<views::Border> border = nullptr);
void AddAdditionalRightView(views::View* view);
void SetRightViewVisible(bool visible);
void SetSubText(const std::u16string& sub_text);
void SetExpandable(bool expandable);
void SetAccessibilityState(AccessibilityState accessibility_state);
void Reset();
bool is_populated() const { return is_populated_; }
views::Label* text_label() { return text_label_; }
views::Label* sub_text_label() { return sub_text_label_; }
views::View* left_view() { return left_view_; }
views::View* right_view() { return right_view_; }
views::View* sub_row() { return sub_row_; }
TriView* tri_view() { return tri_view_; }
protected:
void OnSetTooltipText(const std::u16string& tooltip_text) override;
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
const char* GetClassName() const override;
private:
friend class TrayAccessibilityTest;
bool PerformAction(const ui::Event& event) override;
gfx::Size CalculatePreferredSize() const override;
int GetHeightForWidth(int width) const override;
void OnFocus() override;
void AddSubRowContainer();
void OnEnabledChanged();
bool is_populated_ = false;
const raw_ptr<ViewClickListener, ExperimentalAsh> listener_ = nullptr;
raw_ptr<views::Label, ExperimentalAsh> text_label_ = nullptr;
raw_ptr<views::Label, ExperimentalAsh> sub_text_label_ = nullptr;
raw_ptr<views::View, ExperimentalAsh> left_view_ = nullptr;
raw_ptr<views::View, ExperimentalAsh> right_view_ = nullptr;
raw_ptr<views::View, ExperimentalAsh> sub_row_ = nullptr;
raw_ptr<TriView, ExperimentalAsh> tri_view_ = nullptr;
bool expandable_ = false;
AccessibilityState accessibility_state_ = AccessibilityState::DEFAULT;
base::CallbackListSubscription enabled_changed_subscription_ =
AddEnabledChangedCallback(
base::BindRepeating(&HoverHighlightView::OnEnabledChanged,
base::Unretained(this)));
};
}
#endif