diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-17 08:20:48 +0000 |
commit | aa0726b20f398264f0a2abc60215be044b106f9c (patch) | |
tree | 070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/kcolorcombo2.h | |
parent | d3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff) | |
download | basket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip |
TQt4 port basket
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kcolorcombo2.h')
-rw-r--r-- | src/kcolorcombo2.h | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/src/kcolorcombo2.h b/src/kcolorcombo2.h index ec264fc..e671dad 100644 --- a/src/kcolorcombo2.h +++ b/src/kcolorcombo2.h @@ -21,9 +21,9 @@ #ifndef KCOLORCOMBO2_H #define KCOLORCOMBO2_H -#include <qcombobox.h> -#include <qcolor.h> -#include <qpixmap.h> +#include <tqcombobox.h> +#include <tqcolor.h> +#include <tqpixmap.h> class KColorPopup; @@ -41,17 +41,17 @@ class KColorPopup; * Just create a new KColorCombo2() with the initial color and eventually an allowed default color * (eg. KGlobalSettings::baseColor() for a background color, KGlobalSettings::textColor()...).\n * You will be noticed of the color the user selects with the signal changed(), or you can use color() to get the color at any moment.\n - * Note that they can return an invalid color (see QColor::isValid()) if the user chosen the default color (if he can choose that).\n + * Note that they can return an invalid color (see TQColor::isValid()) if the user chosen the default color (if he can choose that).\n * It's then easy to save in settings, but if you want the real color (even for the default), you can get it with effectiveColor(). * * @par Notes about default color: - * If you set a default color using Qt or KDE standard colors, the user can change them in the KDE Control Center, + * If you set a default color using TQt or KDE standard colors, the user can change them in the KDE Control Center, * but this widget willn't be update and will still show the old one.\n * To be noticed of such color change and then update the widget with the new standard color, you can use one of those two methods: * @code - * void QWidgetDerivate::paletteChange(const QPalette &oldPalette) { // QWidgetDerivate is a parent or near custom widget + * void TQWidgetDerivate::paletteChange(const TQPalette &oldPalette) { // TQWidgetDerivate is a tqparent or near custom widget * theComboBox->setDefaultColor(theNewDefaultColor); - * QWidget::paletteChange(oldPalette); + * TQWidget::paletteChange(oldPalette); * } * @endcode * or connect the signal KApplication::kdisplayPaletteChanged() to a slot that will set the default color of this widget. @@ -73,11 +73,12 @@ class KColorPopup; * * @image html commoncolorselector.png "Common Color Selector ComboBox" */ -class KColorCombo2 : public QComboBox +class KColorCombo2 : public TQComboBox { Q_OBJECT - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(QColor defaultColor READ defaultColor WRITE setDefaultColor) + TQ_OBJECT + TQ_PROPERTY(TQColor color READ color WRITE setColor) + TQ_PROPERTY(TQColor defaultColor READ defaultColor WRITE setDefaultColor) public slots: /** @@ -86,37 +87,37 @@ class KColorCombo2 : public QComboBox * @param color The new selected color. Can be invalid to select the default one.\n * If @p color is invalid and no default color is allowed, the function will keep the old one. */ - void setColor(const QColor &color); + void setColor(const TQColor &color); /** * Change the default color. * @param color The color to return if the user choose the default one. If it is not valid, the user willn't be allowed to choose a default one. * @see defaultColor() to get it. */ - void setDefaultColor(const QColor &color); + void setDefaultColor(const TQColor &color); signals: /** * Emitted when the color of the widget is changed, either with setColor() or via user selection. * @see color() to know the content of @p newColor. */ - void changed(const QColor &newColor); + void changed(const TQColor &newColor); public: /** - * Constructs a color combobox with parent @p parent called @p name. + * Constructs a color combobox with tqparent @p tqparent called @p name. * @param color The initial selected color. If it is not valid, the default one will then be selected.\n * But if @p color is invalid and there is no default color, the result is undefined. * @param defaultColor The color to return if the user choose the default one. If it is not valid, the user willn't be allowed to choose a default one. */ - KColorCombo2(const QColor &color, const QColor &defaultColor, QWidget *parent = 0, const char *name = 0); + KColorCombo2(const TQColor &color, const TQColor &defaultColor, TQWidget *tqparent = 0, const char *name = 0); /** - * Constructs a color combobox with parent @p parent called @p name.\n + * Constructs a color combobox with tqparent @p tqparent called @p name.\n * The user is not allowed to choose a default color, unless you call setDefaultColor() later. * @param color The initial selected color. If it is invalid, the result is undefined. */ - KColorCombo2(const QColor &color, QWidget *parent = 0L, const char *name = 0L); + KColorCombo2(const TQColor &color, TQWidget *tqparent = 0L, const char *name = 0L); /** * Destroys the combobox. @@ -129,7 +130,7 @@ class KColorCombo2 : public QComboBox * Ideal to store it in settings for later recall. * @see effectiveColor() if you want the color to be always valid. */ - QColor color() const; + TQColor color() const; /** * Return the color chosen by the user.\n @@ -137,13 +138,13 @@ class KColorCombo2 : public QComboBox * Ideal to directly use to draw. * @see color() if you want to be notified of a default color choice. */ - QColor effectiveColor() const; + TQColor effectiveColor() const; /** * Returns the default color or an invalid color if no default color is set (if the user isn't allowed to choose a default color). * @see setDefaultColor() to change it. */ - QColor defaultColor() const; + TQColor defaultColor() const; /** * Allocate a new color array of the specified dimention.\n @@ -176,7 +177,7 @@ class KColorCombo2 : public QComboBox * @param row The y coordinate of the color to set or change. * @param color The color to assign at this position. */ - void setColorAt(int column, int row, const QColor &color); + void setColorAt(int column, int row, const TQColor &color); /** * Get a color in the array that the user can see to choose.\n @@ -185,7 +186,7 @@ class KColorCombo2 : public QComboBox * @return The asked color, or an invalid color if the index is out of limit of the array. * @see columnCount() and rowCount() to get the array dimentions. */ - QColor colorAt(int column, int row)/* const*/; + TQColor colorAt(int column, int row)/* const*/; /** * Fill the array of colors (that will be shown to the user in the popup that appears when he/she click the arrow) with a rainbow of different luminosity.\n @@ -208,7 +209,7 @@ class KColorCombo2 : public QComboBox * @p darkRowCount to a small one for a fewer choice of dark colors, but at least some ones. */ void setRainbowPreset(int colorColumnCount = 12, int lightRowCount = 4, int darkRowCount = 4, bool withGray = true); - //void setHsvPreset(QColor hue[], QColor saturation[], QColor value[], bool withGray = true); + //void setHsvPreset(TQColor hue[], TQColor saturation[], TQColor value[], bool withGray = true); /** * Returns a pixmap of a colored rounded-rectangle. The four corners are transparent.\n @@ -220,11 +221,11 @@ class KColorCombo2 : public QComboBox * * @see drawColorRect() if you need to draw it directly: it's faster. */ - static QPixmap colorRectPixmap(const QColor &color, bool isDefault, int width, int height); + static TQPixmap colorRectPixmap(const TQColor &color, bool isDefault, int width, int height); /** * Draw an image of a colored rounded-rectangle.\n - * This is like colorRectPixmap() but significantly faster because there is nothing to copy, and no transparency mask to create and apply. + * This is like colorRectPixmap() but significantly faster because there is nothing to copy, and no transparency tqmask to create and apply. * @param painter The painter where to draw the image. * @param x The x coordinate on the @p painter where to draw the rectangle. * @param y The y coordinate on the @p painter where to draw the rectangle. @@ -235,7 +236,7 @@ class KColorCombo2 : public QComboBox * * @see colorRectPixmap() to get a transparent pixmap of the rectangle. */ - static void drawColorRect(QPainter &painter, int x, int y, const QColor &color, bool isDefault, int width, int height); + static void drawColorRect(TQPainter &painter, int x, int y, const TQColor &color, bool isDefault, int width, int height); /** * Get the height of a color rectangle for this combobox.\n @@ -251,18 +252,18 @@ class KColorCombo2 : public QComboBox protected: virtual void popup(); - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseMoveEvent(QMouseEvent *event); - virtual bool eventFilter(QObject *object, QEvent *event); - virtual void dragEnterEvent(QDragEnterEvent *event); - virtual void dropEvent(QDropEvent *event); - virtual void keyPressEvent(QKeyEvent *event); - virtual void fontChange(const QFont &oldFont); + virtual void mousePressEvent(TQMouseEvent *event); + virtual void mouseMoveEvent(TQMouseEvent *event); + virtual bool eventFilter(TQObject *object, TQEvent *event); + virtual void dragEnterEvent(TQDragEnterEvent *event); + virtual void dropEvent(TQDropEvent *event); + virtual void keyPressEvent(TQKeyEvent *event); + virtual void fontChange(const TQFont &oldFont); private: /** * Initialization routine common to every constructors.\n - * Constructors just have to initialize the QComboBox, m_color and m_defaultColor + * Constructors just have to initialize the TQComboBox, m_color and m_defaultColor * and this function do the rest to complete the creation of this widget. */ void init(); @@ -280,13 +281,13 @@ class KColorCombo2 : public QComboBox void updateComboBox(); KColorPopup *m_popup; - QColor m_color; - QColor m_defaultColor; + TQColor m_color; + TQColor m_defaultColor; bool m_discardNextMousePress; - QColor **m_colorArray; + TQColor **m_colorArray; int m_columnCount; int m_rowCount; - QPoint m_dragStartPos; + TQPoint m_dragStartPos; protected: /** @@ -306,20 +307,21 @@ class KColorCombo2 : public QComboBox -// TODO: setColorArray(QColor **, int, int) and use signals/slots ?? +// TODO: setColorArray(TQColor **, int, int) and use signals/slots ?? -class KColorPopup : public QWidget +class KColorPopup : public TQWidget { Q_OBJECT + TQ_OBJECT public: - KColorPopup(KColorCombo2 *parent); + KColorPopup(KColorCombo2 *tqparent); ~KColorPopup(); - void relayout(); // updateGeometry() ?? + void retqlayout(); // updateGeometry() ?? protected: - void paintEvent(QPaintEvent */*event*/); - void mouseMoveEvent(QMouseEvent *event); - void mousePressEvent(QMouseEvent *event); - void keyPressEvent(QKeyEvent *event); + void paintEvent(TQPaintEvent */*event*/); + void mouseMoveEvent(TQMouseEvent *event); + void mousePressEvent(TQMouseEvent *event); + void keyPressEvent(TQKeyEvent *event); void doSelection(); void validate(); void updateCell(int column, int row); @@ -328,11 +330,11 @@ class KColorPopup : public QWidget private: KColorCombo2 *m_selector; - QPixmap m_pixmap; + TQPixmap m_pixmap; int m_selectedRow; int m_selectedColumn; int m_columnOther; - QColor m_otherColor; + TQColor m_otherColor; static const int MARGIN; static const int FRAME_WIDTH; |