/* ============================================================  *  * This file is a part of the reKonq project  * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008 by Andrea Diamantini  * *  * This program is free software; you can redistribute it  * and/or modify it under the terms of the GNU General  * Public License as published by the Free Software Foundation;  * either version 2, or (at your option) any later version.  *  * This program is distributed in the hope that it will be useful,  * but WITHOUT ANY WARRANTY; without even the implied warranty of  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  * GNU General Public License for more details.  *  * ============================================================ */ #ifndef URLLINEEDIT_H #define URLLINEEDIT_H // Qt Includes #include #include #include QT_BEGIN_NAMESPACE class QLineEdit; QT_END_NAMESPACE class ClearButton; class ExLineEdit : public QWidget { Q_OBJECT public: ExLineEdit(QWidget *parent = 0); inline QLineEdit *lineEdit() const { return m_lineEdit; } void setLeftWidget(QWidget *widget); QWidget *leftWidget() const; QSize sizeHint() const; protected: void focusInEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event); void keyPressEvent(QKeyEvent *event); void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *event); bool event(QEvent *event); protected: void updateGeometries(); void initStyleOption(QStyleOptionFrameV2 *option) const; QWidget *m_leftWidget; QLineEdit *m_lineEdit; ClearButton *m_clearButton; }; class UrlIconLabel; class WebView; class UrlLineEdit : public ExLineEdit { Q_OBJECT public: UrlLineEdit(QWidget *parent = 0); void setWebView(WebView *webView); protected: void paintEvent(QPaintEvent *event); void focusOutEvent(QFocusEvent *event); private slots: void webViewUrlChanged(const QUrl &url); void webViewIconChanged(); private: QLinearGradient generateGradient(const QColor &color) const; WebView *m_webView; UrlIconLabel *m_iconLabel; QColor m_defaultBaseColor; }; #endif // URLLINEEDIT_H