mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:22:43 +00:00 
			
		
		
		
	 2fea238675
			
		
	
	
		2fea238675
		
	
	
	
	
		
			
			You can now manipulate the widget selection either by clicking and dragging the widgets using the cursor tool, or by interacting with the form widget tree view. :^)
		
			
				
	
	
		
			25 lines
		
	
	
	
		
			904 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
	
		
			904 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <LibGUI/GModel.h>
 | |
| #include <LibGUI/GPainter.h>
 | |
| 
 | |
| class WidgetTreeModel final : public GModel {
 | |
| public:
 | |
|     static NonnullRefPtr<WidgetTreeModel> create(GWidget& root) { return adopt(*new WidgetTreeModel(root)); }
 | |
|     virtual ~WidgetTreeModel() override;
 | |
| 
 | |
|     virtual int row_count(const GModelIndex& = GModelIndex()) const override;
 | |
|     virtual int column_count(const GModelIndex& = GModelIndex()) const override;
 | |
|     virtual GVariant data(const GModelIndex&, Role = Role::Display) const override;
 | |
|     virtual GModelIndex index(int row, int column, const GModelIndex& parent = GModelIndex()) const override;
 | |
|     virtual GModelIndex parent_index(const GModelIndex&) const override;
 | |
|     virtual void update() override;
 | |
| 
 | |
|     GModelIndex index_for_widget(GWidget&) const;
 | |
| 
 | |
| private:
 | |
|     explicit WidgetTreeModel(GWidget&);
 | |
| 
 | |
|     NonnullRefPtr<GWidget> m_root;
 | |
|     GIcon m_widget_icon;
 | |
| };
 |