mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:35:07 +00:00
HackStudio: Show the edited form widget's widget tree in the tree view
This patch introduces a simple WidgetTreeModel that models the widget tree inside of a given root GWidget.
This commit is contained in:
parent
524da0ad01
commit
d5f735ecec
7 changed files with 121 additions and 1 deletions
23
DevTools/HackStudio/WidgetTreeModel.h
Normal file
23
DevTools/HackStudio/WidgetTreeModel.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#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;
|
||||
|
||||
private:
|
||||
explicit WidgetTreeModel(GWidget&);
|
||||
|
||||
NonnullRefPtr<GWidget> m_root;
|
||||
GIcon m_widget_icon;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue