14 #include "popupinfo.h"
15 #include "workspace.h"
17 #include <tqpainter.h>
19 #include <tqdrawutil.h>
21 #include <tdeglobal.h>
23 #include <tdeconfig.h>
25 #include <tdelocale.h>
26 #include <tqapplication.h>
27 #include <tqdesktopwidget.h>
28 #include <kstringhandler.h>
29 #include <tdeglobalsettings.h>
33 namespace KWinInternal
36 PopupInfo::PopupInfo( Workspace* ws,
const char *name )
37 : TQWidget( 0, name ), workspace( ws )
43 connect(&m_delayedHideTimer, TQT_SIGNAL(timeout()),
this, TQT_SLOT(hide()));
52 PopupInfo::~PopupInfo()
60 void PopupInfo::reset()
62 TQRect r = workspace->screenGeometry( workspace->activeScreen());
64 int w = fontMetrics().width( m_infoString ) + 30;
67 (r.width()-w)/2 + r.x(), r.height()/2-fontMetrics().height()-10 + r.y(),
68 w, fontMetrics().height() + 20 );
75 void PopupInfo::paintEvent( TQPaintEvent* )
78 style().tqdrawPrimitive( TQStyle::PE_Panel, &p, TQRect( 0, 0, width(), height() ),
79 colorGroup(), TQStyle::Style_Default );
88 void PopupInfo::paintContents()
91 TQRect r( 6, 6, width()-12, height()-12 );
93 p.fillRect( r, colorGroup().brush( TQColorGroup::Background ) );
103 p.drawText( r, AlignCenter, m_infoString );
106 void PopupInfo::hide()
108 m_delayedHideTimer.stop();
110 TQApplication::syncX();
112 while (XCheckTypedEvent (tqt_xdisplay(), EnterNotify, &otherEvent ) )
117 void PopupInfo::reconfigure()
119 TDEConfig * c(TDEGlobal::config());
120 c->setGroup(
"PopupInfo");
121 m_show = c->readBoolEntry(
"ShowPopup",
false );
122 m_delayTime = c->readNumEntry(
"PopupHideDelay", 350 );
125 void PopupInfo::showInfo(TQString infoString)
129 m_infoString = infoString;
141 m_delayedHideTimer.start(m_delayTime,
true);
147 #include "popupinfo.moc"