mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 22:12:44 +00:00 
			
		
		
		
	 567769eb2f
			
		
	
	
		567769eb2f
		
	
	
	
	
		
			
			You can now move the widgets around, either by themselves or in group selections, by dragging them with the cursor tool. :^)
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			631 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			631 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include "Tool.h"
 | |
| #include <AK/HashMap.h>
 | |
| #include <LibDraw/Point.h>
 | |
| 
 | |
| class GWidget;
 | |
| 
 | |
| class CursorTool final : public Tool {
 | |
| public:
 | |
|     explicit CursorTool(FormEditorWidget& editor)
 | |
|         : Tool(editor)
 | |
|     {
 | |
|     }
 | |
|     virtual ~CursorTool() override {}
 | |
| 
 | |
| private:
 | |
|     virtual const char* class_name() const override { return "CursorTool"; }
 | |
|     virtual void on_mousedown(GMouseEvent&) override;
 | |
|     virtual void on_mouseup(GMouseEvent&) override;
 | |
|     virtual void on_mousemove(GMouseEvent&) override;
 | |
| 
 | |
|     Point m_drag_origin;
 | |
|     HashMap<GWidget*, Point> m_positions_before_drag;
 | |
|     bool m_dragging { false };
 | |
| };
 |