#include "topwin.cc" int main(int argc, char *argv[]) { Gtk::Main kit(argc, argv); TopWin topwin; Gtk::Main::run(topwin); return 0; }
#include "topwin.h" TopWin::TopWin() : //initialize controlhbox widgets controlhbox(false, 0), seekvbox(false, 0), seeklabel("0:00 - 0:00"), progress(0.00, 0.00, 0.00, 0.00, 0.00, 0.00), volumeadj(0.70, 0.00, 1.00, 0.01, 0.00, 0.00), hscale(progress), //infolabel infolabel("0 item(s) - 0.0 minutes - 0.00 MB") { set_title("Dingo Music Manager"); //create all controlhbox buttons Gtk::Image imgplay(Gtk::Stock::MEDIA_PLAY, Gtk::ICON_SIZE_SMALL_TOOLBAR); playbutton.set_image(imgplay); Gtk::Image imgprev(Gtk::Stock::MEDIA_PREVIOUS, Gtk::ICON_SIZE_SMALL_TOOLBAR); prevbutton.set_image(imgprev); Gtk::Image imgnext(Gtk::Stock::MEDIA_NEXT, Gtk::ICON_SIZE_SMALL_TOOLBAR); nextbutton.set_image(imgnext); Gtk::Image imgrepeat(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_SMALL_TOOLBAR); repeatbutton.set_image(imgrepeat); Gtk::Image imgfull(Gtk::Stock::FULLSCREEN, Gtk::ICON_SIZE_SMALL_TOOLBAR); fullbutton.set_image(imgfull); volumebutton.set_adjustment(volumeadj); //pack widgets into seekvbox seekvbox.pack_start(hscale, Gtk::PACK_SHRINK); seekvbox.pack_start(seeklabel, Gtk::PACK_SHRINK); //pack widgets into controlhbox controlhbox.pack_start(prevbutton, Gtk::PACK_SHRINK); controlhbox.pack_start(playbutton, Gtk::PACK_SHRINK); controlhbox.pack_start(nextbutton, Gtk::PACK_SHRINK); controlhbox.pack_start(seekvbox, Gtk::PACK_SHRINK); controlhbox.pack_end(volumebutton, Gtk::PACK_SHRINK); controlhbox.pack_end(searchbox, Gtk::PACK_SHRINK); controlhbox.pack_end(fullbutton, Gtk::PACK_SHRINK); controlhbox.pack_end(repeatbutton, Gtk::PACK_SHRINK); //create l_scroll l_model = Gtk::TreeStore::create(l_colrec); l_treeview.set_model(l_model); Gtk::TreeModel::Row row = *(l_model->append()); row[l_colrec.l_icon] = Gdk::Pixbuf::create_from_file("now-playing.png"); row[l_colrec.l_status] = "Now Playing"; row = *(l_model->append()); row[l_colrec.l_icon] = Gdk::Pixbuf::create_from_file("file-queue.png"); row[l_colrec.l_status] = "Play Queue"; row = *(l_model->append()); row[l_colrec.l_icon] = Gdk::Pixbuf::create_from_file("local-media.png"); row[l_colrec.l_status] = "Local Media"; Gtk::TreeModel::Row childrow = *(l_model->append(row.children())); childrow[l_colrec.l_icon] = Gdk::Pixbuf::create_from_file("music.png"); childrow[l_colrec.l_status] = "Music"; childrow = *(l_model->append(row.children())); childrow[l_colrec.l_icon] = Gdk::Pixbuf::create_from_file("video.png"); childrow[l_colrec.l_status] = "Videos"; row = *(l_model->append()); row[l_colrec.l_icon] = Gdk::Pixbuf::create_from_file("playlist.png"); row[l_colrec.l_status] = "Playlists"; l_treeview.append_column(" ", l_colrec.l_expander); l_treeview.append_column("Icon", l_colrec.l_icon); l_treeview.append_column("Actions", l_colrec.l_status); l_scroll.add(l_treeview); l_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //create mtl_scroll mtl_model = Gtk::ListStore::create(mtl_colrec); mtl_treeview.set_model(mtl_model); row = *(mtl_model->append()); row[mtl_colrec.mtl_artist] = "All Artists (0)"; mtl_treeview.append_column("Artists", mtl_colrec.mtl_artist); mtl_scroll.add(mtl_treeview); mtl_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //create mtr_scroll mtr_model = Gtk::ListStore::create(mtr_colrec); mtr_treeview.set_model(mtr_model); row = *(mtr_model->append()); row[mtr_colrec.mtr_album] = "All Albums (0)"; mtr_treeview.append_column("Albums", mtr_colrec.mtr_album); mtr_scroll.add(mtr_treeview); mtr_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //create rt_scroll rt_model = Gtk::ListStore::create(rt_colrec); rt_treeview.set_model(rt_model); row = *(rt_model->append()); row[rt_colrec.rt_artist] = "All Artists (0)"; rt_treeview.append_column("Artists", rt_colrec.rt_artist); rt_scroll.add(rt_treeview); rt_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //create rb_scroll rb_model = Gtk::ListStore::create(rb_colrec); rb_treeview.set_model(rb_model); row = *(rb_model->append()); row[rb_colrec.rb_album] = "All Albums (0)"; rb_treeview.append_column("Albums", rb_colrec.rb_album); rb_scroll.add(rb_treeview); rb_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //create mb_scroll mb_model = Gtk::ListStore::create(mb_colrec); mb_treeview.set_model(mb_model); mb_treeview.append_column(" ", mb_colrec.mb_status); mb_treeview.append_column("Name", mb_colrec.mb_name); mb_treeview.append_column("Artist", mb_colrec.mb_artist); mb_treeview.append_column("Album", mb_colrec.mb_album); mb_treeview.append_column("Time", mb_colrec.mb_time); mb_scroll.add(mb_treeview); mb_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); //pack all widgets in containers rvpaned.pack1(rt_scroll, Gtk::SHRINK); rvpaned.pack2(rb_scroll, Gtk::SHRINK); submhpaned.pack1(mtl_scroll, Gtk::SHRINK); submhpaned.pack2(mtr_scroll, Gtk::SHRINK); mhpaned.pack1(videoarea, Gtk::EXPAND); mhpaned.pack2(submhpaned, Gtk::EXPAND); mvpaned.pack1(mhpaned, Gtk::FILL); mvpaned.pack2(mb_scroll, Gtk::FILL); subhpaned.pack1(mvpaned, Gtk::FILL); subhpaned.pack2(rvpaned, Gtk::SHRINK); tophpaned.pack1(l_scroll, Gtk::SHRINK); tophpaned.pack2(subhpaned, Gtk::EXPAND); topvbox.pack_start(controlhbox, Gtk::PACK_EXPAND_WIDGET); topvbox.pack_start(tophpaned, Gtk::PACK_EXPAND_WIDGET); topvbox.pack_start(infolabel, Gtk::PACK_EXPAND_WIDGET); add(topvbox); show_all_children(); submhpaned.hide(); } TopWin::~TopWin() {}
#include <gtkmm.h> #include <gtkmm/volumebutton.h> class TopWin : public Gtk::Window { public: TopWin(); virtual ~TopWin(); protected: //controlhbox's widgets Gtk::Button playbutton, nextbutton, prevbutton, repeatbutton, fullbutton; Gtk::VolumeButton volumebutton; Gtk::HBox controlhbox; Gtk::VBox seekvbox; Gtk::Label seeklabel; Gtk::Adjustment progress, volumeadj; Gtk::HScale hscale; Gtk::Entry searchbox; //l_scroll - l_treeview Gtk::TreeView l_treeview; Glib::RefPtr<Gtk::TreeStore> l_model; Gtk::ScrolledWindow l_scroll; class LColumnRecord : public Gtk::TreeModel::ColumnRecord { public: LColumnRecord() { add(l_expander); add(l_icon); add(l_status); } Gtk::TreeModelColumn<Glib::ustring> l_expander; Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > l_icon; Gtk::TreeModelColumn<Glib::ustring> l_status; }; LColumnRecord l_colrec; //mtl_scroll - mtl_treeview Gtk::TreeView mtl_treeview; Glib::RefPtr<Gtk::ListStore> mtl_model; Gtk::ScrolledWindow mtl_scroll; class MtlColumnRecord : public Gtk::TreeModel::ColumnRecord { public: MtlColumnRecord() { add(mtl_artist); } Gtk::TreeModelColumn<Glib::ustring> mtl_artist; }; MtlColumnRecord mtl_colrec; //mtr_scroll - mtr_treeview Gtk::TreeView mtr_treeview; Glib::RefPtr<Gtk::ListStore> mtr_model; Gtk::ScrolledWindow mtr_scroll; class MtrColumnRecord : public Gtk::TreeModel::ColumnRecord { public: MtrColumnRecord() { add(mtr_album); } Gtk::TreeModelColumn<Glib::ustring> mtr_album; }; MtrColumnRecord mtr_colrec; //rt_scroll - rt_treeview Gtk::TreeView rt_treeview; Glib::RefPtr<Gtk::ListStore> rt_model; Gtk::ScrolledWindow rt_scroll; class RtColumnRecord : public Gtk::TreeModel::ColumnRecord { public: RtColumnRecord() { add(rt_artist); } Gtk::TreeModelColumn<Glib::ustring> rt_artist; }; RtColumnRecord rt_colrec; //rb_scroll - rb_treeview Gtk::TreeView rb_treeview; Glib::RefPtr<Gtk::ListStore> rb_model; Gtk::ScrolledWindow rb_scroll; class RbColumnRecord : public Gtk::TreeModel::ColumnRecord { public: RbColumnRecord() { add(rb_album); } Gtk::TreeModelColumn<Glib::ustring> rb_album; }; RbColumnRecord rb_colrec; //mb_scroll - mb_treeview Gtk::TreeView mb_treeview; Glib::RefPtr<Gtk::ListStore> mb_model; Gtk::ScrolledWindow mb_scroll; class MbColumnRecord : public Gtk::TreeModel::ColumnRecord { public: MbColumnRecord() { add(mb_status); add(mb_name); add(mb_artist); add(mb_album); add(mb_time); } Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > mb_status; Gtk::TreeModelColumn<Glib::ustring> mb_name; Gtk::TreeModelColumn<Glib::ustring> mb_artist; Gtk::TreeModelColumn<Glib::ustring> mb_album; Gtk::TreeModelColumn<Glib::ustring> mb_time; }; MbColumnRecord mb_colrec; //videoarea Gtk::DrawingArea videoarea; //infolabel Gtk::Label infolabel; //paned Gtk::HPaned tophpaned, subhpaned, mhpaned, submhpaned; Gtk::VPaned mvpaned, rvpaned; Gtk::VBox topvbox; };
Attachment:
file-queue.png
Description: PNG image
Attachment:
music.png
Description: PNG image
Attachment:
now-playing.png
Description: PNG image
Attachment:
local-media.png
Description: PNG image
Attachment:
playlist.png
Description: PNG image
Attachment:
video.png
Description: PNG image