Fix some error
[kdeartwork.git] / kwin-styles / riscos / MaximiseButton.cpp
blobccb97293e49f3b9b744a7359a04767a1e6b3922a
1 /*
2 RISC OS KWin client
4 Copyright 2000
5 Rik Hemsley <rik@kde.org>
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #include "MaximiseButton.h"
25 #include <qtooltip.h>
26 //Added by qt3to4:
27 #include <QPixmap>
28 #include <QMouseEvent>
30 namespace RiscOS
33 /* XPM */
34 static const char * const maximise_xpm[] = {
35 "12 12 3 1",
36 " c None",
37 ". c #000000",
38 "+ c #FFFFFF",
39 " ",
40 " ........ ",
41 " .++++++++. ",
42 " .++++++++. ",
43 " .++++++++. ",
44 " .++++++++. ",
45 " .++++++++. ",
46 " .++++++++. ",
47 " .++++++++. ",
48 " .++++++++. ",
49 " ........ ",
50 " "};
52 /* XPM */
53 static const char * const unmaximise_xpm[] = {
54 "12 12 3 1",
55 " c None",
56 ". c #000000",
57 "+ c #FFFFFF",
58 " ",
59 " ",
60 " ...... ",
61 " .++++++. ",
62 " .++++++. ",
63 " .++++++. ",
64 " .++++++. ",
65 " .++++++. ",
66 " .++++++. ",
67 " ...... ",
68 " ",
69 " "};
71 MaximiseButton::MaximiseButton(QWidget * parent)
72 : Button(parent, i18n("Maximize"),
73 (Qt::ButtonState)(Qt::LeftButton|Qt::MidButton|Qt::RightButton)),
74 on_(false)
76 setPixmap(QPixmap((const char **)maximise_xpm));
79 void MaximiseButton::setOn(bool on)
81 on_ = on;
82 setPixmap(on_ ? QPixmap((const char **)unmaximise_xpm)
83 : QPixmap((const char **)maximise_xpm));
84 repaint();
85 QToolTip::remove(this);
86 this->setToolTip( on_ ? i18n("Restore") : i18n("Maximize"));
89 void MaximiseButton::mouseReleaseEvent(QMouseEvent *e)
91 Button::mouseReleaseEvent(e);
93 if (!rect().contains(e->pos()))
94 return;
95 emit(maximizeClicked(lastButton_));
98 } // End namespace
100 // vim:ts=2:sw=2:tw=78
101 #include "MaximiseButton.moc"