104 lines
2.2 KiB
C++
104 lines
2.2 KiB
C++
/*
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
*/
|
|
#ifndef OCARINA_TABS_H
|
|
#define OCARINA_TABS_H
|
|
|
|
#include <ocarina.h>
|
|
#include <playqueue.h>
|
|
|
|
|
|
class Tab {
|
|
private:
|
|
std::set<unsigned int> visible_ids;
|
|
unsigned int tab_sorting_count;
|
|
std::string tab_sorting_title;
|
|
|
|
protected:
|
|
Playqueue *tab_pq;
|
|
Glib::RefPtr<PlayqueueModel> tab_model;
|
|
Glib::RefPtr<Gtk::TreeModelFilter> tab_filter;
|
|
|
|
|
|
/**
|
|
* Widgets that MUST be set by a child class
|
|
*/
|
|
Gtk::SearchEntry *tab_search;
|
|
Gtk::TreeView *tab_treeview;
|
|
Gtk::Widget *tab_widget;
|
|
|
|
/**
|
|
* Optional widgets that MAY be set
|
|
*/
|
|
Gtk::ToggleButton *tab_random;
|
|
Gtk::ToggleButton *tab_repeat;
|
|
Gtk::Label *tab_size;
|
|
|
|
|
|
/**
|
|
* Class helper functions
|
|
*/
|
|
void tab_init_random();
|
|
void tab_init_repeat();
|
|
void tab_toggle_button(Gtk::ToggleButton *, playqueue_flags);
|
|
bool tab_is_cur();
|
|
void tab_dec_sort_count();
|
|
virtual void tab_set_size();
|
|
void tab_unmap();
|
|
|
|
public:
|
|
Tab(Playqueue *);
|
|
virtual ~Tab();
|
|
|
|
/**
|
|
* More helper functions
|
|
*/
|
|
void tab_finish_init();
|
|
int tab_page_num();
|
|
void tab_runtime_changed();
|
|
void tab_display_sorting();
|
|
void tab_focus_search();
|
|
void tab_selected_ids(std::vector<unsigned int> &);
|
|
void tab_queue_add(Playqueue *);
|
|
bool tab_queue_selected(bool);
|
|
bool tab_add_to_queue(unsigned int);
|
|
|
|
/**
|
|
* internal callback functions that can be overridden if necessary
|
|
*/
|
|
virtual void on_post_init();
|
|
virtual void on_track_added(unsigned int);
|
|
virtual void on_track_deleted(unsigned int);
|
|
virtual void on_track_changed(unsigned int);
|
|
virtual bool on_key_press_event(const std::string &);
|
|
virtual void on_column_clicked(unsigned int);
|
|
|
|
/**
|
|
* GTK-MM callback functions
|
|
*/
|
|
void on_random_toggled();
|
|
void on_repeat_toggled();
|
|
void on_row_activated(const Gtk::TreePath &, Gtk::TreeViewColumn *);
|
|
bool on_key_pressed(GdkEventKey *key);
|
|
|
|
/* Filtering functions */
|
|
bool on_filter_visible(const Gtk::TreeIter &);
|
|
bool on_entry_key_released(GdkEventKey *);
|
|
void on_entry_changed();
|
|
};
|
|
|
|
|
|
Tab *find_tab(Playqueue *);
|
|
void tab_focus_search();
|
|
void init_tabs();
|
|
void post_init_tabs();
|
|
void cleanup_tabs();
|
|
|
|
|
|
void init_collection_tab();
|
|
void init_history_tab();
|
|
void init_playlist_tab();
|
|
void init_queue_tabs();
|
|
|
|
#endif /* OCARINA_TABS_H */
|