/* * Copyright (c) 2020, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace GUI { class Breadcrumbbar : public GUI::Widget { C_OBJECT(Breadcrumbbar); public: virtual ~Breadcrumbbar() override; void clear_segments(); void append_segment(String text, const Gfx::Bitmap* icon = nullptr, String data = {}, String tooltip = {}); size_t segment_count() const { return m_segments.size(); } String segment_data(size_t index) const { return m_segments[index].data; } void set_selected_segment(Optional index); Optional selected_segment() const { return m_selected_segment; } Function on_segment_click; Function on_segment_drop; Function on_segment_drag_enter; Function on_doubleclick; private: Breadcrumbbar(); struct Segment { RefPtr icon; String text; String data; WeakPtr button; }; Vector m_segments; Optional m_selected_segment; virtual void doubleclick_event(GUI::MouseEvent&) override; }; }