mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03:00
5c5a00dd3a
These classes are used as-is in all chromes. Move them to LibWebView so that non-Serenity chromes don't have to awkwardly reach into its headers and sources.
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Vector.h>
|
|
#include <LibGUI/Model.h>
|
|
#include <LibGUI/Widget.h>
|
|
#include <LibWebView/History.h>
|
|
|
|
namespace Browser {
|
|
|
|
class HistoryModel final : public GUI::Model {
|
|
public:
|
|
enum Column {
|
|
Title,
|
|
URL,
|
|
__Count,
|
|
};
|
|
|
|
void set_items(AK::Vector<WebView::History::URLTitlePair> items);
|
|
void clear_items();
|
|
virtual int row_count(GUI::ModelIndex const&) const override;
|
|
virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; }
|
|
virtual ErrorOr<String> column_name(int) const override;
|
|
virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override;
|
|
virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override;
|
|
virtual GUI::Model::MatchResult data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override;
|
|
|
|
private:
|
|
AK::Vector<WebView::History::URLTitlePair> m_entries;
|
|
};
|
|
|
|
}
|