-rw-r--r-- | core/launcher/sidething.cpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/core/launcher/sidething.cpp b/core/launcher/sidething.cpp new file mode 100644 index 0000000..821c9d5 --- a/dev/null +++ b/core/launcher/sidething.cpp | |||
@@ -0,0 +1,75 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include "sidething.h" | ||
22 | |||
23 | #include <qpe/resource.h> | ||
24 | |||
25 | #include <qrect.h> | ||
26 | #include <qpopupmenu.h> | ||
27 | #include <qpainter.h> | ||
28 | |||
29 | |||
30 | void PopupWithLaunchSideThing::setFrameRect( const QRect &r ) | ||
31 | { | ||
32 | fr = r; | ||
33 | QPopupMenu::setFrameRect( r ); | ||
34 | } | ||
35 | |||
36 | |||
37 | void PopupWithLaunchSideThing::paintEvent( QPaintEvent *event ) | ||
38 | { | ||
39 | QPainter paint( this ); | ||
40 | |||
41 | if ( !contentsRect().contains( event->rect() ) ) { | ||
42 | |||
43 | QPopupMenu::setFrameRect( fr ); | ||
44 | int oldLW = lineWidth(); | ||
45 | setUpdatesEnabled(FALSE); | ||
46 | setLineWidth(oldLW); | ||
47 | setUpdatesEnabled(TRUE); | ||
48 | |||
49 | paint.save(); | ||
50 | paint.setClipRegion( event->region().intersect( frameRect() ) ); | ||
51 | QPixmap pm( Resource::loadPixmap( sidePixmap ) ); | ||
52 | paint.drawPixmap( 2, fr.height() - pm.height() - 2, pm ); | ||
53 | //Need to draw a filled rectangle that extends the colour from the | ||
54 | //end of the pixmap up to the top of the popupmenu | ||
55 | //paint.fillRect(); | ||
56 | drawFrame( &paint ); | ||
57 | paint.restore(); | ||
58 | |||
59 | } | ||
60 | if ( event->rect().intersects( contentsRect() ) /* && | ||
61 | (fstyle & MShape) != HLine && (fstyle & MShape) != VLine */ ) { | ||
62 | |||
63 | QPopupMenu::setFrameRect( QRect(fr.left() + 21, fr.top(), fr.width() - 21, fr.height()) ); | ||
64 | int oldLW = lineWidth(); | ||
65 | setUpdatesEnabled(FALSE); | ||
66 | setLineWidth(oldLW); | ||
67 | setUpdatesEnabled(TRUE); | ||
68 | |||
69 | paint.setClipRegion( event->region().intersect( contentsRect() ) ); | ||
70 | drawContents( &paint ); | ||
71 | } | ||
72 | |||
73 | } | ||
74 | |||
75 | |||