X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Froot.cpp;h=64c7dd5548fa2af424df645ac414860221dfc482;hb=ab9fd8084f8bf8770d8d968354550cb2df99192f;hp=e9e62f6785c3a203914dfb10594d1a0db74c812d;hpb=f8f2f18e886429b70325ff36989bb126de617716;p=libs%2Fgltk.git diff --git a/source/root.cpp b/source/root.cpp index e9e62f6..64c7dd5 100644 --- a/source/root.cpp +++ b/source/root.cpp @@ -1,9 +1,9 @@ #include #include #include +#include #include #include -#include #include #include "label.h" #include "style.h" @@ -58,6 +58,9 @@ void Root::init(Graphics::Window *window) else shprog = 0; + if(keyboard) + set_state(FOCUS); + update_style(); if(mouse) @@ -91,6 +94,12 @@ Root::~Root() void Root::tick() { + Time::TimeStamp t = Time::now(); + Time::TimeDelta dt = (last_tick ? t-last_tick : Time::zero); + last_tick = t; + + animate(dt); + if(tooltip_timeout && Time::now()>tooltip_timeout) { std::string tip; @@ -135,10 +144,9 @@ void Root::tick() } } -void Root::render(const GL::Tag &tag) const +void Root::render() { - if(tag.id) - return; + rebuild_hierarchy(); GL::Bind bind_blend(GL::Blend::alpha()); @@ -147,13 +155,22 @@ void Root::render(const GL::Tag &tag) const Widget::render(renderer); } +void Root::setup_frame(GL::Renderer &) +{ + rebuild_hierarchy(); +} + void Root::render(GL::Renderer &renderer, const GL::Tag &tag) const { if(tag.id) return; - renderer.end(); - render(tag); + GL::Renderer::Push push(renderer); + renderer.set_camera(camera); + renderer.set_shader_program(shprog); + GL::BindRestore bind_blend(GL::Blend::alpha()); + GL::BindRestore unbind_dtest(static_cast(0)); + Widget::render(renderer); } bool Root::button_press_event(unsigned btn) @@ -287,9 +304,9 @@ void Root::update_camera() camera.set_orthographic(geom.w, geom.h); } -void Root::on_geometry_change() +void Root::on_size_change() { - Panel::on_geometry_change(); + Panel::on_size_change(); update_camera(); }