2 * Copyright (c) 2007 Jeff Mitchell <kde-dev@emailgoeshere.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "PopupDropper.h"
23 #include "contextview/contextview.h"
24 #include "PopupDropperScene.h"
25 #include "PopupDropperView.h"
30 static bool ENABLED
= true;
32 using namespace PopupDropperNS
;
34 PopupDropper
* PopupDropper::s_instance
= 0;
37 PopupDropper::instance()
39 static PopupDropper pd
;
43 PopupDropper::PopupDropper() : QObject()
46 , m_enabled( ENABLED
)
47 , m_initialized( false )
53 PopupDropper::~PopupDropper()
56 //m_scene.setPDV( 0 );
62 PopupDropper::initialize( QWidget
* window
)
67 m_scene
.setParent( window
);
68 m_scene
.setSceneRect( QRectF( window
->rect() ) );
69 m_view
= new PopupDropperView( &m_scene
, window
);
70 m_scene
.setPDV( m_view
);
75 PopupDropper::create()
79 initialize( ContextView::instance() );
80 if( !m_scene
.isShown() )
82 const QWidget
*parent
= static_cast<QWidget
*>( m_scene
.parent() );
83 m_scene
.setSceneRect( QRectF( parent
->rect() ) );
84 m_view
->resize( parent
->size() + QSize( 2, 2 ) );
90 PopupDropper::destroy()
93 if( m_scene
.isShown() )
98 PopupDropperNS::PopupDropper
* PopupDropper() { return PopupDropperNS::PopupDropper::instance(); }
101 #include "PopupDropper.moc"