summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI/PathBreadcrumbbar.h
blob: 1aa04f20f51c684f44cbcbc2ca84376472944a62 (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
/*
 * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/NonnullRefPtr.h>
#include <LibGUI/Forward.h>
#include <LibGUI/Widget.h>

namespace GUI {

class PathBreadcrumbbar : public Widget {
    C_OBJECT_ABSTRACT(PathBreadcrumbbar)
public:
    static ErrorOr<NonnullRefPtr<PathBreadcrumbbar>> try_create();
    virtual ~PathBreadcrumbbar() override;

    void set_current_path(DeprecatedString const&);

    void show_location_text_box();
    void hide_location_text_box();

    bool has_parent_segment() const;
    bool has_child_segment() const;

    void select_parent_segment();
    void select_child_segment();

    Function<void(StringView path)> on_path_change;
    Function<void(StringView path, GUI::DropEvent const&)> on_paths_drop;
    Function<void()> on_hide_location_box;

private:
    PathBreadcrumbbar(NonnullRefPtr<GUI::TextBox>, NonnullRefPtr<GUI::Breadcrumbbar>);

    NonnullRefPtr<GUI::TextBox> m_location_text_box;
    NonnullRefPtr<GUI::Breadcrumbbar> m_breadcrumbbar;

    DeprecatedString m_current_path;
};

}