| 
									
										
										
										
											2019-09-25 12:44:22 +03:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <LibGUI/GScrollableWidget.h>
 | 
					
						
							|  |  |  | #include <LibHTML/DOM/Document.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class HtmlView : public GScrollableWidget { | 
					
						
							|  |  |  |     C_OBJECT(HtmlView) | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     virtual ~HtmlView() override {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Document* document() { return m_document; } | 
					
						
							|  |  |  |     const Document* document() const { return m_document; } | 
					
						
							|  |  |  |     void set_document(Document*); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-29 12:04:02 +02:00
										 |  |  |     Function<void(const String&)> on_link_click; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-25 12:44:22 +03:00
										 |  |  | protected: | 
					
						
							|  |  |  |     HtmlView(GWidget* parent = nullptr); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     virtual void resize_event(GResizeEvent&) override; | 
					
						
							|  |  |  |     virtual void paint_event(GPaintEvent&) override; | 
					
						
							| 
									
										
										
										
											2019-09-28 23:02:22 +02:00
										 |  |  |     virtual void mousemove_event(GMouseEvent&) override; | 
					
						
							| 
									
										
										
										
											2019-09-29 12:04:02 +02:00
										 |  |  |     virtual void mousedown_event(GMouseEvent&) override; | 
					
						
							| 
									
										
										
										
											2019-09-25 12:44:22 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							|  |  |  |     void layout_and_sync_size(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     RefPtr<Document> m_document; | 
					
						
							|  |  |  |     RefPtr<LayoutNode> m_layout_root; | 
					
						
							|  |  |  | }; |