#ifndef __N_SLEEP_HISTORY_H #define __N_SLEEP_HISTORY_H #include #include #include #include #include #include "db.h" namespace napkin { namespace gtk { using std::string; class sleep_history_t : public Gtk::ScrolledWindow { public: class basic_textrenderer : public Gtk::CellRendererText { public: basic_textrenderer(); void render_vfunc( const Glib::RefPtr& window, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, const Gdk::Rectangle& expose_area, Gtk::CellRendererState flags); virtual const string get_text(const hypnodata_t& hd) const = 0; }; class date_render_t : public basic_textrenderer { public: const string get_text(const hypnodata_t& hd) const; }; class tobed_render_t : public basic_textrenderer { public: const string get_text(const hypnodata_t& hd) const; }; class alarm_render_t : public basic_textrenderer { public: const string get_text(const hypnodata_t& hd) const; }; class window_render_t : public basic_textrenderer { public: window_render_t(); const string get_text(const hypnodata_t& hd) const; }; class nawakes_render_t : public basic_textrenderer { public: nawakes_render_t(); const string get_text(const hypnodata_t& hd) const; }; class data_a_render_t : public basic_textrenderer { public: const string get_text(const hypnodata_t& hd) const; }; class sleep_timeline_render_t : public Gtk::CellRenderer { public: const sleep_history_t& sleep_history; sleep_timeline_render_t(const sleep_history_t& sh); void render_vfunc(const Glib::RefPtr& window, Gtk::Widget&/*widget*/, const Gdk::Rectangle&/*background_area*/, const Gdk::Rectangle& cell_area, const Gdk::Rectangle&/*expose_area*/, Gtk::CellRendererState/*flags*/); }; class columns_t : public Gtk::TreeModel::ColumnRecord { public: Gtk::TreeModelColumn c_hypnodata; Gtk::TreeModelColumn c_hypnodata_ptr; columns_t() { add(c_hypnodata); add(c_hypnodata_ptr); } }; columns_t cols; Gtk::TreeView w_tree; Glib::RefPtr store; date_render_t r_date; tobed_render_t r_to_bed; alarm_render_t r_alarm; window_render_t r_window; nawakes_render_t r_nawakes; data_a_render_t r_data_a; sleep_timeline_render_t r_sleep_timeline; Gtk::TreeView::Column *c_timeline; sigc::signal double_click_signal; sigc::signal& signal_double_click() { return double_click_signal; } time_t min_tobed, max_alarm; db_t& db; sleep_history_t(db_t& d); Gtk::TreeView::Column *append_c(const string& title,Gtk::CellRenderer& renderer); bool on_button_press(GdkEventButton* geb); bool on_query_tooltip(int x,int y,bool keyboard_tooltip, const Glib::RefPtr& tooltip); void set_data(list data); Glib::SignalProxy0 signal_cursor_changed() { return w_tree.signal_cursor_changed(); } const hypnodata_ptr_t get_current(); }; } } #endif /* __N_SLEEP_HISTORY_H */