X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbutton.cpp;h=fadd00a0cafedc4dd0d1996f8be7a0ec6ae8fdaf;hb=cfb830ca263defc307f9cfac74fb6771f6b7bfc6;hp=8fd2de6cb02e2abbb15d4b41035d71b551e88ebf;hpb=b61361ee9f1f049fb3c22a38f68c757c7ca54cd0;p=libs%2Fgltk.git diff --git a/source/button.cpp b/source/button.cpp index 8fd2de6..fadd00a 100644 --- a/source/button.cpp +++ b/source/button.cpp @@ -13,10 +13,11 @@ Button::Button(const std::string &t): icon(0), pressed(false) { + input_type = INPUT_NAVIGATION; set_text(t); } -void Button::autosize_special(const Part &part, Geometry &ageom) +void Button::autosize_special(const Part &part, Geometry &ageom) const { if(part.get_name()=="text") text.autosize(part, ageom); @@ -56,15 +57,15 @@ void Button::rebuild_special(const Part &part) GL::MeshBuilder bld(part_cache.create_mesh(part, *icon)); bld.color(1.0f, 1.0f, 1.0f); - bld.begin(GL::QUADS); + bld.begin(GL::TRIANGLE_STRIP); + bld.texcoord(0, 1); + bld.vertex(rgeom.x, rgeom.y+rgeom.h); bld.texcoord(0, 0); bld.vertex(rgeom.x, rgeom.y); - bld.texcoord(1, 0); - bld.vertex(rgeom.x+rgeom.w, rgeom.y); bld.texcoord(1, 1); bld.vertex(rgeom.x+rgeom.w, rgeom.y+rgeom.h); - bld.texcoord(0, 1); - bld.vertex(rgeom.x, rgeom.y+rgeom.h); + bld.texcoord(1, 0); + bld.vertex(rgeom.x+rgeom.w, rgeom.y); bld.end(); } } @@ -102,6 +103,16 @@ void Button::pointer_motion(int x, int y) } } +bool Button::navigate(Navigation nav) +{ + if(nav==NAV_ACTIVATE) + signal_clicked.emit(); + else + return false; + + return true; +} + void Button::on_style_change() { text.set_style(style);