• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • twin
 

twin

  • twin
popupinfo.cpp
1/*****************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6Copyright (C) 2002 Alexander Kellett <lypanov@kde.org>
7Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
8
9You can Freely distribute this program under the GNU General Public
10License. See the file "COPYING" for the exact licensing terms.
11******************************************************************/
12
13#include "popupinfo.h"
14#include "workspace.h"
15#include "client.h"
16#include <tqpainter.h>
17#include <tqlabel.h>
18#include <tqdrawutil.h>
19#include <tqstyle.h>
20#include <tdeglobal.h>
21#include <fixx11h.h>
22#include <tdeconfig.h>
23#include <kdebug.h>
24#include <tdelocale.h>
25#include <tqapplication.h>
26#include <tqdesktopwidget.h>
27#include <kstringhandler.h>
28#include <tdeglobalsettings.h>
29
30// specify externals before namespace
31
32namespace KWinInternal
33{
34
35PopupInfo::PopupInfo( Workspace* ws, const char *name )
36 : TQWidget( 0, name ), workspace( ws )
37 {
38 m_infoString = "";
39 m_shown = false;
40 reset();
41 reconfigure();
42 connect(&m_delayedHideTimer, TQ_SIGNAL(timeout()), this, TQ_SLOT(hide()));
43
44 TQFont f = font();
45 f.setBold( TRUE );
46 f.setPointSize( 14 );
47 setFont( f );
48
49 }
50
51PopupInfo::~PopupInfo()
52 {
53 }
54
55
59void PopupInfo::reset()
60 {
61 TQRect r = workspace->screenGeometry( workspace->activeScreen());
62
63 int w = fontMetrics().width( m_infoString ) + 30;
64
65 setGeometry(
66 (r.width()-w)/2 + r.x(), r.height()/2-fontMetrics().height()-10 + r.y(),
67 w, fontMetrics().height() + 20 );
68 }
69
70
74void PopupInfo::paintEvent( TQPaintEvent* )
75 {
76 TQPainter p( this );
77 style().drawPrimitive( TQStyle::PE_Panel, &p, TQRect( 0, 0, width(), height() ),
78 colorGroup(), TQStyle::Style_Default );
79 paintContents();
80 }
81
82
87void PopupInfo::paintContents()
88 {
89 TQPainter p( this );
90 TQRect r( 6, 6, width()-12, height()-12 );
91
92 p.fillRect( r, colorGroup().brush( TQColorGroup::Background ) );
93
94 /*
95 p.setPen(TQt::white);
96 p.drawText( r, AlignCenter, m_infoString );
97 p.setPen(TQt::black);
98 r.moveBy( -1, -1 );
99 p.drawText( r, AlignCenter, m_infoString );
100 r.moveBy( -1, 0 );
101 */
102 p.drawText( r, AlignCenter, m_infoString );
103 }
104
105void PopupInfo::hide()
106 {
107 m_delayedHideTimer.stop();
108 TQWidget::hide();
109 TQApplication::syncX();
110 XEvent otherEvent;
111 while (XCheckTypedEvent (tqt_xdisplay(), EnterNotify, &otherEvent ) )
112 ;
113 m_shown = false;
114 }
115
116void PopupInfo::reconfigure()
117 {
118 TDEConfig * c(TDEGlobal::config());
119 c->setGroup("PopupInfo");
120 m_show = c->readBoolEntry("ShowPopup", false );
121 m_delayTime = c->readNumEntry("PopupHideDelay", 350 );
122 }
123
124void PopupInfo::showInfo(TQString infoString)
125 {
126 if (m_show)
127 {
128 m_infoString = infoString;
129 reset();
130 if (m_shown)
131 {
132 paintContents();
133 }
134 else
135 {
136 show();
137 raise();
138 m_shown = true;
139 }
140 m_delayedHideTimer.start(m_delayTime, true);
141 }
142 }
143
144} // namespace
145
146#include "popupinfo.moc"

twin

Skip menu "twin"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members

twin

Skip menu "twin"
  • kate
  • libkonq
  • twin
  •   lib
Generated for twin by doxygen 1.9.4
This website is maintained by Timothy Pearson.