Add scoped pointer class; use it on some widget classes