1 #include <msp/gl/framebuffer.h>
2 #include <msp/gltk/layout.h>
3 #include "buttondemo.h"
4 #include "dropdowndemo.h"
6 #include "toggledemo.h"
7 #include "widgetdemo.h"
12 WidgetDemo::WidgetDemo(int, char **):
14 resources("basic.skin"),
15 root(resources, window)
17 window.set_title("GLtk widget demo");
18 window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &WidgetDemo::exit), 0));
20 root.set_layout(new GLtk::Layout);
23 root.get_layout()->set_expand(selector, false, true);
25 add_demo("Button", new ButtonDemo);
26 add_demo("Dropdown", new DropdownDemo);
27 add_demo("Entry", new EntryDemo);
28 add_demo("Toggle", new ToggleDemo);
31 int WidgetDemo::main()
34 return Application::main();
37 void WidgetDemo::tick()
40 GL::Framebuffer::system().clear(GL::COLOR_BUFFER_BIT);
42 window.swap_buffers();
45 void WidgetDemo::add_demo(const string &title, GLtk::Panel *demo)
47 demo->set_visible(false);
49 root.get_layout()->add_constraint(*demo, GLtk::Layout::RIGHT_OF, selector);
50 root.get_layout()->set_expand(*demo, true, true);
52 selector.add_demo(title, demo);