]> git.tdb.fi Git - libs/gltk.git/blobdiff - examples/widgetdemo/demoselector.h
Add another example application to demonstrate various widgets
[libs/gltk.git] / examples / widgetdemo / demoselector.h
diff --git a/examples/widgetdemo/demoselector.h b/examples/widgetdemo/demoselector.h
new file mode 100644 (file)
index 0000000..96cfbac
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef DEMOSELECTOR_H_
+#define DEMOSELECTOR_H_
+
+#include <msp/gltk/list.h>
+#include <msp/gltk/panel.h>
+
+class DemoSelector: public Msp::GLtk::Panel
+{
+private:
+       struct Demo
+       {
+               std::string title;
+               Msp::GLtk::Panel *panel;
+       };
+
+       Msp::GLtk::List list;
+       Msp::GLtk::FunctionListData<Demo> demos;
+       const Demo *current_demo;
+
+public:
+       DemoSelector();
+
+       void add_demo(const std::string &, Msp::GLtk::Panel *);
+private:
+       void item_selected(unsigned);
+
+       static std::string get_demo_title(const Demo &);
+};
+
+#endif