2014-01-05 22:10:02 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2014 (c) Anna Schumaker.
|
|
|
|
*/
|
|
|
|
#ifndef OCARINA_H
|
|
|
|
#define OCARINA_H
|
|
|
|
|
2014-04-01 20:28:19 -04:00
|
|
|
#include <queue.h>
|
2014-01-05 22:10:02 -05:00
|
|
|
#include <gtkmm.h>
|
2014-01-20 20:14:22 -05:00
|
|
|
|
2014-02-17 15:47:19 -05:00
|
|
|
|
2014-02-17 10:42:38 -05:00
|
|
|
/* collection_mgr.cpp */
|
|
|
|
void collection_mgr_init();
|
|
|
|
|
2014-02-17 15:32:47 -05:00
|
|
|
|
2014-01-20 20:14:22 -05:00
|
|
|
/* main.cpp */
|
2014-03-01 17:39:00 -05:00
|
|
|
const std::string share_file(const std::string &);
|
2014-01-22 22:31:42 -05:00
|
|
|
Gtk::Window *ocarina_init(int *, char ***);
|
2014-01-20 20:14:22 -05:00
|
|
|
|
2014-02-17 15:32:47 -05:00
|
|
|
|
2014-01-20 19:06:52 -05:00
|
|
|
/* model.cpp */
|
2014-04-01 20:28:19 -04:00
|
|
|
class QueueModel : public Gtk::TreeModel, public Glib::Object {
|
2014-01-20 19:06:52 -05:00
|
|
|
private:
|
2014-02-01 16:44:01 -05:00
|
|
|
void increment_stamp();
|
2014-03-29 11:44:39 -04:00
|
|
|
void get_value_uint(Track *, int, Glib::ValueBase &) const;
|
|
|
|
void get_value_str(Track *, int, Glib::ValueBase &) const;
|
2014-01-20 19:06:52 -05:00
|
|
|
bool check_iter_validity(const Gtk::TreeIter &) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/* Inherited from Gtk::TreeModel */
|
|
|
|
Gtk::TreeModelFlags get_flags_vfunc() const;
|
|
|
|
int get_n_columns_vfunc() const;
|
|
|
|
GType get_column_type_vfunc(int) const;
|
|
|
|
void get_value_vfunc(const Gtk::TreeIter &, int, Glib::ValueBase &) const;
|
|
|
|
bool iter_next_vfunc(const Gtk::TreeIter &, Gtk::TreeIter &) const;
|
|
|
|
bool iter_children_vfunc(const Gtk::TreeIter &, Gtk::TreeIter &) const;
|
|
|
|
bool iter_has_child_vfunc(const Gtk::TreeIter &) const;
|
|
|
|
int iter_n_children_vfunc(const Gtk::TreeIter &) const;
|
2014-02-01 16:44:01 -05:00
|
|
|
int iter_n_root_children_vfunc() const;
|
2014-01-20 19:06:52 -05:00
|
|
|
bool iter_nth_child_vfunc(const Gtk::TreeIter &, int, Gtk::TreeIter &) const;
|
|
|
|
bool iter_nth_root_child_vfunc(int, Gtk::TreeIter &) const;
|
|
|
|
bool iter_parent_vfunc(const Gtk::TreeIter &, Gtk::TreeIter &) const;
|
|
|
|
Gtk::TreeModel::Path get_path_vfunc(const Gtk::TreeIter &) const;
|
|
|
|
bool get_iter_vfunc(const Gtk::TreePath &, Gtk::TreeIter &) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
int stamp;
|
2014-04-01 20:28:19 -04:00
|
|
|
Queue *queue;
|
|
|
|
QueueModel(Queue *);
|
2014-01-20 19:06:52 -05:00
|
|
|
|
|
|
|
void on_row_inserted(unsigned int);
|
|
|
|
void on_row_deleted(unsigned int);
|
2014-01-26 13:45:59 -05:00
|
|
|
void on_row_changed(unsigned int);
|
2014-01-26 12:44:48 -05:00
|
|
|
void on_path_selected(const Gtk::TreePath &);
|
2014-02-01 17:30:07 -05:00
|
|
|
unsigned int iter_to_id(const Gtk::TreeIter &);
|
2014-02-02 10:45:09 -05:00
|
|
|
unsigned int path_to_id(const Gtk::TreePath &);
|
2014-01-20 19:06:52 -05:00
|
|
|
};
|
2014-01-05 22:10:02 -05:00
|
|
|
|
2014-02-17 15:32:47 -05:00
|
|
|
|
2014-03-01 17:49:47 -05:00
|
|
|
/* gui.cpp */
|
2014-02-17 10:42:38 -05:00
|
|
|
void enable_idle();
|
|
|
|
void connect_button(const std::string &, void (*func)());
|
2014-03-01 17:49:47 -05:00
|
|
|
Gtk::Window *setup_gui();
|
2014-01-12 13:05:02 -05:00
|
|
|
Glib::RefPtr<Gtk::Builder> &get_builder();
|
2014-01-05 22:10:02 -05:00
|
|
|
|
2014-02-17 10:13:25 -05:00
|
|
|
template <class T>
|
|
|
|
static T *get_widget(const std::string &name)
|
|
|
|
{
|
|
|
|
T *widget;
|
|
|
|
get_builder()->get_widget(name, widget);
|
|
|
|
return widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
static Glib::RefPtr<T> get_object(const std::string &name)
|
|
|
|
{
|
|
|
|
return Glib::RefPtr<T>::cast_static(get_builder()->get_object(name));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-18 12:53:31 -05:00
|
|
|
#ifdef CONFIG_TEST
|
|
|
|
void do_collection_delete();
|
|
|
|
void on_collection_toggled(const Glib::ustring &);
|
|
|
|
#endif /* CONFIG_TEST */
|
|
|
|
|
2014-01-05 22:10:02 -05:00
|
|
|
#endif /* OCARINA_H */
|