ladybird/LibGUI/GAbstractView.h
Andreas Kling 19fa70c821 LibGUI: Add a GItemView class.
This is a GAbstractView subclass that implements a icon-based view onto
a GModel. It still need a bunch of work, but it's in basic usable shape.
2019-03-23 03:54:45 +01:00

32 lines
852 B
C++

#pragma once
#include <LibGUI/GModel.h>
#include <LibGUI/GScrollableWidget.h>
#include <AK/Function.h>
class GAbstractView : public GScrollableWidget {
friend class GModel;
public:
explicit GAbstractView(GWidget* parent);
virtual ~GAbstractView() override;
void set_model(RetainPtr<GModel>&&);
GModel* model() { return m_model.ptr(); }
const GModel* model() const { return m_model.ptr(); }
void scroll_into_view(const GModelIndex&, Orientation);
virtual bool accepts_focus() const override { return true; }
virtual void did_update_model();
Function<void(const GModelNotification&)> on_model_notification;
virtual const char* class_name() const override { return "GAbstractView"; }
protected:
virtual void model_notification(const GModelNotification&);
private:
RetainPtr<GModel> m_model;
};