X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fwidget.cpp;h=48b647b71850b464bf8da56f102170d64bc8cf6e;hb=3f4817441626e1abb5556ae53c16746634a57ad9;hp=efb6155ef4a51d8fb4e69bde95323ea4e10c250d;hpb=9b29612d1cde85fee9b3f011e86a5cabe5dbcce3;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)