/*! @file

    @id $Id$
*/
//       1         2         3         4         5         6         7         8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890

#ifndef __WEBVIEWWIDGETIFC_HXX
#define __WEBVIEWWIDGETIFC_HXX

#include <qbrowserlib/swisswebview.hxx>
#include <QtDesigner>

#ifndef LOG
#define LOG qDebug()<<__PRETTY_FUNCTION__
#endif

//! @defgroup designer
//! @{

//! WebView widget for Qt Designer
class SwissWebViewWidgetIfc: public QObject,
                             public QDesignerCustomWidgetInterface {
    Q_OBJECT;
    Q_INTERFACES(QDesignerCustomWidgetInterface);
  public:
    SwissWebViewWidgetIfc(): _initialized(false) {}
    bool isContainer() const {
      LOG;
      return true;
    }
    QIcon icon() const {
      LOG;
      return QIcon(":/icons/swisswebview.png");
    }
    QString domXml() const {
      LOG;
      return
        QString
        ("<ui language=\"c++\" displayname=\"%1\">"
         "     <widget class=\"%1\" name=\"%2\"/>"
         "     <customwidgets>"
         "         <customwidget>"
         "             <class>%1</class>"
         "         </customwidget>"
         "     </customwidgets>"
         "</ui>")
        .arg(name())
        .arg(name().toLower());
    }
    QString group() const {
      LOG;
      return "Display Widgets [Examples]";
    }
    QString includeFile() const {
      LOG;
      return "qbrowserlib/swisswebview.hxx";
    }
    QString name() const {
      LOG;
      return "SwissWebView";
    }
    QString toolTip() const {
      LOG;
      return "";
    }
    QString whatsThis() const {
      LOG;
      return "";
    }
    QWidget *createWidget(QWidget *parent) {
      LOG;
      return new SwissWebView(parent);
    }
    bool isInitialized() {
      LOG;
      return _initialized;
    }
    void initialized() {
      LOG;
      _initialized = true;
    }
  private:
    bool _initialized;
};

//! @}
#endif
