Create widget in pure C++

Can anyone provide a fully working code?