ocarina/gui/history.cpp

63 lines
1.6 KiB
C++

/*
* Copyright 2014 (c) Anna Schumaker.
*/
#include <core/deck.h>
#include <gui/tabs.h>
#include <gui/queue/label.h>
#include <gui/queue/toolbar.h>
#include <gui/queue/window.h>
class HistoryTab : public Tab {
private:
Glib::RefPtr<Gtk::Builder> builder;
Gtk::VBox history_vbox;
HistoryLabel *history_label;
QueueToolbar *history_toolbar;
QueueWindow *history_window;
public:
HistoryTab() : Tab(deck :: get_queue())
{
builder = Gtk::Builder::create();
builder->add_from_file(gui :: share_file("QueueWindow.ui"));
builder->add_from_file(gui :: share_file("QueueToolbar.ui"));
builder->add_from_file(gui :: share_file("QueueLabel.ui"));
builder->get_widget_derived("HistoryLabel", history_label);
builder->get_widget_derived("QueueToolbar", history_toolbar);
builder->get_widget_derived("QueueWindow", history_window);
history_vbox.set_margin_left(1);
history_vbox.set_margin_right(1);
history_vbox.set_homogeneous(false);
history_vbox.pack_start(*history_toolbar, false, true, 2);
history_vbox.pack_start(*history_window, true, true);
history_vbox.show();
tab_random = history_toolbar->q_random;
tab_repeat = history_toolbar->q_repeat;
tab_search = history_toolbar->q_search;
tab_size = history_label->history_size;
tab_treeview = history_window->q_treeview;
tab_widget = &history_vbox;
tab_finish_init();
gui :: get_widget<Gtk::Notebook>("o_notebook")->insert_page(history_vbox, *history_label, 0);
}
~HistoryTab()
{
tab_unmap();
}
};
static HistoryTab *history_tab;
void init_history_tab()
{
history_tab = new HistoryTab;
}