]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/widget.cpp
Add key events
[libs/gltk.git] / source / widget.cpp
index 48ae0eda4b042b3e4096a2d7f494d3ea77db2e44..7f153eb5540e4462bfa57645fab2b113cfb06a8b 100644 (file)
@@ -44,28 +44,6 @@ void Widget::render() const
        GL::pop_matrix();
 }
 
-bool Widget::button_press(int x, int y, unsigned btn)
-{
-       if(x>=geom.x && y>=geom.y && x<geom.x+static_cast<int>(geom.w) && y<geom.y+static_cast<int>(geom.h))
-       {
-               on_button_press(x, y, btn);
-               return true;
-       }
-
-       return false;
-}
-
-bool Widget::button_release(int x, int y, unsigned btn)
-{
-       if(x>=geom.x && y>=geom.y && x<geom.x+static_cast<int>(geom.w) && y<geom.y+static_cast<int>(geom.h))
-       {
-               on_button_release(x, y, btn);
-               return true;
-       }
-
-       return false;
-}
-
 Widget::Widget(const Resources &r):
        res(r),
        style(0),
@@ -98,7 +76,7 @@ void Widget::render_text(const Part &part, const string &text) const
 
        GL::push_matrix();
 
-       part.get_alignment().apply(geom, text_w, static_cast<unsigned>(font_size));
+       part.get_alignment().apply(geom, text_w, static_cast<unsigned>(font->get_ascent()*font_size));
        GL::scale_uniform(font_size);
 
        const Color &color=style->get_font_color();