model: Move the custom TreeModel from gui/ to lib/
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
b516afe832
commit
09af8d81d2
|
@ -4,7 +4,6 @@
|
|||
#ifndef OCARINA_H
|
||||
#define OCARINA_H
|
||||
|
||||
#include <core/queue.h>
|
||||
#include <lib/lib.h>
|
||||
|
||||
|
||||
|
@ -16,45 +15,6 @@ void collection_mgr_init();
|
|||
Gtk::Window *ocarina_init(int *, char ***);
|
||||
|
||||
|
||||
/* model.cpp */
|
||||
class QueueModel : public Gtk::TreeModel, public Glib::Object {
|
||||
private:
|
||||
void increment_stamp();
|
||||
void get_value_uint(Track *, int, Glib::ValueBase &) const;
|
||||
void get_value_str(Track *, int, Glib::ValueBase &) const;
|
||||
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;
|
||||
int iter_n_root_children_vfunc() const;
|
||||
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;
|
||||
Queue *queue;
|
||||
QueueModel(Queue *);
|
||||
|
||||
void on_row_inserted(unsigned int);
|
||||
void on_row_deleted(unsigned int);
|
||||
void on_row_changed(unsigned int);
|
||||
void on_path_selected(const Gtk::TreePath &);
|
||||
unsigned int iter_to_id(const Gtk::TreeIter &);
|
||||
unsigned int path_to_id(const Gtk::TreePath &);
|
||||
};
|
||||
|
||||
|
||||
/* gui.cpp */
|
||||
void enable_idle();
|
||||
void connect_button(const std::string &, void (*func)());
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define OCARINA_TABS_H
|
||||
|
||||
#include <lib/lib.h>
|
||||
#include <lib/model.h>
|
||||
#include <gui/ocarina.h>
|
||||
#include <core/queue.h>
|
||||
#include <set>
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2014 (c) Anna Schumaker.
|
||||
*/
|
||||
#ifndef OCARINA_LIB_MODEL_H
|
||||
#define OCARINA_LIB_MODEL_H
|
||||
|
||||
#include <core/queue.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
class QueueModel : public Gtk::TreeModel, public Glib::Object {
|
||||
private:
|
||||
void increment_stamp();
|
||||
void get_value_uint(Track *, int, Glib::ValueBase &) const;
|
||||
void get_value_str(Track *, int, Glib::ValueBase &) const;
|
||||
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;
|
||||
int iter_n_root_children_vfunc() const;
|
||||
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;
|
||||
Queue *queue;
|
||||
QueueModel(Queue *);
|
||||
|
||||
void on_row_inserted(unsigned int);
|
||||
void on_row_deleted(unsigned int);
|
||||
void on_row_changed(unsigned int);
|
||||
void on_path_selected(const Gtk::TreePath &);
|
||||
unsigned int iter_to_id(const Gtk::TreeIter &);
|
||||
unsigned int path_to_id(const Gtk::TreePath &);
|
||||
};
|
||||
|
||||
#endif /* OCARINA_LIB_MODEL_H */
|
|
@ -5,7 +5,7 @@
|
|||
* https://git.gnome.org/browse/gtkmm-documentation/tree/examples/others/treemodelcustom
|
||||
*/
|
||||
#include <core/audio.h>
|
||||
#include <gui/ocarina.h>
|
||||
#include <lib/model.h>
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
|
Loading…
Reference in New Issue