]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/root.cpp
Mark Entry for rebuild when cursor starts or stops blinking
[libs/gltk.git] / source / root.cpp
index 4a2d611d84c8c9692840fc9564325ff50389f8d1..64c7dd5548fa2af424df645ac414860221dfc482 100644 (file)
@@ -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,8 +144,10 @@ void Root::tick()
        }
 }
 
-void Root::render() const
+void Root::render()
 {
+       rebuild_hierarchy();
+
        GL::Bind bind_blend(GL::Blend::alpha());
 
        GL::Renderer renderer(&camera);
@@ -144,6 +155,11 @@ void Root::render() 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)
@@ -288,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();
 }