gui: Begin developing playqueue tabs

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
This commit is contained in:
Anna Schumaker 2014-01-19 10:34:26 -05:00 committed by Anna Schumaker
parent 2724b90281
commit ea687408aa
3 changed files with 37 additions and 11 deletions

View File

@ -6,8 +6,11 @@
#include <playqueue.h>
#include <map>
#include <sstream>
#include <string>
class OcarinaTab;
static std::map<Playqueue *, OcarinaTab *> tab_map;
/*
* Tab class definition
@ -15,25 +18,41 @@
class OcarinaTab {
private:
Playqueue *queue;
Gtk::Label tab_label;
/* Tab widgets */
Gtk::VBox tab_box;
Gtk::Label tab_name;
Gtk::Label tab_size;
Gtk::VBox tab_page;
void set_tab_size();
public:
OcarinaTab(const std::string &, Playqueue *);
~OcarinaTab();
};
static std::map<Playqueue *, OcarinaTab *> tab_map;
OcarinaTab::OcarinaTab(const std::string &text, Playqueue *pq)
: queue(pq), tab_label(text)
: queue(pq),
tab_name("<big>" + text + "</big>", 1, 0.5),
tab_size("0", 1, 0.5)
{
Gtk::Notebook *notebook;
tab_label.set_visible();
tab_box.set_visible();
get_builder()->get_widget("o_notebook", notebook);
notebook->prepend_page(tab_box, tab_label);
/* Make tab label */
tab_name.set_use_markup();
tab_box.pack_start(tab_name);
tab_box.pack_start(tab_size);
tab_box.show_all();
set_tab_size();
tab_page.set_visible();
notebook->prepend_page(tab_page, tab_box);
tab_map[pq] = this;
};
@ -43,14 +62,21 @@ OcarinaTab::~OcarinaTab()
tab_map.erase(queue);
}
void OcarinaTab::set_tab_size()
{
std::stringstream ss;
ss << queue->size();
tab_size.set_text(ss.str());
}
/*
* Do stuff with tabs
*/
void setup_library_tab()
void init_tabs()
{
/*OcarinaTab *ot =*/ new OcarinaTab("Library", deck::get_library_pq());
new OcarinaTab("Library", deck::get_library_pq());
}
void cleanup_tabs()

View File

@ -222,7 +222,7 @@ Gtk::Window *connect_wires()
/* Set up other tabs */
setup_library_tab();
init_tabs();
return window;
}

View File

@ -7,7 +7,7 @@
#include <gtkmm.h>
/* tabs.cpp */
void setup_library_tab();
void init_tabs();
void cleanup_tabs();
/* wires.cpp */