summaryrefslogtreecommitdiff
path: root/noncore/applets/pyquicklaunch/pyquicklaunch.cpp
Unidiff
Diffstat (limited to 'noncore/applets/pyquicklaunch/pyquicklaunch.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/pyquicklaunch/pyquicklaunch.cpp109
1 files changed, 109 insertions, 0 deletions
diff --git a/noncore/applets/pyquicklaunch/pyquicklaunch.cpp b/noncore/applets/pyquicklaunch/pyquicklaunch.cpp
new file mode 100644
index 0000000..2ee8e17
--- a/dev/null
+++ b/noncore/applets/pyquicklaunch/pyquicklaunch.cpp
@@ -0,0 +1,109 @@
1/**********************************************************************
2** Copyright (C) 2004 Michael 'Mickey' Lauer <mickey@vanille.de>
3** All rights reserved.
4**
5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13**********************************************************************/
14
15#include "pyquicklaunch.h"
16
17/* OPIE */
18#include <opie2/odebug.h>
19#include <opie2/otaskbarapplet.h>
20#include <qpe/qpeapplication.h>
21#include <qpe/config.h>
22using namespace Opie::Core;
23
24/* QT */
25#include <qpainter.h>
26#include <qframe.h>
27
28PyQuicklaunchControl::PyQuicklaunchControl( PyQuicklaunchApplet *applet, QWidget *parent, const char *name )
29 : QFrame( parent, name, WStyle_StaysOnTop | WType_Popup ), applet( applet )
30{
31
32 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
33 setFixedSize( sizeHint() );
34 setFocusPolicy( QWidget::NoFocus );
35}
36
37
38void PyQuicklaunchControl::show( bool )
39{
40 QPoint curPos = applet->mapToGlobal( QPoint ( 0, 0 ) );
41
42 int w = sizeHint().width();
43 int x = curPos.x() - ( w / 2 );
44
45 if ( ( x + w ) > QPEApplication::desktop() ->width() )
46 x = QPEApplication::desktop ( ) -> width ( ) - w;
47
48 move( x, curPos.y () - sizeHint().height () );
49 QFrame::show();
50}
51
52void PyQuicklaunchControl::readConfig()
53{
54 Config cfg( "qpe" );
55 cfg.setGroup( "PyQuicklaunch" );
56
57 // ...
58}
59
60void PyQuicklaunchControl::writeConfigEntry( const char *entry, int val )
61{
62 Config cfg( "qpe" );
63 cfg.setGroup( "PyQuicklaunch" );
64 cfg.writeEntry( entry, val );
65}
66
67//===========================================================================
68
69PyQuicklaunchApplet::PyQuicklaunchApplet( QWidget *parent, const char *name )
70 : QWidget( parent, name )
71{
72 setFixedHeight( 18 );
73 setFixedWidth( 14 );
74 status = new PyQuicklaunchControl( this, this, "Python Quicklaunch Status" );
75}
76
77
78PyQuicklaunchApplet::~PyQuicklaunchApplet()
79{}
80
81
82void PyQuicklaunchApplet::timerEvent( QTimerEvent* )
83{
84 // FIXME
85}
86
87void PyQuicklaunchApplet::mousePressEvent( QMouseEvent * )
88{
89 status->isVisible() ? status->hide() : status->show( true );
90}
91
92void PyQuicklaunchApplet::paintEvent( QPaintEvent* )
93{
94 QPainter p( this );
95 int h = height();
96 int w = width();
97
98 // FIXME
99
100}
101
102
103int PyQuicklaunchApplet::position()
104{
105 return 6;
106}
107
108EXPORT_OPIE_APPLET_v1( PyQuicklaunchApplet )
109