author | mickeyl <mickeyl> | 2004-11-16 19:14:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-11-16 19:14:18 (UTC) |
commit | ea3945a9bd8f9830f70b1efa133f9df13b19362f (patch) (unidiff) | |
tree | f2ea22cc50e9aa8aa73ee7dea148f41c563c9666 /libopie/colorpopupmenu.cpp | |
parent | 1c6f490e8541626f68422e0a3a7c7281d7f5b7d3 (diff) | |
download | opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.zip opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.gz opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.bz2 |
libopie1 goes into unsupported
-rw-r--r-- | libopie/colorpopupmenu.cpp | 172 |
1 files changed, 0 insertions, 172 deletions
diff --git a/libopie/colorpopupmenu.cpp b/libopie/colorpopupmenu.cpp deleted file mode 100644 index 03ad233..0000000 --- a/libopie/colorpopupmenu.cpp +++ b/dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (c) 2002 S. Prud'homme <prudhomme@laposte.net> | ||
5 | Dan Williams <williamsdr@acm.org> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; Library General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = Library General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #include "colorpopupmenu.h" | ||
34 | #include "colordialog.h" | ||
35 | |||
36 | #include <qlayout.h> | ||
37 | #include <qpainter.h> | ||
38 | |||
39 | OColorPanelButton::OColorPanelButton( const QColor& color, QWidget* parent, const char* name ) | ||
40 | : QFrame( parent, name ) | ||
41 | { | ||
42 | m_color = color; | ||
43 | |||
44 | setFixedSize( 16, 16 ); | ||
45 | setActive( FALSE ); | ||
46 | } | ||
47 | |||
48 | OColorPanelButton::~OColorPanelButton() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | void OColorPanelButton::setActive( bool active ) | ||
53 | { | ||
54 | m_active = active; | ||
55 | |||
56 | if ( m_active ) { | ||
57 | setFrameStyle( Panel | Sunken ); | ||
58 | } else { | ||
59 | setFrameStyle( NoFrame ); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | void OColorPanelButton::enterEvent( QEvent* ) | ||
64 | { | ||
65 | if ( !m_active ) { | ||
66 | setFrameStyle( Panel | Sunken ); | ||
67 | } | ||
68 | } | ||
69 | |||
70 | void OColorPanelButton::leaveEvent( QEvent* ) | ||
71 | { | ||
72 | if ( !m_active ) { | ||
73 | setFrameStyle( NoFrame ); | ||
74 | } | ||
75 | } | ||
76 | |||
77 | void OColorPanelButton::paintEvent( QPaintEvent* e ) | ||
78 | { | ||
79 | QFrame::paintEvent( e ); | ||
80 | |||
81 | QPainter painter; | ||
82 | painter.begin( this ); | ||
83 | painter.fillRect( 2, 2, 12, 12, m_color ); | ||
84 | painter.setPen( Qt::black ); | ||
85 | painter.drawRect( 2, 2, 12, 12 ); | ||
86 | painter.end(); | ||
87 | } | ||
88 | |||
89 | void OColorPanelButton::mouseReleaseEvent( QMouseEvent* ) | ||
90 | { | ||
91 | emit selected( m_color ); | ||
92 | } | ||
93 | |||
94 | OColorPopupMenu::OColorPopupMenu( const QColor& color, QWidget* parent, const char* name ) | ||
95 | : QPopupMenu( parent, name ) | ||
96 | { | ||
97 | m_color = color; | ||
98 | |||
99 | colorPanel = new QWidget( this ); | ||
100 | |||
101 | colorLayout = new QGridLayout(colorPanel, 5, 6); | ||
102 | |||
103 | addColor(QColor(255, 255, 255), 0, 1); | ||
104 | addColor(QColor(192, 192, 192), 0, 2); | ||
105 | addColor(QColor(128, 128, 128), 0, 3); | ||
106 | addColor(QColor(64, 64, 64), 0, 4); | ||
107 | addColor(QColor(0, 0, 0), 0, 5); | ||
108 | |||
109 | addColor(QColor(255, 0, 0), 1, 0); | ||
110 | addColor(QColor(255, 128, 0), 1, 1); | ||
111 | addColor(QColor(255, 255, 0), 1, 2); | ||
112 | addColor(QColor(128, 255, 0), 1, 3); | ||
113 | addColor(QColor(0, 255, 0), 1, 4); | ||
114 | addColor(QColor(0, 255, 128), 1, 5); | ||
115 | |||
116 | addColor(QColor(128, 0, 0), 2, 0); | ||
117 | addColor(QColor(128, 64, 0), 2, 1); | ||
118 | addColor(QColor(128, 128, 0), 2, 2); | ||
119 | addColor(QColor(64, 128, 0), 2, 3); | ||
120 | addColor(QColor(0, 128, 0), 2, 4); | ||
121 | addColor(QColor(0, 128, 64), 2, 5); | ||
122 | |||
123 | addColor(QColor(0, 255, 255), 3, 0); | ||
124 | addColor(QColor(0, 128, 255), 3, 1); | ||
125 | addColor(QColor(0, 0, 255), 3, 2); | ||
126 | addColor(QColor(128, 0, 255), 3, 3); | ||
127 | addColor(QColor(255, 0, 255), 3, 4); | ||
128 | addColor(QColor(255, 0, 128), 3, 5); | ||
129 | |||
130 | addColor(QColor(0, 128, 128), 4, 0); | ||
131 | addColor(QColor(0, 64, 128), 4, 1); | ||
132 | addColor(QColor(0, 0, 128), 4, 2); | ||
133 | addColor(QColor(64, 0, 128), 4, 3); | ||
134 | addColor(QColor(128, 0, 128), 4, 4); | ||
135 | addColor(QColor(128, 0, 64), 4, 5); | ||
136 | |||
137 | insertItem( colorPanel ); | ||
138 | insertSeparator(); | ||
139 | insertItem(tr("More"),this,SLOT( moreColorClicked())); | ||
140 | /* | ||
141 | QAction* chooseColorAction = new QAction( tr( "More" ), tr( "More..." ), 0, colorPanel, "More" ); | ||
142 | connect( chooseColorAction, SIGNAL( activated() ), this, SLOT( moreColorClicked() ) ); | ||
143 | chooseColorAction->addTo( this ); | ||
144 | */ | ||
145 | activateItemAt( 0 ); | ||
146 | } | ||
147 | |||
148 | OColorPopupMenu::~OColorPopupMenu() | ||
149 | { | ||
150 | } | ||
151 | |||
152 | void OColorPopupMenu::addColor( const QColor& color, int row, int col ) | ||
153 | { | ||
154 | OColorPanelButton* panelButton = new OColorPanelButton( color, colorPanel ); | ||
155 | connect( panelButton, SIGNAL( selected(const QColor&) ), this, SLOT( buttonSelected(const QColor&) ) ); | ||
156 | colorLayout->addWidget( panelButton, row, col ); | ||
157 | } | ||
158 | |||
159 | void OColorPopupMenu::buttonSelected( const QColor& color ) | ||
160 | { | ||
161 | m_color = color; | ||
162 | emit colorSelected( color ); | ||
163 | hide(); | ||
164 | } | ||
165 | |||
166 | void OColorPopupMenu::moreColorClicked() | ||
167 | { | ||
168 | QColor color = OColorDialog::getColor( m_color ); | ||
169 | m_color = color; | ||
170 | emit colorSelected( color ); | ||
171 | hide(); | ||
172 | } | ||