X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=inline;f=source%2Fwidget.cpp;h=48b647b71850b464bf8da56f102170d64bc8cf6e;hb=aba0416fb73e17d068b30ff163c2fedcb0254da2;hp=efb6155ef4a51d8fb4e69bde95323ea4e10c250d;hpb=94ac63c6f41227ce57790d9903039ec18a6ef3fd;p=libs%2Fgltk.git diff --git a/source/widget.cpp b/source/widget.cpp index efb6155..48b647b 100644 --- a/source/widget.cpp +++ b/source/widget.cpp @@ -69,6 +69,16 @@ void Widget::set_visible(bool v) parent->child_hidden(*this); } +void Widget::set_focus() +{ + if(!parent) + throw InvalidState("No parent"); + if(!visible) + throw InvalidState("Can't set focus on invisible widget"); + + parent->grab_focus(*this); +} + void Widget::render() const { if(!style)