PathBreadcrumbbar.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/NonnullRefPtr.h>
  8. #include <LibGUI/Forward.h>
  9. #include <LibGUI/Widget.h>
  10. namespace GUI {
  11. class PathBreadcrumbbar : public Widget {
  12. C_OBJECT_ABSTRACT(PathBreadcrumbbar)
  13. public:
  14. static ErrorOr<NonnullRefPtr<PathBreadcrumbbar>> try_create();
  15. virtual ~PathBreadcrumbbar() override;
  16. void set_current_path(DeprecatedString const&);
  17. void show_location_text_box();
  18. void hide_location_text_box();
  19. bool has_parent_segment() const;
  20. bool has_child_segment() const;
  21. void select_parent_segment();
  22. void select_child_segment();
  23. Function<void(StringView path)> on_path_change;
  24. Function<void(StringView path, GUI::DropEvent const&)> on_paths_drop;
  25. Function<void()> on_hide_location_box;
  26. private:
  27. PathBreadcrumbbar(NonnullRefPtr<GUI::TextBox>, NonnullRefPtr<GUI::Breadcrumbbar>);
  28. NonnullRefPtr<GUI::TextBox> m_location_text_box;
  29. NonnullRefPtr<GUI::Breadcrumbbar> m_breadcrumbbar;
  30. DeprecatedString m_current_path;
  31. };
  32. }