author | francesco-ST <francesco.abbate@st.com> | 2010年08月09日 15:50:43 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年08月09日 15:50:43 +0200 |
commit | 129604a18b0f93e89cf638a079b6f1ab349fbe8f (patch) | |
tree | 8abeb52bc7a01472ba505aebaa36fb2ef1765646 /agg-plot/window-cpp.h | |
parent | 99c6c9b47f25eb7bc8756d5b2a5fd5ec7dac73e6 (diff) | |
download | gsl-shell-129604a18b0f93e89cf638a079b6f1ab349fbe8f.tar.gz |
-rw-r--r-- | agg-plot/window-cpp.h | 70 |
diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h new file mode 100644 index 00000000..1c09ad69 --- /dev/null +++ b/agg-plot/window-cpp.h @@ -0,0 +1,70 @@ + +extern "C" { +#include "lua.h" +} + +#include "window.h" +#include "canvas-window-cpp.h" +#include "resource-manager.h" +#include "lua-plot-cpp.h" +#include "plot.h" +#include "drawable.h" + +#include "agg_color_rgba.h" +#include "agg_trans_affine.h" + +template <class T> +class pod_list { + T m_content; + pod_list *m_next; + +public: + pod_list(const T& c, pod_list* next = NULL) : m_content(c), m_next(next) { }; + + void free_subtree() + { + if (m_next) + { + m_next->free_subtree(); + delete m_next; + } + }; + + T& content() { return m_content; }; + const T& content() const { return m_content; }; + + pod_list *next() { return m_next; }; + + static void free(pod_list *list); +}; + +template <class T> +void pod_list<T>::free(pod_list<T> *list) +{ + list->free_subtree(); + delete list; +} + +class window : public canvas_window { + typedef plot<drawable, lua_management> plot_type; + + struct plot_matrix { + plot_type *plot; + agg::trans_affine matrix; + + plot_matrix(plot_type *p) : plot(p), matrix() {}; + }; + + pod_list<plot_matrix> *m_plot_matrix; + +public: + window(agg::rgba& bgcol) : canvas_window(bgcol), m_plot_matrix(NULL) {}; + + static window *check (lua_State *L, int index); + + void split3(); + bool attach(lua_plot *plot, int slot); + + void on_draw_unprotected(); + virtual void on_draw(); +}; |