5 #include "util/uuid.hpp"
6 #include "util/sort_controller.hpp"
7 #include "util/selection_provider.hpp"
8 #include "common/common.hpp"
9 #include "util/treeview_state_store.hpp"
19 UUID get_selected()
override;
20 bool get_any_selected();
21 void set_show_none(
bool v);
22 void set_show_path(
bool v);
23 void add_context_menu_item(
const std::string &label, std::function<
void(
UUID)> cb,
24 std::function<
bool(
UUID)> cb_sensitive =
nullptr);
25 virtual void add_copy_name_context_menu_item(){};
26 virtual void search() = 0;
28 void clear_search_once();
29 virtual ObjectType get_type()
const
31 return ObjectType::INVALID;
33 void go_to(
const UUID &uu);
38 enum class PoolItemSource { LOCAL, INCLUDED, OVERRIDDEN, OVERRIDDEN_LOCAL, CACHED };
41 void construct(Gtk::Widget *search_box =
nullptr);
44 bool pools_included =
false;
45 bool show_none =
false;
46 bool show_path =
false;
47 Gtk::TreeViewColumn *path_column =
nullptr;
50 Gtk::TreeView *treeview =
nullptr;
51 Gtk::ScrolledWindow *scrolled_window =
nullptr;
53 Gtk::TreeViewColumn *append_column(
const std::string &name,
const Gtk::TreeModelColumnBase &column,
54 Pango::EllipsizeMode ellipsize = Pango::ELLIPSIZE_NONE);
55 Gtk::TreeViewColumn *append_column_with_item_source_cr(
const std::string &name,
56 const Gtk::TreeModelColumnBase &column,
57 Pango::EllipsizeMode ellipsize = Pango::ELLIPSIZE_NONE);
59 void install_column_tooltip(Gtk::TreeViewColumn &tvc,
const Gtk::TreeModelColumnBase &col);
61 Gtk::Entry *create_search_entry(
const std::string &label, Gtk::Widget *extra_widget =
nullptr);
62 class TagEntry *create_tag_entry(
const std::string &label, Gtk::Widget *extra_widget =
nullptr);
63 void add_search_widget(
const std::string &label, Gtk::Widget &w, Gtk::Widget *extra_widget =
nullptr);
65 virtual Glib::RefPtr<Gtk::ListStore> create_list_store() = 0;
66 virtual void create_columns() = 0;
67 virtual void add_sort_controller_columns() = 0;
68 virtual UUID uuid_from_row(
const Gtk::TreeModel::Row &row) = 0;
70 Glib::RefPtr<Gtk::ListStore> store;
71 std::unique_ptr<SortController> sort_controller;
73 void row_activated(
const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column);
74 void selection_changed();
76 void select_uuid(
const UUID &uu);
77 void scroll_to_selection();
79 Gtk::Menu context_menu;
80 std::set<Gtk::Entry *> search_entries;
81 std::set<TagEntry *> tag_entries;
83 PoolItemSource pool_item_source_from_db(
const SQLite::Query &q,
int idx_uu,
int idx_last_uu)
const;
84 PoolItemSource pool_item_source_from_db(
const UUID &uu,
const UUID &last_uu)
const;
86 void install_pool_item_source_tooltip();
87 virtual PoolItemSource pool_item_source_from_row(
const Gtk::TreeModel::Row &row);
88 bool searched_once =
false;
90 void set_busy(
bool busy);
91 void prepare_search();
94 Gtk::Box *status_box =
nullptr;
96 std::string get_tags_query(
const std::set<std::string> &tags)
const;
97 void bind_tags_query(
SQLite::Query &q,
const std::set<std::string> &tags)
const;
99 Gtk::Widget *create_pool_selector();
100 std::string get_pool_selector_query()
const;
103 Gtk::Widget *focus_widget =
nullptr;
106 Gtk::Grid *grid =
nullptr;
109 Gtk::Box *busy_box =
nullptr;
110 UUID selected_uuid_before_search;
112 Gtk::Label *status_label =
nullptr;
113 const std::string store_prefix;
114 std::optional<TreeViewStateStore> state_store;
116 std::vector<std::pair<Gtk::Widget *, std::function<bool(
UUID)>>> menu_item_sensitive_cbs;
119 bool pools_reloading =
false;
Definition: cell_renderer_color_box.hpp:6
Definition: pool_browser.hpp:16
Definition: pool_selector.hpp:6
Definition: sqlite.hpp:25
Definition: selection_provider.hpp:6
Definition: tag_entry.hpp:9
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16