13 #include "popupinfo.h"
14 #include "workspace.h"
16 #include <tqpainter.h>
18 #include <tqdrawutil.h>
20 #include <tdeglobal.h>
22 #include <tdeconfig.h>
24 #include <tdelocale.h>
25 #include <tqapplication.h>
26 #include <tqdesktopwidget.h>
27 #include <kstringhandler.h>
28 #include <tdeglobalsettings.h>
32 namespace KWinInternal
35 PopupInfo::PopupInfo( Workspace* ws,
const char *name )
36 : TQWidget( 0, name ), workspace( ws )
42 connect(&m_delayedHideTimer, TQ_SIGNAL(timeout()),
this, TQ_SLOT(hide()));
51 PopupInfo::~PopupInfo()
59 void PopupInfo::reset()
61 TQRect r = workspace->screenGeometry( workspace->activeScreen());
63 int w = fontMetrics().width( m_infoString ) + 30;
66 (r.width()-w)/2 + r.x(), r.height()/2-fontMetrics().height()-10 + r.y(),
67 w, fontMetrics().height() + 20 );
74 void PopupInfo::paintEvent( TQPaintEvent* )
77 style().drawPrimitive( TQStyle::PE_Panel, &p, TQRect( 0, 0, width(), height() ),
78 colorGroup(), TQStyle::Style_Default );
87 void PopupInfo::paintContents()
90 TQRect r( 6, 6, width()-12, height()-12 );
92 p.fillRect( r, colorGroup().brush( TQColorGroup::Background ) );
102 p.drawText( r, AlignCenter, m_infoString );
105 void PopupInfo::hide()
107 m_delayedHideTimer.stop();
109 TQApplication::syncX();
111 while (XCheckTypedEvent (tqt_xdisplay(), EnterNotify, &otherEvent ) )
116 void PopupInfo::reconfigure()
118 TDEConfig * c(TDEGlobal::config());
119 c->setGroup(
"PopupInfo");
120 m_show = c->readBoolEntry(
"ShowPopup",
false );
121 m_delayTime = c->readNumEntry(
"PopupHideDelay", 350 );
124 void PopupInfo::showInfo(TQString infoString)
128 m_infoString = infoString;
140 m_delayedHideTimer.start(m_delayTime,
true);
146 #include "popupinfo.moc"