19 #include "tdemdifocuslist.h"
20 #include "tdemdifocuslist.moc"
21 #include <tqobjectlist.h>
24 KMdiFocusList::KMdiFocusList( TQObject *parent ) : TQObject( parent )
27 KMdiFocusList::~KMdiFocusList()
30 void KMdiFocusList::addWidgetTree( TQWidget* w )
33 m_list.insert( w, w->focusPolicy() );
34 w->setFocusPolicy( TQWidget::ClickFocus );
35 kdDebug( 760 ) <<
"KMdiFocusList::addWidgetTree: adding toplevel" << endl;
36 connect( w, TQ_SIGNAL( destroyed( TQObject * ) ),
this, TQ_SLOT( objectHasBeenDestroyed( TQObject* ) ) );
37 TQObjectList *l = w->queryList(
"TQWidget" );
38 TQObjectListIt it( *l );
40 while ( ( obj = it.current() ) != 0 )
42 TQWidget * wid = ( TQWidget* ) obj;
43 m_list.insert( wid, wid->focusPolicy() );
44 wid->setFocusPolicy( TQWidget::ClickFocus );
45 kdDebug( 760 ) <<
"KMdiFocusList::addWidgetTree: adding widget" << endl;
46 connect( wid, TQ_SIGNAL( destroyed( TQObject * ) ),
this, TQ_SLOT( objectHasBeenDestroyed( TQObject* ) ) );
52 void KMdiFocusList::restore()
54 for ( TQMap<TQWidget*, TQWidget::FocusPolicy>::const_iterator it = m_list.constBegin();it != m_list.constEnd();++it )
56 it.key() ->setFocusPolicy( it.data() );
62 void KMdiFocusList::objectHasBeenDestroyed( TQObject * o )
64 if ( !o || !o->isWidgetType() )
66 TQWidget *w = ( TQWidget* ) o;