#ifndef LAYOUT_H #define LAYOUT_H //#define _WINDOWS #include #include "htmlayout.h" #include class layoutFilter { static int cRef; static bool eventFilter(void *message) { HTMLayoutTranslateMessage((MSG*)message); return false; } static QAbstractEventDispatcher::EventFilter prevFilter; public: layoutFilter() { if (!cRef) prevFilter=QAbstractEventDispatcher::instance()->setEventFilter(eventFilter); cRef++; } ~layoutFilter() { if (cRef) cRef--; if (!cRef) QAbstractEventDispatcher::instance()->setEventFilter(prevFilter); } }; class Layout : public QWidget, htmlayout::event_handler // - handles DOM event { Q_OBJECT layoutFilter m_eventFilter; public: Layout(QWidget *parent = 0, Qt::WFlags flags = 0); ~Layout(); LRESULT OnCreateControl( LPNMHL_CREATE_CONTROL nm) { return 0; } LRESULT OnControlCreated( LPNMHL_CREATE_CONTROL nm) { return 0; } LRESULT OnDestroyControl( LPNMHL_DESTROY_CONTROL nm) { return 0; } LRESULT OnLoadData( LPNMHL_LOAD_DATA nm) { return 0; } LRESULT OnDataLoaded( LPNMHL_DATA_LOADED nm) { return 0; } LRESULT OnDocumentComplete() { return 0; } LRESULT OnAttachBehavior( LPNMHL_ATTACH_BEHAVIOR nm ); private: virtual bool winEvent ( MSG * message, long * result ); virtual BOOL on_script_call(HELEMENT he, LPCSTR name, UINT argc, json::value* argv, json::value& retval); protected: }; #endif // LAYOUT_H