
This way it can be used by hit testing as well, guaranteeing that everything stays consistent.
33 lines
954 B
C++
33 lines
954 B
C++
#pragma once
|
|
|
|
#include <LibGUI/GAbstractView.h>
|
|
|
|
class GTreeView : public GAbstractView {
|
|
public:
|
|
explicit GTreeView(GWidget*);
|
|
virtual ~GTreeView() override;
|
|
|
|
virtual const char* class_name() const override { return "GTreeView"; }
|
|
|
|
GModelIndex index_at_content_position(const Point&) const;
|
|
|
|
protected:
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
virtual void mousedown_event(GMouseEvent&) override;
|
|
|
|
private:
|
|
int item_height() const { return 16; }
|
|
int max_item_width() const { return frame_inner_rect().width(); }
|
|
int indent_width_in_pixels() const { return 12; }
|
|
int icon_size() const { return 16; }
|
|
int icon_spacing() const { return 4; }
|
|
|
|
template<typename Callback>
|
|
void traverse_in_paint_order(Callback) const;
|
|
|
|
struct MetadataForIndex;
|
|
|
|
MetadataForIndex& ensure_metadata_for_index(const GModelIndex&) const;
|
|
|
|
mutable HashMap<void*, OwnPtr<MetadataForIndex>> m_view_metadata;
|
|
};
|