From aa0726b20f398264f0a2abc60215be044b106f9c Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 17 May 2011 08:20:48 +0000 Subject: 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 --- src/linklabel.h | 114 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 58 insertions(+), 56 deletions(-) (limited to 'src/linklabel.h') diff --git a/src/linklabel.h b/src/linklabel.h index 3e964c1..bee254c 100644 --- a/src/linklabel.h +++ b/src/linklabel.h @@ -21,17 +21,17 @@ #ifndef LINKLABEL_H #define LINKLABEL_H -#include +#include -class QString; +class TQString; class KURL; -class QColor; -class QLabel; -class QBoxLayout; -class QSpacerItem; -class QPushButton; -class QCheckBox; -class QComboBox; +class TQColor; +class TQLabel; +class TQBoxLayout; +class TQSpacerItem; +class TQPushButton; +class TQCheckBox; +class TQComboBox; class KColorCombo2; class IconSizeCombo; @@ -51,13 +51,13 @@ class LinkLook LinkLook(bool useLinkColor = true, bool canPreview = true); LinkLook(const LinkLook &other); void setLook( bool italic, bool bold, int underlining, - QColor color, QColor hoverColor, + TQColor color, TQColor hoverColor, int iconSize, int preview /*= None*/ ); inline bool italic() const { return m_italic; } inline bool bold() const { return m_bold; } inline int underlining() const { return m_underlining; } - inline QColor color() const { return m_color; } - inline QColor hoverColor() const { return m_hoverColor; } + inline TQColor color() const { return m_color; } + inline TQColor hoverColor() const { return m_hoverColor; } inline int iconSize() const { return m_iconSize; } inline int preview() const { return m_preview; } inline bool useLinkColor() const { return m_useLinkColor; } @@ -67,17 +67,17 @@ class LinkLook bool underlineInside() const { return underlining() == Always || underlining() == OnMouseHover; } bool previewEnabled() const { return canPreview() && preview() > None; } int previewSize() const; - QColor effectiveColor() const; - QColor effectiveHoverColor() const; - QColor defaultColor() const; - QColor defaultHoverColor() const; - QString toCSS(const QString &cssClass, const QColor &defaultTextColor) const; + TQColor effectiveColor() const; + TQColor effectiveHoverColor() const; + TQColor defaultColor() const; + TQColor defaultHoverColor() const; + TQString toCSS(const TQString &cssClass, const TQColor &defaultTextColor) const; private: bool m_italic; bool m_bold; int m_underlining; - QColor m_color; - QColor m_hoverColor; + TQColor m_color; + TQColor m_hoverColor; int m_iconSize; int m_preview; bool m_useLinkColor; @@ -97,32 +97,33 @@ class LinkLook * Note : This label will appear blank while LinkLook willn't be set * @author S�astien Laot */ -class LinkLabel : public QFrame +class LinkLabel : public TQFrame { Q_OBJECT + TQ_OBJECT public: - LinkLabel(int hAlign, int vAlign, QWidget *parent = 0, const char *name = 0, WFlags f = 0); - LinkLabel(const QString &title, const QString &icon, LinkLook *look, int hAlign, int vAlign, - QWidget *parent = 0, const char *name = 0, WFlags f = 0); + LinkLabel(int hAlign, int vAlign, TQWidget *tqparent = 0, const char *name = 0, WFlags f = 0); + LinkLabel(const TQString &title, const TQString &icon, LinkLook *look, int hAlign, int vAlign, + TQWidget *tqparent = 0, const char *name = 0, WFlags f = 0); ~LinkLabel(); public: - void setLink(const QString &title, const QString &icon, LinkLook *look = 0); + void setLink(const TQString &title, const TQString &icon, LinkLook *look = 0); void setLook(LinkLook *look); void setAlign(int hAlign, int vAlign); void setSelected(bool selected); - void setPaletteBackgroundColor(const QColor &color); + void setPaletteBackgroundColor(const TQColor &color); int heightForWidth(int w = -1) const; - QString toHtml(const QString &imageName); + TQString toHtml(const TQString &imageName); protected: void initLabel(int hAlign, int vAlign); - void enterEvent(QEvent*); - void leaveEvent(QEvent*); + void enterEvent(TQEvent*); + void leaveEvent(TQEvent*); private: - QBoxLayout *m_layout; - QLabel *m_icon; - QLabel *m_title; - QSpacerItem *m_spacer1; - QSpacerItem *m_spacer2; + TQBoxLayout *m_layout; + TQLabel *m_icon; + TQLabel *m_title; + TQSpacerItem *m_spacer1; + TQSpacerItem *m_spacer2; bool m_isSelected; bool m_isHovered; @@ -142,8 +143,8 @@ class LinkDisplay public: LinkDisplay(); /// << Create a new empty unselected LinkDisplay. Please then call setLink() to make sense. // Configure the link displayer: - void setLink(const QString &title, const QString &icon, LinkLook *look, const QFont &font); /// << Change the content and disposition. minWidth(), width() & height() can have changed. Keep the old preview (if any) - void setLink(const QString &title, const QString &icon, const QPixmap &preview, LinkLook *look, const QFont &font); /// << Idem but change the preview too (or remove it if it is invalid) + void setLink(const TQString &title, const TQString &icon, LinkLook *look, const TQFont &font); /// << Change the content and disposition. minWidth(), width() & height() can have changed. Keep the old preview (if any) + void setLink(const TQString &title, const TQString &icon, const TQPixmap &preview, LinkLook *look, const TQFont &font); /// << Idem but change the preview too (or remove it if it is invalid) void setWidth(int width); /// << Set a new width. @see height() that will be computed. // Get its properties: int minWidth() const { return m_minWidth; } /// << @return the minimum width to display this link. @@ -151,22 +152,22 @@ class LinkDisplay int width() const { return m_width; } /// << @return the width of the link. It is never less than minWidth()! int height() const { return m_height; } /// << @return the height if the link after having set it a width. // And finaly, use it: - void paint(QPainter *painter, int x, int y, int width, int height, const QColorGroup &colorGroup, bool isDefaultColor, bool isSelected, bool isHovered, bool isIconButtonHovered) const; /// << Draw the link on a painter. Set textColor to be !isValid() to use the LinkLook color. Otherwise it will use this color! - QPixmap feedbackPixmap(int width, int height, const QColorGroup &colorGroup, bool isDefaultColor); /// << @return the pixmap to put under the cursor while dragging this object. + void paint(TQPainter *painter, int x, int y, int width, int height, const TQColorGroup &tqcolorGroup, bool isDefaultColor, bool isSelected, bool isHovered, bool isIconButtonHovered) const; /// << Draw the link on a painter. Set textColor to be !isValid() to use the LinkLook color. Otherwise it will use this color! + TQPixmap feedbackPixmap(int width, int height, const TQColorGroup &tqcolorGroup, bool isDefaultColor); /// << @return the pixmap to put under the cursor while dragging this object. // Eventually get some information about the link display: - bool iconButtonAt(const QPoint &pos) const; /// << @return true if the icon button is under point @p pos. - QRect iconButtonRect() const; /// << @return the rectangle of the icon button. + bool iconButtonAt(const TQPoint &pos) const; /// << @return true if the icon button is under point @p pos. + TQRect iconButtonRect() const; /// << @return the rectangle of the icon button. // Utility function: - QFont labelFont(QFont font, bool isIconButtonHovered) const; /// << @return the font for this link, according to parent font AND LinkLook! + TQFont labelFont(TQFont font, bool isIconButtonHovered) const; /// << @return the font for this link, according to tqparent font AND LinkLook! int heightForWidth(int width) const; /// << @return the needed height to display the link in function of a width. - QString toHtml(const QString &imageName) const; /// << Convert the link to HTML code, using the LinkLook to style it. - QString toHtml(HTMLExporter *exporter, const KURL &url, const QString &title = ""); + TQString toHtml(const TQString &imageName) const; /// << Convert the link to HTML code, using the LinkLook to style it. + TQString toHtml(HTMLExporter *exporter, const KURL &url, const TQString &title = ""); private: - QString m_title; - QString m_icon; - QPixmap m_preview; + TQString m_title; + TQString m_icon; + TQPixmap m_preview; LinkLook *m_look; - QFont m_font; + TQFont m_font; int m_minWidth; int m_maxWidth; int m_width; @@ -176,12 +177,13 @@ class LinkDisplay /** A widget to edit a LinkLook, showing a live example to the user. * @author S�astien Laot */ -class LinkLookEditWidget : public QWidget +class LinkLookEditWidget : public TQWidget { Q_OBJECT + TQ_OBJECT public: - LinkLookEditWidget(KCModule* module, const QString exTitle, const QString exIcon, - QWidget *parent = 0, const char *name = 0, WFlags fl = 0); + LinkLookEditWidget(KCModule* module, const TQString exTitle, const TQString exIcon, + TQWidget *tqparent = 0, const char *name = 0, WFlags fl = 0); ~LinkLookEditWidget(); void saveChanges(); void saveToLook(LinkLook *look); @@ -190,19 +192,19 @@ class LinkLookEditWidget : public QWidget void slotChangeLook(); protected: LinkLook *m_look; - QCheckBox *m_italic; - QCheckBox *m_bold; - QComboBox *m_underlining; + TQCheckBox *m_italic; + TQCheckBox *m_bold; + TQComboBox *m_underlining; KColorCombo2 *m_color; KColorCombo2 *m_hoverColor; IconSizeCombo *m_iconSize; - QComboBox *m_preview; + TQComboBox *m_preview; LinkLook *m_exLook; LinkLabel *m_example; - QString m_exTitle; - QString m_exIcon; + TQString m_exTitle; + TQString m_exIcon; HelpLabel *m_hLabel; - QLabel *m_label; + TQLabel *m_label; }; #endif // LINKLABEL_H -- cgit v1.2.1