diff options
Diffstat (limited to 'lib/kofficeui/KoTooluButton.cpp')
-rw-r--r-- | lib/kofficeui/KoTooluButton.cpp | 600 |
1 files changed, 300 insertions, 300 deletions
diff --git a/lib/kofficeui/KoTooluButton.cpp b/lib/kofficeui/KoTooluButton.cpp index c5e893d5..566a3722 100644 --- a/lib/kofficeui/KoTooluButton.cpp +++ b/lib/kofficeui/KoTooluButton.cpp @@ -17,13 +17,13 @@ * Boston, MA 02110-1301, USA. */ -#include <qapplication.h> -#include <qtooltip.h> -#include <qpainter.h> -#include <qdrawutil.h> -#include <qpixmap.h> -#include <qstyle.h> -#include <qpopupmenu.h> +#include <tqapplication.h> +#include <tqtooltip.h> +#include <tqpainter.h> +#include <tqdrawutil.h> +#include <tqpixmap.h> +#include <tqstyle.h> +#include <tqpopupmenu.h> #include <kglobalsettings.h> #include <ktoolbar.h> @@ -41,8 +41,8 @@ namespace { int ARROW_WIDTH = 12; } -KoColorPanel::KoColorPanel( QWidget* parent, const char* name ) : - QWidget( parent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ) +KoColorPanel::KoColorPanel( TQWidget* tqparent, const char* name ) : + TQWidget( tqparent, name, WStaticContents | WRepaintNoErase | WResizeNoErase ) { setMouseTracking( true ); setAcceptDrops( true ); @@ -53,52 +53,52 @@ KoColorPanel::~KoColorPanel() { } -QSize KoColorPanel::sizeHint() const +TQSize KoColorPanel::tqsizeHint() const { - return minimumSizeHint(); + return tqminimumSizeHint(); } -QSize KoColorPanel::minimumSizeHint() const +TQSize KoColorPanel::tqminimumSizeHint() const { - return QSize( COLS << 4, lines() << 4 ); + return TQSize( COLS << 4, lines() << 4 ); } -QPopupMenu* KoColorPanel::createColorPopup( KoColorPanel::MenuStyle style, const QColor& defaultColor, - const QObject* receiver, const char* slot, - QWidget* parent, const char* name ) +TQPopupMenu* KoColorPanel::createColorPopup( KoColorPanel::MenuStyle style, const TQColor& defaultColor, + const TQObject* receiver, const char* slot, + TQWidget* tqparent, const char* name ) { - QPopupMenu* menu = new QPopupMenu( parent, name ); + TQPopupMenu* menu = new TQPopupMenu( tqparent, name ); KoColorPopupProxy* proxy = 0; if ( defaultColor.isValid() ) { - QPixmap pixmap( 12, 12 ); - QPainter p( &pixmap ); + TQPixmap pixmap( 12, 12 ); + TQPainter p( &pixmap ); p.fillRect( 0, 0, 12, 12, defaultColor ); p.end(); - proxy = new KoColorPopupProxy( defaultColor, 0, menu, "color proxy" ); - connect( proxy, SIGNAL( colorSelected( const QColor& ) ), receiver, slot ); - menu->insertItem( QIconSet( pixmap ), i18n( "Default Color" ), proxy, SLOT( slotDefaultColor() ) ); + proxy = new KoColorPopupProxy( defaultColor, 0, TQT_TQOBJECT(menu), "color proxy" ); + connect( proxy, TQT_SIGNAL( colorSelected( const TQColor& ) ), receiver, slot ); + menu->insertItem( TQIconSet( pixmap ), i18n( "Default Color" ), proxy, TQT_SLOT( slotDefaultColor() ) ); menu->insertSeparator(); } KoColorPanel* panel = new KoColorPanel( menu, "default colors" ); panel->insertDefaultColors(); - connect( panel, SIGNAL( colorSelected( const QColor& ) ), receiver, slot ); + connect( panel, TQT_SIGNAL( colorSelected( const TQColor& ) ), receiver, slot ); menu->insertItem( panel ); if ( style == CustomColors ) { menu->insertSeparator(); panel = new KoColorPanel( menu, "custom panel" ); - connect( panel, SIGNAL( colorSelected( const QColor& ) ), receiver, slot ); + connect( panel, TQT_SIGNAL( colorSelected( const TQColor& ) ), receiver, slot ); menu->insertItem( panel ); if ( !proxy ) { - proxy = new KoColorPopupProxy( QColor(), panel, menu, "color proxy" ); - connect( proxy, SIGNAL( colorSelected( const QColor& ) ), receiver, slot ); + proxy = new KoColorPopupProxy( TQColor(), panel, TQT_TQOBJECT(menu), "color proxy" ); + connect( proxy, TQT_SIGNAL( colorSelected( const TQColor& ) ), receiver, slot ); } else proxy->setRecentColorPanel( panel ); menu->insertSeparator(); - menu->insertItem( i18n( "More Colors..." ), proxy, SLOT( slotMoreColors() ) ); + menu->insertItem( i18n( "More Colors..." ), proxy, TQT_SLOT( slotMoreColors() ) ); } return menu; @@ -109,21 +109,21 @@ void KoColorPanel::clear() if ( m_colorMap.isEmpty() ) return; - QSize area( minimumSizeHint() ); + TQSize area( tqminimumSizeHint() ); m_colorMap.clear(); init(); updateGeometry(); erase( 0, 0, area.width(), area.height() ); } -void KoColorPanel::insertColor( const QColor& color ) +void KoColorPanel::insertColor( const TQColor& color ) { Position pos = m_nextPosition; if ( insertColor( color, true ) ) // we want checking for external users finalizeInsertion( pos ); } -void KoColorPanel::insertColor( const QColor& color, const QString& toolTip ) +void KoColorPanel::insertColor( const TQColor& color, const TQString& toolTip ) { Position pos = m_nextPosition; if ( insertColor( color, toolTip, true ) ) // we want checking for external users @@ -136,190 +136,190 @@ void KoColorPanel::insertDefaultColors() return; m_defaultsAdded = true; - int currentRow = m_nextPosition.y; // we have to repaint this row below + int currentRow = m_nextPosition.y; // we have to tqrepaint this row below // Note: No checking for duplicates, so take care when you modify that list - insertColor(QColor( 255 , 0 , 0 ), i18n( "color", "Red" ), false); - insertColor(QColor( 255 , 165 , 0 ), i18n( "color", "Orange" ), false); - insertColor(QColor( 255 , 0 , 255 ), i18n( "color", "Magenta" ), false); - insertColor(QColor( 0 , 0 , 255 ), i18n( "color", "Blue" ), false); - insertColor(QColor( 0 , 255 , 255 ), i18n( "color", "Cyan" ), false); - insertColor(QColor( 0 , 255 , 0 ), i18n( "color", "Green" ), false); - insertColor(QColor( 255 , 255 , 0 ), i18n( "color", "Yellow" ), false); - insertColor(QColor( 165 , 42 , 42 ), i18n( "color", "Brown" ), false); - insertColor(QColor( 139 , 0 , 0 ), i18n( "color", "DarkRed" ), false); - insertColor(QColor( 255 , 140 , 0 ), i18n( "color", "DarkOrange" ), false); - insertColor(QColor( 139 , 0 , 139 ), i18n( "color", "DarkMagenta" ), false); - insertColor(QColor( 0 , 0 , 139 ), i18n( "color", "DarkBlue" ), false); - insertColor(QColor( 0 , 139 , 139 ), i18n( "color", "DarkCyan" ), false); - insertColor(QColor( 0 , 100 , 0 ), i18n( "color", "DarkGreen" ), false); - insertColor(QColor( 130 , 127 , 0 ), i18n( "color", "DarkYellow" ), false); - insertColor(QColor( 255 , 255 , 255 ), i18n( "color", "White" ), false); + insertColor(TQColor( 255 , 0 , 0 ), i18n( "color", "Red" ), false); + insertColor(TQColor( 255 , 165 , 0 ), i18n( "color", "Orange" ), false); + insertColor(TQColor( 255 , 0 , 255 ), i18n( "color", "Magenta" ), false); + insertColor(TQColor( 0 , 0 , 255 ), i18n( "color", "Blue" ), false); + insertColor(TQColor( 0 , 255 , 255 ), i18n( "color", "Cyan" ), false); + insertColor(TQColor( 0 , 255 , 0 ), i18n( "color", "Green" ), false); + insertColor(TQColor( 255 , 255 , 0 ), i18n( "color", "Yellow" ), false); + insertColor(TQColor( 165 , 42 , 42 ), i18n( "color", "Brown" ), false); + insertColor(TQColor( 139 , 0 , 0 ), i18n( "color", "DarkRed" ), false); + insertColor(TQColor( 255 , 140 , 0 ), i18n( "color", "DarkOrange" ), false); + insertColor(TQColor( 139 , 0 , 139 ), i18n( "color", "DarkMagenta" ), false); + insertColor(TQColor( 0 , 0 , 139 ), i18n( "color", "DarkBlue" ), false); + insertColor(TQColor( 0 , 139 , 139 ), i18n( "color", "DarkCyan" ), false); + insertColor(TQColor( 0 , 100 , 0 ), i18n( "color", "DarkGreen" ), false); + insertColor(TQColor( 130 , 127 , 0 ), i18n( "color", "DarkYellow" ), false); + insertColor(TQColor( 255 , 255 , 255 ), i18n( "color", "White" ), false); // xgettext:no-c-format - insertColor(QColor( 229 , 229 , 229 ), i18n( "color", "Gray 90%" ), false); + insertColor(TQColor( 229 , 229 , 229 ), i18n( "color", "Gray 90%" ), false); // xgettext:no-c-format - insertColor(QColor( 204 , 204 , 204 ), i18n( "color", "Gray 80%" ), false); + insertColor(TQColor( 204 , 204 , 204 ), i18n( "color", "Gray 80%" ), false); // xgettext:no-c-format - insertColor(QColor( 178 , 178 , 178 ), i18n( "color", "Gray 70%" ), false); + insertColor(TQColor( 178 , 178 , 178 ), i18n( "color", "Gray 70%" ), false); // xgettext:no-c-format - insertColor(QColor( 153 , 153 , 153 ), i18n( "color", "Gray 60%" ), false); + insertColor(TQColor( 153 , 153 , 153 ), i18n( "color", "Gray 60%" ), false); // xgettext:no-c-format - insertColor(QColor( 127 , 127 , 127 ), i18n( "color", "Gray 50%" ), false); + insertColor(TQColor( 127 , 127 , 127 ), i18n( "color", "Gray 50%" ), false); // xgettext:no-c-format - insertColor(QColor( 102 , 102 , 102 ), i18n( "color", "Gray 40%" ), false); + insertColor(TQColor( 102 , 102 , 102 ), i18n( "color", "Gray 40%" ), false); // xgettext:no-c-format - insertColor(QColor( 76 , 76 , 76 ), i18n( "color", "Gray 30%" ), false); + insertColor(TQColor( 76 , 76 , 76 ), i18n( "color", "Gray 30%" ), false); // xgettext:no-c-format - insertColor(QColor( 51 , 51 , 51 ), i18n( "color", "Gray 20%" ), false); + insertColor(TQColor( 51 , 51 , 51 ), i18n( "color", "Gray 20%" ), false); // xgettext:no-c-format - insertColor(QColor( 25 , 25 , 25 ), i18n( "color", "Gray 10%" ), false); - insertColor(QColor( 0 , 0 , 0 ), i18n( "color", "Black" ), false); - insertColor(QColor( 255 , 255 , 240 ), i18n( "color", "Ivory" ), false); - insertColor(QColor( 255 , 250 , 250 ), i18n( "color", "Snow" ), false); - insertColor(QColor( 245 , 255 , 250 ), i18n( "color", "MintCream" ), false); - insertColor(QColor( 255 , 250 , 240 ), i18n( "color", "FloralWhite" ), false); - insertColor(QColor( 255 , 255 , 224 ), i18n( "color", "LightYellow" ), false); - insertColor(QColor( 240 , 255 , 255 ), i18n( "color", "Azure" ), false); - insertColor(QColor( 248 , 248 , 255 ), i18n( "color", "GhostWhite" ), false); - insertColor(QColor( 240 , 255 , 240 ), i18n( "color", "Honeydew" ), false); - insertColor(QColor( 255 , 245 , 238 ), i18n( "color", "Seashell" ), false); - insertColor(QColor( 240 , 248 , 255 ), i18n( "color", "AliceBlue" ), false); - insertColor(QColor( 255 , 248 , 220 ), i18n( "color", "Cornsilk" ), false); - insertColor(QColor( 255 , 240 , 245 ), i18n( "color", "LavenderBlush" ), false); - insertColor(QColor( 253 , 245 , 230 ), i18n( "color", "OldLace" ), false); - insertColor(QColor( 245 , 245 , 245 ), i18n( "color", "WhiteSmoke" ), false); - insertColor(QColor( 255 , 250 , 205 ), i18n( "color", "LemonChiffon" ), false); - insertColor(QColor( 224 , 255 , 255 ), i18n( "color", "LightCyan" ), false); - insertColor(QColor( 250 , 250 , 210 ), i18n( "color", "LightGoldenrodYellow" ), false); - insertColor(QColor( 250 , 240 , 230 ), i18n( "color", "Linen" ), false); - insertColor(QColor( 245 , 245 , 220 ), i18n( "color", "Beige" ), false); - insertColor(QColor( 255 , 239 , 213 ), i18n( "color", "PapayaWhip" ), false); - insertColor(QColor( 255 , 235 , 205 ), i18n( "color", "BlanchedAlmond" ), false); - insertColor(QColor( 250 , 235 , 215 ), i18n( "color", "AntiqueWhite" ), false); - insertColor(QColor( 255 , 228 , 225 ), i18n( "color", "MistyRose" ), false); - insertColor(QColor( 230 , 230 , 250 ), i18n( "color", "Lavender" ), false); - insertColor(QColor( 255 , 228 , 196 ), i18n( "color", "Bisque" ), false); - insertColor(QColor( 255 , 228 , 181 ), i18n( "color", "Moccasin" ), false); - insertColor(QColor( 255 , 222 , 173 ), i18n( "color", "NavajoWhite" ), false); - insertColor(QColor( 255 , 218 , 185 ), i18n( "color", "PeachPuff" ), false); - insertColor(QColor( 238 , 232 , 170 ), i18n( "color", "PaleGoldenrod" ), false); - insertColor(QColor( 245 , 222 , 179 ), i18n( "color", "Wheat" ), false); - insertColor(QColor( 220 , 220 , 220 ), i18n( "color", "Gainsboro" ), false); - insertColor(QColor( 240 , 230 , 140 ), i18n( "color", "Khaki" ), false); - insertColor(QColor( 175 , 238 , 238 ), i18n( "color", "PaleTurquoise" ), false); - insertColor(QColor( 255 , 192 , 203 ), i18n( "color", "Pink" ), false); - insertColor(QColor( 238 , 221 , 130 ), i18n( "color", "LightGoldenrod" ), false); - insertColor(QColor( 211 , 211 , 211 ), i18n( "color", "LightGray" ), false); - insertColor(QColor( 255 , 182 , 193 ), i18n( "color", "LightPink" ), false); - insertColor(QColor( 176 , 224 , 230 ), i18n( "color", "PowderBlue" ), false); - insertColor(QColor( 127 , 255 , 212 ), i18n( "color", "Aquamarine" ), false); - insertColor(QColor( 216 , 191 , 216 ), i18n( "color", "Thistle" ), false); - insertColor(QColor( 173 , 216 , 230 ), i18n( "color", "LightBlue" ), false); - insertColor(QColor( 152 , 251 , 152 ), i18n( "color", "PaleGreen" ), false); - insertColor(QColor( 255 , 215 , 0 ), i18n( "color", "Gold" ), false); - insertColor(QColor( 173 , 255 , 47 ), i18n( "color", "GreenYellow" ), false); - insertColor(QColor( 176 , 196 , 222 ), i18n( "color", "LightSteelBlue" ), false); - insertColor(QColor( 144 , 238 , 144 ), i18n( "color", "LightGreen" ), false); - insertColor(QColor( 221 , 160 , 221 ), i18n( "color", "Plum" ), false); - insertColor(QColor( 190 , 190 , 190 ), i18n( "color", "Gray" ), false); - insertColor(QColor( 222 , 184 , 135 ), i18n( "color", "BurlyWood" ), false); - insertColor(QColor( 135 , 206 , 250 ), i18n( "color", "LightSkyBlue" ), false); - insertColor(QColor( 255 , 160 , 122 ), i18n( "color", "LightSalmon" ), false); - insertColor(QColor( 135 , 206 , 235 ), i18n( "color", "SkyBlue" ), false); - insertColor(QColor( 210 , 180 , 140 ), i18n( "color", "Tan" ), false); - insertColor(QColor( 238 , 130 , 238 ), i18n( "color", "Violet" ), false); - insertColor(QColor( 244 , 164 , 96 ), i18n( "color", "SandyBrown" ), false); - insertColor(QColor( 233 , 150 , 122 ), i18n( "color", "DarkSalmon" ), false); - insertColor(QColor( 189 , 183 , 107 ), i18n( "color", "DarkKhaki" ), false); - insertColor(QColor( 127 , 255 , 0 ), i18n( "color", "Chartreuse" ), false); - insertColor(QColor( 169 , 169 , 169 ), i18n( "color", "DarkGray" ), false); - insertColor(QColor( 124 , 252 , 0 ), i18n( "color", "LawnGreen" ), false); - insertColor(QColor( 255 , 105 , 180 ), i18n( "color", "HotPink" ), false); - insertColor(QColor( 250 , 128 , 114 ), i18n( "color", "Salmon" ), false); - insertColor(QColor( 240 , 128 , 128 ), i18n( "color", "LightCoral" ), false); - insertColor(QColor( 64 , 224 , 208 ), i18n( "color", "Turquoise" ), false); - insertColor(QColor( 143 , 188 , 143 ), i18n( "color", "DarkSeaGreen" ), false); - insertColor(QColor( 218 , 112 , 214 ), i18n( "color", "Orchid" ), false); - insertColor(QColor( 102 , 205 , 170 ), i18n( "color", "MediumAquamarine" ), false); - insertColor(QColor( 255 , 127 , 80 ), i18n( "color", "Coral" ), false); - insertColor(QColor( 154 , 205 , 50 ), i18n( "color", "YellowGreen" ), false); - insertColor(QColor( 218 , 165 , 32 ), i18n( "color", "Goldenrod" ), false); - insertColor(QColor( 72 , 209 , 204 ), i18n( "color", "MediumTurquoise" ), false); - insertColor(QColor( 188 , 143 , 143 ), i18n( "color", "RosyBrown" ), false); - insertColor(QColor( 219 , 112 , 147 ), i18n( "color", "PaleVioletRed" ), false); - insertColor(QColor( 0 , 250 , 154 ), i18n( "color", "MediumSpringGreen" ), false); - insertColor(QColor( 255 , 99 , 71 ), i18n( "color", "Tomato" ), false); - insertColor(QColor( 0 , 255 , 127 ), i18n( "color", "SpringGreen" ), false); - insertColor(QColor( 205 , 133 , 63 ), i18n( "color", "Peru" ), false); - insertColor(QColor( 100 , 149 , 237 ), i18n( "color", "CornflowerBlue" ), false); - insertColor(QColor( 132 , 112 , 255 ), i18n( "color", "LightSlateBlue" ), false); - insertColor(QColor( 147 , 112 , 219 ), i18n( "color", "MediumPurple" ), false); - insertColor(QColor( 186 , 85 , 211 ), i18n( "color", "MediumOrchid" ), false); - insertColor(QColor( 95 , 158 , 160 ), i18n( "color", "CadetBlue" ), false); - insertColor(QColor( 0 , 206 , 209 ), i18n( "color", "DarkTurquoise" ), false); - insertColor(QColor( 0 , 191 , 255 ), i18n( "color", "DeepSkyBlue" ), false); - insertColor(QColor( 119 , 136 , 153 ), i18n( "color", "LightSlateGray" ), false); - insertColor(QColor( 184 , 134 , 11 ), i18n( "color", "DarkGoldenrod" ), false); - insertColor(QColor( 123 , 104 , 238 ), i18n( "color", "MediumSlateBlue" ), false); - insertColor(QColor( 205 , 92 , 92 ), i18n( "color", "IndianRed" ), false); - insertColor(QColor( 210 , 105 , 30 ), i18n( "color", "Chocolate" ), false); - insertColor(QColor( 60 , 179 , 113 ), i18n( "color", "MediumSeaGreen" ), false); - insertColor(QColor( 50 , 205 , 50 ), i18n( "color", "LimeGreen" ), false); - insertColor(QColor( 32 , 178 , 170 ), i18n( "color", "LightSeaGreen" ), false); - insertColor(QColor( 112 , 128 , 144 ), i18n( "color", "SlateGray" ), false); - insertColor(QColor( 30 , 144 , 255 ), i18n( "color", "DodgerBlue" ), false); - insertColor(QColor( 255 , 69 , 0 ), i18n( "color", "OrangeRed" ), false); - insertColor(QColor( 255 , 20 , 147 ), i18n( "color", "DeepPink" ), false); - insertColor(QColor( 70 , 130 , 180 ), i18n( "color", "SteelBlue" ), false); - insertColor(QColor( 106 , 90 , 205 ), i18n( "color", "SlateBlue" ), false); - insertColor(QColor( 107 , 142 , 35 ), i18n( "color", "OliveDrab" ), false); - insertColor(QColor( 65 , 105 , 225 ), i18n( "color", "RoyalBlue" ), false); - insertColor(QColor( 208 , 32 , 144 ), i18n( "color", "VioletRed" ), false); - insertColor(QColor( 153 , 50 , 204 ), i18n( "color", "DarkOrchid" ), false); - insertColor(QColor( 160 , 32 , 240 ), i18n( "color", "Purple" ), false); - insertColor(QColor( 105 , 105 , 105 ), i18n( "color", "DimGray" ), false); - insertColor(QColor( 138 , 43 , 226 ), i18n( "color", "BlueViolet" ), false); - insertColor(QColor( 160 , 82 , 45 ), i18n( "color", "Sienna" ), false); - insertColor(QColor( 199 , 21 , 133 ), i18n( "color", "MediumVioletRed" ), false); - insertColor(QColor( 176 , 48 , 96 ), i18n( "color", "Maroon" ), false); - insertColor(QColor( 46 , 139 , 87 ), i18n( "color", "SeaGreen" ), false); - insertColor(QColor( 85 , 107 , 47 ), i18n( "color", "DarkOliveGreen" ), false); - insertColor(QColor( 34 , 139 , 34 ), i18n( "color", "ForestGreen" ), false); - insertColor(QColor( 139 , 69 , 19 ), i18n( "color", "SaddleBrown" ), false); - insertColor(QColor( 148 , 0 , 211 ), i18n( "color", "DarkViolet" ), false); - insertColor(QColor( 178 , 34 , 34 ), i18n( "color", "FireBrick" ), false); - insertColor(QColor( 72 , 61 , 139 ), i18n( "color", "DarkSlateBlue" ), false); - insertColor(QColor( 47 , 79 , 79 ), i18n( "color", "DarkSlateGray" ), false); - insertColor(QColor( 25 , 25 , 112 ), i18n( "color", "MidnightBlue" ), false); - insertColor(QColor( 0 , 0 , 205 ), i18n( "color", "MediumBlue" ), false); - insertColor(QColor( 0 , 0 , 128 ), i18n( "color", "Navy" ), false); - - finalizeInsertion( m_nextPosition ); // with a no-op paint() call as we repaint anyway + insertColor(TQColor( 25 , 25 , 25 ), i18n( "color", "Gray 10%" ), false); + insertColor(TQColor( 0 , 0 , 0 ), i18n( "color", "Black" ), false); + insertColor(TQColor( 255 , 255 , 240 ), i18n( "color", "Ivory" ), false); + insertColor(TQColor( 255 , 250 , 250 ), i18n( "color", "Snow" ), false); + insertColor(TQColor( 245 , 255 , 250 ), i18n( "color", "MintCream" ), false); + insertColor(TQColor( 255 , 250 , 240 ), i18n( "color", "FloralWhite" ), false); + insertColor(TQColor( 255 , 255 , 224 ), i18n( "color", "LightYellow" ), false); + insertColor(TQColor( 240 , 255 , 255 ), i18n( "color", "Azure" ), false); + insertColor(TQColor( 248 , 248 , 255 ), i18n( "color", "GhostWhite" ), false); + insertColor(TQColor( 240 , 255 , 240 ), i18n( "color", "Honeydew" ), false); + insertColor(TQColor( 255 , 245 , 238 ), i18n( "color", "Seashell" ), false); + insertColor(TQColor( 240 , 248 , 255 ), i18n( "color", "AliceBlue" ), false); + insertColor(TQColor( 255 , 248 , 220 ), i18n( "color", "Cornsilk" ), false); + insertColor(TQColor( 255 , 240 , 245 ), i18n( "color", "LavenderBlush" ), false); + insertColor(TQColor( 253 , 245 , 230 ), i18n( "color", "OldLace" ), false); + insertColor(TQColor( 245 , 245 , 245 ), i18n( "color", "WhiteSmoke" ), false); + insertColor(TQColor( 255 , 250 , 205 ), i18n( "color", "LemonChiffon" ), false); + insertColor(TQColor( 224 , 255 , 255 ), i18n( "color", "LightCyan" ), false); + insertColor(TQColor( 250 , 250 , 210 ), i18n( "color", "LightGoldenrodYellow" ), false); + insertColor(TQColor( 250 , 240 , 230 ), i18n( "color", "Linen" ), false); + insertColor(TQColor( 245 , 245 , 220 ), i18n( "color", "Beige" ), false); + insertColor(TQColor( 255 , 239 , 213 ), i18n( "color", "PapayaWhip" ), false); + insertColor(TQColor( 255 , 235 , 205 ), i18n( "color", "BlanchedAlmond" ), false); + insertColor(TQColor( 250 , 235 , 215 ), i18n( "color", "AntiqueWhite" ), false); + insertColor(TQColor( 255 , 228 , 225 ), i18n( "color", "MistyRose" ), false); + insertColor(TQColor( 230 , 230 , 250 ), i18n( "color", "Lavender" ), false); + insertColor(TQColor( 255 , 228 , 196 ), i18n( "color", "Bisque" ), false); + insertColor(TQColor( 255 , 228 , 181 ), i18n( "color", "Moccasin" ), false); + insertColor(TQColor( 255 , 222 , 173 ), i18n( "color", "NavajoWhite" ), false); + insertColor(TQColor( 255 , 218 , 185 ), i18n( "color", "PeachPuff" ), false); + insertColor(TQColor( 238 , 232 , 170 ), i18n( "color", "PaleGoldenrod" ), false); + insertColor(TQColor( 245 , 222 , 179 ), i18n( "color", "Wheat" ), false); + insertColor(TQColor( 220 , 220 , 220 ), i18n( "color", "Gainsboro" ), false); + insertColor(TQColor( 240 , 230 , 140 ), i18n( "color", "Khaki" ), false); + insertColor(TQColor( 175 , 238 , 238 ), i18n( "color", "PaleTurquoise" ), false); + insertColor(TQColor( 255 , 192 , 203 ), i18n( "color", "Pink" ), false); + insertColor(TQColor( 238 , 221 , 130 ), i18n( "color", "LightGoldenrod" ), false); + insertColor(TQColor( 211 , 211 , 211 ), i18n( "color", "LightGray" ), false); + insertColor(TQColor( 255 , 182 , 193 ), i18n( "color", "LightPink" ), false); + insertColor(TQColor( 176 , 224 , 230 ), i18n( "color", "PowderBlue" ), false); + insertColor(TQColor( 127 , 255 , 212 ), i18n( "color", "Aquamarine" ), false); + insertColor(TQColor( 216 , 191 , 216 ), i18n( "color", "Thistle" ), false); + insertColor(TQColor( 173 , 216 , 230 ), i18n( "color", "LightBlue" ), false); + insertColor(TQColor( 152 , 251 , 152 ), i18n( "color", "PaleGreen" ), false); + insertColor(TQColor( 255 , 215 , 0 ), i18n( "color", "Gold" ), false); + insertColor(TQColor( 173 , 255 , 47 ), i18n( "color", "GreenYellow" ), false); + insertColor(TQColor( 176 , 196 , 222 ), i18n( "color", "LightSteelBlue" ), false); + insertColor(TQColor( 144 , 238 , 144 ), i18n( "color", "LightGreen" ), false); + insertColor(TQColor( 221 , 160 , 221 ), i18n( "color", "Plum" ), false); + insertColor(TQColor( 190 , 190 , 190 ), i18n( "color", "Gray" ), false); + insertColor(TQColor( 222 , 184 , 135 ), i18n( "color", "BurlyWood" ), false); + insertColor(TQColor( 135 , 206 , 250 ), i18n( "color", "LightSkyBlue" ), false); + insertColor(TQColor( 255 , 160 , 122 ), i18n( "color", "LightSalmon" ), false); + insertColor(TQColor( 135 , 206 , 235 ), i18n( "color", "SkyBlue" ), false); + insertColor(TQColor( 210 , 180 , 140 ), i18n( "color", "Tan" ), false); + insertColor(TQColor( 238 , 130 , 238 ), i18n( "color", "Violet" ), false); + insertColor(TQColor( 244 , 164 , 96 ), i18n( "color", "SandyBrown" ), false); + insertColor(TQColor( 233 , 150 , 122 ), i18n( "color", "DarkSalmon" ), false); + insertColor(TQColor( 189 , 183 , 107 ), i18n( "color", "DarkKhaki" ), false); + insertColor(TQColor( 127 , 255 , 0 ), i18n( "color", "Chartreuse" ), false); + insertColor(TQColor( 169 , 169 , 169 ), i18n( "color", "DarkGray" ), false); + insertColor(TQColor( 124 , 252 , 0 ), i18n( "color", "LawnGreen" ), false); + insertColor(TQColor( 255 , 105 , 180 ), i18n( "color", "HotPink" ), false); + insertColor(TQColor( 250 , 128 , 114 ), i18n( "color", "Salmon" ), false); + insertColor(TQColor( 240 , 128 , 128 ), i18n( "color", "LightCoral" ), false); + insertColor(TQColor( 64 , 224 , 208 ), i18n( "color", "Turquoise" ), false); + insertColor(TQColor( 143 , 188 , 143 ), i18n( "color", "DarkSeaGreen" ), false); + insertColor(TQColor( 218 , 112 , 214 ), i18n( "color", "Orchid" ), false); + insertColor(TQColor( 102 , 205 , 170 ), i18n( "color", "MediumAquamarine" ), false); + insertColor(TQColor( 255 , 127 , 80 ), i18n( "color", "Coral" ), false); + insertColor(TQColor( 154 , 205 , 50 ), i18n( "color", "YellowGreen" ), false); + insertColor(TQColor( 218 , 165 , 32 ), i18n( "color", "Goldenrod" ), false); + insertColor(TQColor( 72 , 209 , 204 ), i18n( "color", "MediumTurquoise" ), false); + insertColor(TQColor( 188 , 143 , 143 ), i18n( "color", "RosyBrown" ), false); + insertColor(TQColor( 219 , 112 , 147 ), i18n( "color", "PaleVioletRed" ), false); + insertColor(TQColor( 0 , 250 , 154 ), i18n( "color", "MediumSpringGreen" ), false); + insertColor(TQColor( 255 , 99 , 71 ), i18n( "color", "Tomato" ), false); + insertColor(TQColor( 0 , 255 , 127 ), i18n( "color", "SpringGreen" ), false); + insertColor(TQColor( 205 , 133 , 63 ), i18n( "color", "Peru" ), false); + insertColor(TQColor( 100 , 149 , 237 ), i18n( "color", "CornflowerBlue" ), false); + insertColor(TQColor( 132 , 112 , 255 ), i18n( "color", "LightSlateBlue" ), false); + insertColor(TQColor( 147 , 112 , 219 ), i18n( "color", "MediumPurple" ), false); + insertColor(TQColor( 186 , 85 , 211 ), i18n( "color", "MediumOrchid" ), false); + insertColor(TQColor( 95 , 158 , 160 ), i18n( "color", "CadetBlue" ), false); + insertColor(TQColor( 0 , 206 , 209 ), i18n( "color", "DarkTurquoise" ), false); + insertColor(TQColor( 0 , 191 , 255 ), i18n( "color", "DeepSkyBlue" ), false); + insertColor(TQColor( 119 , 136 , 153 ), i18n( "color", "LightSlateGray" ), false); + insertColor(TQColor( 184 , 134 , 11 ), i18n( "color", "DarkGoldenrod" ), false); + insertColor(TQColor( 123 , 104 , 238 ), i18n( "color", "MediumSlateBlue" ), false); + insertColor(TQColor( 205 , 92 , 92 ), i18n( "color", "IndianRed" ), false); + insertColor(TQColor( 210 , 105 , 30 ), i18n( "color", "Chocolate" ), false); + insertColor(TQColor( 60 , 179 , 113 ), i18n( "color", "MediumSeaGreen" ), false); + insertColor(TQColor( 50 , 205 , 50 ), i18n( "color", "LimeGreen" ), false); + insertColor(TQColor( 32 , 178 , 170 ), i18n( "color", "LightSeaGreen" ), false); + insertColor(TQColor( 112 , 128 , 144 ), i18n( "color", "SlateGray" ), false); + insertColor(TQColor( 30 , 144 , 255 ), i18n( "color", "DodgerBlue" ), false); + insertColor(TQColor( 255 , 69 , 0 ), i18n( "color", "OrangeRed" ), false); + insertColor(TQColor( 255 , 20 , 147 ), i18n( "color", "DeepPink" ), false); + insertColor(TQColor( 70 , 130 , 180 ), i18n( "color", "SteelBlue" ), false); + insertColor(TQColor( 106 , 90 , 205 ), i18n( "color", "SlateBlue" ), false); + insertColor(TQColor( 107 , 142 , 35 ), i18n( "color", "OliveDrab" ), false); + insertColor(TQColor( 65 , 105 , 225 ), i18n( "color", "RoyalBlue" ), false); + insertColor(TQColor( 208 , 32 , 144 ), i18n( "color", "VioletRed" ), false); + insertColor(TQColor( 153 , 50 , 204 ), i18n( "color", "DarkOrchid" ), false); + insertColor(TQColor( 160 , 32 , 240 ), i18n( "color", "Purple" ), false); + insertColor(TQColor( 105 , 105 , 105 ), i18n( "color", "DimGray" ), false); + insertColor(TQColor( 138 , 43 , 226 ), i18n( "color", "BlueViolet" ), false); + insertColor(TQColor( 160 , 82 , 45 ), i18n( "color", "Sienna" ), false); + insertColor(TQColor( 199 , 21 , 133 ), i18n( "color", "MediumVioletRed" ), false); + insertColor(TQColor( 176 , 48 , 96 ), i18n( "color", "Maroon" ), false); + insertColor(TQColor( 46 , 139 , 87 ), i18n( "color", "SeaGreen" ), false); + insertColor(TQColor( 85 , 107 , 47 ), i18n( "color", "DarkOliveGreen" ), false); + insertColor(TQColor( 34 , 139 , 34 ), i18n( "color", "ForestGreen" ), false); + insertColor(TQColor( 139 , 69 , 19 ), i18n( "color", "SaddleBrown" ), false); + insertColor(TQColor( 148 , 0 , 211 ), i18n( "color", "DarkViolet" ), false); + insertColor(TQColor( 178 , 34 , 34 ), i18n( "color", "FireBrick" ), false); + insertColor(TQColor( 72 , 61 , 139 ), i18n( "color", "DarkSlateBlue" ), false); + insertColor(TQColor( 47 , 79 , 79 ), i18n( "color", "DarkSlateGray" ), false); + insertColor(TQColor( 25 , 25 , 112 ), i18n( "color", "MidnightBlue" ), false); + insertColor(TQColor( 0 , 0 , 205 ), i18n( "color", "MediumBlue" ), false); + insertColor(TQColor( 0 , 0 , 128 ), i18n( "color", "Navy" ), false); + + finalizeInsertion( m_nextPosition ); // with a no-op paint() call as we tqrepaint anyway updateGeometry(); - // we have to repaint the "old" current row explicitly due + // we have to tqrepaint the "old" current row explicitly due // to WStaticContents update( 0, currentRow << 4, COLS << 4, 16 ); } -void KoColorPanel::mousePressEvent( QMouseEvent* e ) +void KoColorPanel::mousePressEvent( TQMouseEvent* e ) { if ( e->button() == Qt::LeftButton ) m_pressedPos = e->pos(); } -void KoColorPanel::mouseReleaseEvent( QMouseEvent* ) +void KoColorPanel::mouseReleaseEvent( TQMouseEvent* ) { - if ( isVisible() && parentWidget() && parentWidget()->inherits( "QPopupMenu" ) ) - parentWidget()->close(); + if ( isVisible() && tqparentWidget() && tqparentWidget()->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) ) + tqparentWidget()->close(); emit colorSelected( mapToColor( m_pressedPos ) ); } -void KoColorPanel::mouseMoveEvent( QMouseEvent* e ) +void KoColorPanel::mouseMoveEvent( TQMouseEvent* e ) { if ( e->state() & Qt::LeftButton ) { - QPoint p = m_pressedPos - e->pos(); - if ( p.manhattanLength() > QApplication::startDragDistance() ) { - QColor color( mapToColor( m_pressedPos ) ); + TQPoint p = m_pressedPos - e->pos(); + if ( p.manhattanLength() > TQApplication::startDragDistance() ) { + TQColor color( mapToColor( m_pressedPos ) ); if ( color.isValid() ) { KColorDrag *drag = new KColorDrag( color, this, name() ); drag->dragCopy(); @@ -330,13 +330,13 @@ void KoColorPanel::mouseMoveEvent( QMouseEvent* e ) updateFocusPosition( mapToPosition( e->pos() ) ); } -void KoColorPanel::paintEvent( QPaintEvent* e ) +void KoColorPanel::paintEvent( TQPaintEvent* e ) { int lns = lines(); int startRow, endRow, startCol, endCol; paintArea( e->rect(), startRow, endRow, startCol, endCol ); - QPainter p( this ); + TQPainter p( this ); // First clear all the areas we won't paint on later (only if the widget isn't erased) if ( !e->erased() ) { @@ -368,8 +368,8 @@ void KoColorPanel::paintEvent( QPaintEvent* e ) // The "active" element (if there is one) if ( hasFocus() && m_focusPosition.x != -1 && m_focusPosition.y != -1 && mapFromPosition( m_focusPosition ).intersects( e->rect() ) ) - style().drawPrimitive( QStyle::PE_Panel, &p, QRect( m_focusPosition.x << 4, m_focusPosition.y << 4, TILESIZE, TILESIZE ), - colorGroup(), QStyle::Style_Sunken | QStyle::Style_Enabled ); + tqstyle().tqdrawPrimitive( TQStyle::PE_Panel, &p, TQRect( m_focusPosition.x << 4, m_focusPosition.y << 4, TILESIZE, TILESIZE ), + tqcolorGroup(), TQStyle::Style_Sunken | TQStyle::Style_Enabled ); --lns; // Attention: We just avoid some lns - 1 statements @@ -377,7 +377,7 @@ void KoColorPanel::paintEvent( QPaintEvent* e ) if ( !m_colorMap.isEmpty() ) { int currentRow = startRow, currentCol = startCol; while ( currentRow < endRow && currentCol < endCol ) { - QMap<Position, QColor>::ConstIterator it = m_colorMap.find( Position( currentCol, currentRow ) ); + TQMap<Position, TQColor>::ConstIterator it = m_colorMap.tqfind( Position( currentCol, currentRow ) ); if( it != m_colorMap.end() ) p.fillRect( ( currentCol << 4 ) + 2, ( currentRow << 4 ) + 2, 12, 12, it.data() ); @@ -397,58 +397,58 @@ void KoColorPanel::paintEvent( QPaintEvent* e ) } } -void KoColorPanel::keyPressEvent( QKeyEvent* e ) +void KoColorPanel::keyPressEvent( TQKeyEvent* e ) { Position newPos( validPosition( m_focusPosition ) ); - if ( e->key() == Qt::Key_Up ) { + if ( e->key() == TQt::Key_Up ) { if ( newPos.y == 0 ) e->ignore(); else --newPos.y; } - else if ( e->key() == Qt::Key_Down ) { + else if ( e->key() == TQt::Key_Down ) { if ( newPos < Position( m_colorMap.count() % COLS, lines() - 2 ) ) ++newPos.y; else e->ignore(); } - else if ( e->key() == Qt::Key_Left ) { + else if ( e->key() == TQt::Key_Left ) { if ( newPos.x == 0 ) e->ignore(); else --newPos.x; } - else if ( e->key() == Qt::Key_Right ) { + else if ( e->key() == TQt::Key_Right ) { if ( newPos.x < COLS - 1 && newPos < Position( m_colorMap.count() % COLS - 1, lines() - 1 ) ) ++newPos.x; else e->ignore(); } - else if ( e->key() == Qt::Key_Return ) { - if ( isVisible() && parentWidget() && parentWidget()->inherits( "QPopupMenu" ) ) - parentWidget()->close(); + else if ( e->key() == TQt::Key_Return ) { + if ( isVisible() && tqparentWidget() && tqparentWidget()->inherits( TQPOPUPMENU_OBJECT_NAME_STRING ) ) + tqparentWidget()->close(); emit colorSelected( mapToColor( m_focusPosition ) ); } updateFocusPosition( newPos ); } -void KoColorPanel::focusInEvent( QFocusEvent* e ) +void KoColorPanel::focusInEvent( TQFocusEvent* e ) { if ( !m_colorMap.isEmpty() && m_focusPosition.x == -1 && m_focusPosition.y == -1 ) { m_focusPosition.x = 0; m_focusPosition.y = 0; } - QWidget::focusInEvent( e ); + TQWidget::focusInEvent( e ); } -void KoColorPanel::dragEnterEvent( QDragEnterEvent* e ) +void KoColorPanel::dragEnterEvent( TQDragEnterEvent* e ) { e->accept( KColorDrag::canDecode( e ) ); } -void KoColorPanel::dropEvent( QDropEvent* e ) +void KoColorPanel::dropEvent( TQDropEvent* e ) { - QColor color; + TQColor color; if ( KColorDrag::decode( e, color ) ) insertColor( color ); } @@ -458,13 +458,13 @@ void KoColorPanel::finalizeInsertion( const Position& pos ) paint( pos ); if ( !isFocusEnabled() ) - setFocusPolicy( QWidget::StrongFocus ); + setFocusPolicy( TQ_StrongFocus ); // Did we start a new row? if ( m_nextPosition.x == 1 ) updateGeometry(); } -bool KoColorPanel::insertColor( const QColor& color, bool checking ) +bool KoColorPanel::insertColor( const TQColor& color, bool checking ) { if ( checking && isAvailable( color ) ) return false; @@ -479,52 +479,52 @@ bool KoColorPanel::insertColor( const QColor& color, bool checking ) return true; } -bool KoColorPanel::insertColor( const QColor& color, const QString& toolTip, bool checking ) +bool KoColorPanel::insertColor( const TQColor& color, const TQString& toolTip, bool checking ) { if ( checking && isAvailable( color ) ) return false; // Remember the "old" m_nextPosition -- this is the place where the newly // inserted color will be located - QRect rect( mapFromPosition( m_nextPosition ) ); + TQRect rect( mapFromPosition( m_nextPosition ) ); insertColor( color, false ); // check only once ;) - QToolTip::add( this, rect, toolTip ); + TQToolTip::add( this, rect, toolTip ); return true; } -bool KoColorPanel::isAvailable( const QColor& color ) +bool KoColorPanel::isAvailable( const TQColor& color ) { // O(n) checking on insert, but this is better than O(n) checking // on every mouse move... - QMap<Position, QColor>::ConstIterator it = m_colorMap.begin(); - QMap<Position, QColor>::ConstIterator end = m_colorMap.end(); + TQMap<Position, TQColor>::ConstIterator it = m_colorMap.begin(); + TQMap<Position, TQColor>::ConstIterator end = m_colorMap.end(); for ( ; it != end; ++it ) if ( it.data() == color ) return true; return false; } -KoColorPanel::Position KoColorPanel::mapToPosition( const QPoint& point ) const +KoColorPanel::Position KoColorPanel::mapToPosition( const TQPoint& point ) const { return Position( point.x() >> 4, point.y() >> 4 ); } -QColor KoColorPanel::mapToColor( const QPoint& point ) const +TQColor KoColorPanel::mapToColor( const TQPoint& point ) const { return mapToColor( mapToPosition( point ) ); } -QColor KoColorPanel::mapToColor( const KoColorPanel::Position& position ) const +TQColor KoColorPanel::mapToColor( const KoColorPanel::Position& position ) const { - QMap<Position, QColor>::ConstIterator it = m_colorMap.find( position ); + TQMap<Position, TQColor>::ConstIterator it = m_colorMap.tqfind( position ); if ( it != m_colorMap.end() ) return it.data(); - return QColor(); + return TQColor(); } -QRect KoColorPanel::mapFromPosition( const KoColorPanel::Position& position ) const +TQRect KoColorPanel::mapFromPosition( const KoColorPanel::Position& position ) const { - return QRect( position.x << 4, position.y << 4, TILESIZE, TILESIZE ); + return TQRect( position.x << 4, position.y << 4, TILESIZE, TILESIZE ); } KoColorPanel::Position KoColorPanel::validPosition( const Position& position ) @@ -558,7 +558,7 @@ int KoColorPanel::lines() const return ( m_colorMap.count() - 1 ) / COLS + 1; } -void KoColorPanel::paintArea( const QRect& rect, int& startRow, int& endRow, int& startCol, int& endCol ) const +void KoColorPanel::paintArea( const TQRect& rect, int& startRow, int& endRow, int& startCol, int& endCol ) const { startRow = rect.top() >> 4; endRow = ( rect.bottom() >> 4 ) + 1; @@ -568,7 +568,7 @@ void KoColorPanel::paintArea( const QRect& rect, int& startRow, int& endRow, int void KoColorPanel::updateFocusPosition( const Position& newPosition ) { - QPainter p( this ); + TQPainter p( this ); // restore the old tile where we had the focus before if ( m_focusPosition.x != -1 && m_focusPosition.y != -1 ) @@ -576,11 +576,11 @@ void KoColorPanel::updateFocusPosition( const Position& newPosition ) m_focusPosition = newPosition; - QMap<Position, QColor>::ConstIterator it = m_colorMap.find( m_focusPosition ); + TQMap<Position, TQColor>::ConstIterator it = m_colorMap.tqfind( m_focusPosition ); if ( it != m_colorMap.end() ) { // draw at the new focus position - style().drawPrimitive( QStyle::PE_Panel, &p, QRect( m_focusPosition.x << 4, m_focusPosition.y << 4, TILESIZE, TILESIZE ), - colorGroup(), QStyle::Style_Sunken | QStyle::Style_Enabled ); + tqstyle().tqdrawPrimitive( TQStyle::PE_Panel, &p, TQRect( m_focusPosition.x << 4, m_focusPosition.y << 4, TILESIZE, TILESIZE ), + tqcolorGroup(), TQStyle::Style_Sunken | TQStyle::Style_Enabled ); p.fillRect( ( m_focusPosition.x << 4 ) + 2, ( m_focusPosition.y << 4 ) + 2, 12, 12, it.data() ); } @@ -588,18 +588,18 @@ void KoColorPanel::updateFocusPosition( const Position& newPosition ) void KoColorPanel::paint( const Position& position ) { - QMap<Position, QColor>::ConstIterator it = m_colorMap.find( position ); + TQMap<Position, TQColor>::ConstIterator it = m_colorMap.tqfind( position ); if ( it == m_colorMap.end() ) return; erase( mapFromPosition( position ) ); - QPainter p( this ); + TQPainter p( this ); p.fillRect( ( position.x << 4 ) + 2, ( position.y << 4 ) + 2, 12, 12, it.data() ); } void KoColorPanel::init() { - setFocusPolicy( QWidget::NoFocus ); // it's empty + setFocusPolicy( TQ_NoFocus ); // it's empty m_nextPosition.x = 0; m_nextPosition.y = 0; m_focusPosition.x = -1; @@ -613,8 +613,8 @@ bool operator<( const KoColorPanel::Position& lhs, const KoColorPanel::Position& } -KoColorPopupProxy::KoColorPopupProxy( const QColor& defaultColor, KoColorPanel* recentColors, QObject* parent, const char* name ) : - QObject( parent, name ), m_defaultColor( defaultColor ), m_recentColors( recentColors ) +KoColorPopupProxy::KoColorPopupProxy( const TQColor& defaultColor, KoColorPanel* recentColors, TQObject* tqparent, const char* name ) : + TQObject( tqparent, name ), m_defaultColor( defaultColor ), m_recentColors( recentColors ) { } @@ -633,28 +633,28 @@ void KoColorPopupProxy::slotMoreColors() if ( !m_recentColors ) return; - QColor newColor; - QWidget* p = 0; - if ( parent() && parent()->isWidgetType() ) - p = static_cast<QWidget*>( parent() ); + TQColor newColor; + TQWidget* p = 0; + if ( tqparent() && tqparent()->isWidgetType() ) + p = TQT_TQWIDGET( tqparent() ); - if ( KColorDialog::getColor( newColor, p ) == QDialog::Accepted ) { + if ( KColorDialog::getColor( newColor, p ) == TQDialog::Accepted ) { m_recentColors->insertColor( newColor ); emit colorSelected( newColor ); } } -KoToolButton::KoToolButton( const QString& icon, int id, QWidget* parent, - const char* name, const QString& txt, KInstance* _instance ) : - KToolBarButton( icon, id, parent, name, txt, _instance ), m_arrowPressed( false ) +KoToolButton::KoToolButton( const TQString& icon, int id, TQWidget* tqparent, + const char* name, const TQString& txt, KInstance* _instance ) : + KToolBarButton( icon, id, tqparent, name, txt, _instance ), m_arrowPressed( false ) { init(); } -KoToolButton::KoToolButton( const QPixmap& pixmap, int id, QWidget* parent, - const char* name, const QString& txt ) : - KToolBarButton( pixmap, id, parent, name, txt ), m_arrowPressed( false ) +KoToolButton::KoToolButton( const TQPixmap& pixmap, int id, TQWidget* tqparent, + const char* name, const TQString& txt ) : + KToolBarButton( pixmap, id, tqparent, name, txt ), m_arrowPressed( false ) { init(); } @@ -663,79 +663,79 @@ KoToolButton::~KoToolButton() { } -QSize KoToolButton::sizeHint() const +TQSize KoToolButton::tqsizeHint() const { - return minimumSizeHint(); + return tqminimumSizeHint(); } -QSize KoToolButton::minimumSizeHint() const +TQSize KoToolButton::tqminimumSizeHint() const { - QSize size = KToolBarButton::minimumSizeHint(); + TQSize size = KToolBarButton::tqminimumSizeHint(); size.setWidth( size.width() + ARROW_WIDTH ); return size; } -QSize KoToolButton::minimumSize() const +TQSize KoToolButton::tqminimumSize() const { - return minimumSizeHint(); + return tqminimumSizeHint(); } -void KoToolButton::colorSelected( const QColor& color ) +void KoToolButton::colorSelected( const TQColor& color ) { - kdDebug() << "selected::: " << color.name() << endl; + kdDebug() << "selected::: " << TQString(color.name()) << endl; } -void KoToolButton::drawButton(QPainter *_painter) +void KoToolButton::drawButton(TQPainter *_painter) { - QStyle::SFlags flags = QStyle::Style_Default; - QStyle::SCFlags active = QStyle::SC_None; - QStyle::SCFlags arrowActive = QStyle::SC_None; - QStyleOption opt; - QColorGroup cg( colorGroup() ); + TQStyle::SFlags flags = TQStyle::Style_Default; + TQStyle::SCFlags active = TQStyle::SC_None; + TQStyle::SCFlags arrowActive = TQStyle::SC_None; + TQStyleOption opt; + TQColorGroup cg( tqcolorGroup() ); if ( isEnabled() ) { - flags |= QStyle::Style_Enabled; + flags |= TQStyle::Style_Enabled; if ( KToolBarButton::isRaised() || m_arrowPressed ) - flags |= QStyle::Style_Raised; + flags |= TQStyle::Style_Raised; } if ( isOn() ) - flags |= QStyle::Style_On; + flags |= TQStyle::Style_On; - QStyle::SFlags arrowFlags = flags; + TQStyle::SFlags arrowFlags = flags; if ( isDown() && !m_arrowPressed ) { - flags |= QStyle::Style_Down; - active |= QStyle::SC_ToolButton; + flags |= TQStyle::Style_Down; + active |= TQStyle::SC_ToolButton; } if ( m_arrowPressed ) - arrowActive |= QStyle::SC_ToolButton; + arrowActive |= TQStyle::SC_ToolButton; // Draw styled toolbuttons _painter->setClipRect( 0, 0, width() - ARROW_WIDTH, height() ); - style().drawComplexControl( QStyle::CC_ToolButton, _painter, this, QRect( 0, 0, width() - ARROW_WIDTH, height() ), cg, - flags, QStyle::SC_ToolButton, active, opt ); + tqstyle().tqdrawComplexControl( TQStyle::CC_ToolButton, _painter, this, TQRect( 0, 0, width() - ARROW_WIDTH, height() ), cg, + flags, TQStyle::SC_ToolButton, active, opt ); _painter->setClipRect( width() - ARROW_WIDTH, 0, ARROW_WIDTH, height() ); - style().drawComplexControl( QStyle::CC_ToolButton, _painter, this, QRect( width(), 0, ARROW_WIDTH, height() ), cg, - arrowFlags, QStyle::SC_ToolButton, arrowActive, opt ); + tqstyle().tqdrawComplexControl( TQStyle::CC_ToolButton, _painter, this, TQRect( width(), 0, ARROW_WIDTH, height() ), cg, + arrowFlags, TQStyle::SC_ToolButton, arrowActive, opt ); _painter->setClipping( false ); // ...and the arrow indicating the popup - style().drawPrimitive( QStyle::PE_ArrowDown, _painter, QRect( width() - ARROW_WIDTH - 1, 0, ARROW_WIDTH, height() ), + tqstyle().tqdrawPrimitive( TQStyle::PE_ArrowDown, _painter, TQRect( width() - ARROW_WIDTH - 1, 0, ARROW_WIDTH, height() ), cg, flags, opt ); if ( KToolBarButton::isRaised() || m_arrowPressed ) - qDrawShadeLine( _painter, width() - ARROW_WIDTH - 1, 0, width() - ARROW_WIDTH - 1, height() - 1, colorGroup(), true ); + qDrawShadeLine( _painter, width() - ARROW_WIDTH - 1, 0, width() - ARROW_WIDTH - 1, height() - 1, tqcolorGroup(), true ); int dx, dy; - QFont tmp_font( KGlobalSettings::toolBarFont() ); - QFontMetrics fm( tmp_font ); - QRect textRect; + TQFont tmp_font( KGlobalSettings::toolBarFont() ); + TQFontMetrics fm( tmp_font ); + TQRect textRect; int textFlags = 0; if ( static_cast<KToolBar::IconText>( iconTextMode() ) == KToolBar::IconOnly ) { // icon only - QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, - isEnabled() ? ( KToolBarButton::isActive() ? QIconSet::Active : QIconSet::Normal ) : - QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off ); + TQPixmap pixmap = iconSet().pixmap( TQIconSet::Automatic, + isEnabled() ? ( KToolBarButton::isActive() ? TQIconSet::Active : TQIconSet::Normal ) : + TQIconSet::Disabled, isOn() ? TQIconSet::On : TQIconSet::Off ); if ( !pixmap.isNull() ) { dx = ( width() - ARROW_WIDTH - pixmap.width() ) / 2; dy = ( height() - pixmap.height() ) / 2; @@ -744,9 +744,9 @@ void KoToolButton::drawButton(QPainter *_painter) } } else if ( static_cast<KToolBar::IconText>( iconTextMode() ) == KToolBar::IconTextRight ) { // icon and text (if any) - QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, - isEnabled() ? ( KToolBarButton::isActive() ? QIconSet::Active : QIconSet::Normal ) : - QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off ); + TQPixmap pixmap = iconSet().pixmap( TQIconSet::Automatic, + isEnabled() ? ( KToolBarButton::isActive() ? TQIconSet::Active : TQIconSet::Normal ) : + TQIconSet::Disabled, isOn() ? TQIconSet::On : TQIconSet::Off ); if( !pixmap.isNull()) { dx = 4; dy = ( height() - pixmap.height() ) / 2; @@ -762,7 +762,7 @@ void KoToolButton::drawButton(QPainter *_painter) dx = 4; dy = 0; buttonShift( dx, dy ); - textRect = QRect( dx, dy, width() - dx, height() ); + textRect = TQRect( dx, dy, width() - dx, height() ); } } else if ( static_cast<KToolBar::IconText>( iconTextMode() ) == KToolBar::TextOnly ) { @@ -771,13 +771,13 @@ void KoToolButton::drawButton(QPainter *_painter) dx = ( width() - ARROW_WIDTH - fm.width( textLabel() ) ) / 2; dy = ( height() - fm.lineSpacing() ) / 2; buttonShift( dx, dy ); - textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); + textRect = TQRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() ); } } else if ( static_cast<KToolBar::IconText>( iconTextMode() ) == KToolBar::IconTextBottom ) { - QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic, - isEnabled() ? ( KToolBarButton::isActive() ? QIconSet::Active : QIconSet::Normal ) : - QIconSet::Disabled, isOn() ? QIconSet::On : QIconSet::Off ); + TQPixmap pixmap = iconSet().pixmap( TQIconSet::Automatic, + isEnabled() ? ( KToolBarButton::isActive() ? TQIconSet::Active : TQIconSet::Normal ) : + TQIconSet::Disabled, isOn() ? TQIconSet::On : TQIconSet::Off ); if( !pixmap.isNull()) { dx = ( width() - ARROW_WIDTH - pixmap.width() ) / 2; dy = ( height() - fm.lineSpacing() - pixmap.height() ) / 2; @@ -790,7 +790,7 @@ void KoToolButton::drawButton(QPainter *_painter) dx = ( width() - ARROW_WIDTH - fm.width( textLabel() ) ) / 2; dy = height() - fm.lineSpacing() - 4; buttonShift( dx, dy ); - textRect = QRect( dx, dy, fm.width( textLabel() ), fm.lineSpacing() ); + textRect = TQRect( dx, dy, fm.width( textLabel() ), fm.lineSpacing() ); } } @@ -798,20 +798,20 @@ void KoToolButton::drawButton(QPainter *_painter) if (!textLabel().isNull() && !textRect.isNull()) { _painter->setFont( KGlobalSettings::toolBarFont() ); if ( !isEnabled() ) - _painter->setPen( palette().disabled().dark() ); + _painter->setPen( tqpalette().disabled().dark() ); else if( KToolBarButton::isRaised() ) _painter->setPen( KGlobalSettings::toolBarHighlightColor() ); else - _painter->setPen( colorGroup().buttonText() ); + _painter->setPen( tqcolorGroup().buttonText() ); _painter->drawText( textRect, textFlags, textLabel() ); } } -bool KoToolButton::eventFilter( QObject* o, QEvent* e ) +bool KoToolButton::eventFilter( TQObject* o, TQEvent* e ) { - if ( o == m_popup ) { - if ( e->type() == QEvent::MouseButtonPress ) - if ( hitArrow( mapFromGlobal( static_cast<QMouseEvent*>( e )->globalPos() ) ) ) { + if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(m_popup) ) { + if ( e->type() == TQEvent::MouseButtonPress ) + if ( hitArrow( mapFromGlobal( TQT_TQMOUSEEVENT( e )->globalPos() ) ) ) { kdDebug() << "KoToolButton::eventFilter-------------->" << endl; m_popup->close(); m_arrowPressed = false; @@ -820,39 +820,39 @@ bool KoToolButton::eventFilter( QObject* o, QEvent* e ) return false; } - if ( e->type() == QEvent::MouseButtonPress ) { - m_arrowPressed = hitArrow( static_cast<QMouseEvent*>( e )->pos() ); + if ( e->type() == TQEvent::MouseButtonPress ) { + m_arrowPressed = hitArrow( TQT_TQMOUSEEVENT( e )->pos() ); if ( m_arrowPressed ) - m_popup->popup( mapToGlobal( QPoint( 0, height() ) ) ); + m_popup->popup( mapToGlobal( TQPoint( 0, height() ) ) ); } - else if ( e->type() == QEvent::MouseButtonRelease ) + else if ( e->type() == TQEvent::MouseButtonRelease ) m_arrowPressed = false; return KToolBarButton::eventFilter( o, e ); } void KoToolButton::init() { - m_popup = KoColorPanel::createColorPopup( KoColorPanel::CustomColors, Qt::yellow, this, - SLOT( colorSelected( const QColor& ) ), + m_popup = KoColorPanel::createColorPopup( KoColorPanel::CustomColors, TQt::yellow, TQT_TQOBJECT(this), + TQT_SLOT( colorSelected( const TQColor& ) ), this, "no-name" ); // We are interested in the mouse clicks on the arrow button m_popup->installEventFilter( this ); - ARROW_WIDTH = style().pixelMetric(QStyle::PM_MenuButtonIndicator) + 4; + ARROW_WIDTH = tqstyle().tqpixelMetric(TQStyle::PM_MenuButtonIndicator) + 4; kdDebug() << "##################### Arrow: " << ARROW_WIDTH << endl; } void KoToolButton::buttonShift( int& dx, int& dy ) { if ( isDown() && !m_arrowPressed ) { - dx += style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ); - dy += style().pixelMetric( QStyle::PM_ButtonShiftVertical ); + dx += tqstyle().tqpixelMetric( TQStyle::PM_ButtonShiftHorizontal ); + dy += tqstyle().tqpixelMetric( TQStyle::PM_ButtonShiftVertical ); } } -bool KoToolButton::hitArrow( const QPoint& pos ) +bool KoToolButton::hitArrow( const TQPoint& pos ) { - return QRect( width() - ARROW_WIDTH, 0, ARROW_WIDTH, height() ).contains( pos ); + return TQRect( width() - ARROW_WIDTH, 0, ARROW_WIDTH, height() ).tqcontains( pos ); } #include <KoTooluButton.moc> |