📄 mghtmlview.h
字号:
#ifndef KHTML_H#define KHTML_H#include "mgsize.h"#include "mgwidget.h"#include "render_root.h" #ifdef JAVASCRIPT_ENABLE#if 0#include <libjs/jsapi.h>#include "../mgjs/mgjs_main.h"#endiftypedef struct tagJsTimer{ int id; char *exp; int expLength; } JsTimerStruct;typedef struct tagJsEvent{ int32 type; jsval value; } JsEventStruct;#endif // JAVASCRIPT_ENABLEtemplate<class C> class QList;class MGHTMLPart;class MGHTMLViewPrivate;class MGPainter;class MGWidget;class MGSize;namespace DOM { class HTMLDocumentImpl; class ElementImpl; class HTMLElementImpl; class HTMLTitleElementImpl; class HTMLGenericFormElementImpl; class Range; class NodeImpl; class CSSProperty;};namespace khtml { class RenderObject; class RenderRoot; class RenderStyle; void applyRule(RenderStyle *style, DOM::CSSProperty *prop, DOM::ElementImpl *e);};class MGHTMLView : public MGWidget // derived from window class{ friend class DOM::HTMLDocumentImpl; friend class DOM::HTMLElementImpl; friend class DOM::HTMLTitleElementImpl; friend class MGKHTMLPart; friend class khtml::RenderRoot; friend class DOM::HTMLGenericFormElementImpl; friend void khtml::applyRule(khtml::RenderStyle *style, DOM::CSSProperty *prop, DOM::ElementImpl *e);public: khtml::RenderRoot *renderroot; MGHTMLView(); virtual ~MGHTMLView(); bool createView( int x, int y, int w, int h, bool visible, HWND hParent ); DOM::HTMLDocumentImpl* doc() const; MGHTMLPart *part() const {return m_part;} void setMarginWidth(int x) {_marginWidth = x;} int marginWidth() const {return _marginWidth;} void setMarginHeight(int y) {_marginHeight = y;} int marginHeight() {return _marginHeight; } int contentsX() const; int contentsY() const; int visibleWidth() const; int visibleHeight() const; void resizeContents( int w, int h ); // new function void updateContents( int x, int y, int w, int h ); // new function void repaintContents( int x, int y, int w, int h, bool ); // new function// bool openURL(const char* url); // new function bool openURL(); bool openURLFromBuffer(char *); void scrollBy (int deltax, int deltay); // new function void setContentsPos( int x, int y); // new function int frameWidth() const { return _width; } // virtual functions virtual void layout(); // modified function virtual void addChild( MGWidget *child, int x = 0, int y = 0 ); // new function bool gotoNextLink(); bool gotoPrevLink(); // visualize that the item under the cursor has been pressed (true) or released(false) void toggleActLink(bool); // Set vertical scrollbar mode. Reimplemented for internal reasons. virtual void setVScrollBarMode (LONG mode ); // Set horizontal scrollbar mode. Reimplemented for internal reasons. virtual void setHScrollBarMode (LONG mode ); void useSlowRepaints(); void clear(); DOM::NodeImpl *nodeUnderMouse() const; void setURL(char * url); void setURL(KURL url); MGHTMLPart * getPart(); KURL m_windowurl; bool LoadedMsgFromNet(unsigned char *url,unsigned char *buf,int len,int nType); void setLayouted(DOM::HTMLElementImpl *child,bool f); protected: static int HTMLViewProc( HWND hWnd, int message, WPARAM wParam, LPARAM lParam );private: void ShowChildWidget( bool show ); // new function void OnMouseMoveEvent (int x, int y, DWORD flags = 0); // new function void OnMousePressEvent (int x, int y, DWORD flags = 0); // new function void OnMouseDoubleClickEvent (int x, int y, DWORD flags = 0); // new function void OnMouseReleaseEvent( int x, int y, DWORD flags = 0); // new function void OnKeyPressEvent (int key, DWORD flags = 0); // new function void OnKeyReleaseEvent (int key, DWORD flags = 0); // new function void setLinkCursor(DOM::HTMLElementImpl *); bool gotoLink(); bool gotoLink(DOM::HTMLElementImpl *); bool gotoLink (bool); //after data has been loaded to cache,then notify htmldocimpl and htmltokenizer. //if all script are loaded, close doc and free doc's tokenizer. bool ScriptDataProcessed(); //signals: // void cleared();protected: void paintElement( khtml::RenderObject *o, int x, int y ); //virtual void resizeEvent ( QResizeEvent * event ); virtual bool focusNextPrevChild( bool next ); virtual void drawContents ( HDC hdc, int clipx, int clipy, int clipw, int cliph ); void doAutoScroll(); void layoutIFrame(DOM::HTMLElementImpl *child); private: void init(); void restoreScrollBar(); QString filename; // ------------------------------------- member variables ------------------------------------protected: static QList<MGHTMLView> *lstViews; //List of all open browsers. MGSize m_clntSize;public: int m_xOffset; int m_yOffset;protected: MGHTMLPart* m_part; MGPainter* m_painter; HCURSOR m_handCursor; MGHTMLViewPrivate* d; int _width; int _height; int _marginWidth; int _marginHeight;public: DOM::HTMLDocumentImpl* m_doc;#ifdef JAVASCRIPT_ENABLEpublic: JSRuntime* m_JSRuntime; JSObject* m_JSObject; JSContext* m_JSContext; QList<JsTimerStruct> m_JsTimer; int m_JsTimerId; QList<JsEventStruct> m_JsEvent; int m_JsEventSum; int32 m_JsEventTypeToCapture; int32 m_JsEventType, m_JsKeyEventValue; int m_JsEventPageX, m_JsEventPageY; bool m_bJsEventDocument;#endif };#endif// check connect(cleared())?????????
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -