mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:47:35 +00:00
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.
This commit is contained in:
parent
5707d7f547
commit
19fa70c821
16 changed files with 361 additions and 47 deletions
|
@ -1,13 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGUI/GTableView.h>
|
||||
#include <LibGUI/GItemView.h>
|
||||
#include <LibGUI/GStackWidget.h>
|
||||
#include <sys/stat.h>
|
||||
#include "DirectoryModel.h"
|
||||
|
||||
class DirectoryTableView final : public GTableView {
|
||||
class DirectoryView final : public GStackWidget {
|
||||
public:
|
||||
explicit DirectoryTableView(GWidget* parent);
|
||||
virtual ~DirectoryTableView() override;
|
||||
explicit DirectoryView(GWidget* parent);
|
||||
virtual ~DirectoryView() override;
|
||||
|
||||
void open(const String& path);
|
||||
String path() const { return model().path(); }
|
||||
|
@ -18,13 +20,20 @@ public:
|
|||
Function<void(const String&)> on_path_change;
|
||||
Function<void(String)> on_status_message;
|
||||
|
||||
private:
|
||||
virtual void model_notification(const GModelNotification&) override;
|
||||
enum ViewMode { Invalid, List, Icon };
|
||||
void set_view_mode(ViewMode);
|
||||
ViewMode view_mode() const { return m_view_mode; }
|
||||
|
||||
private:
|
||||
DirectoryModel& model() { return *m_model; }
|
||||
const DirectoryModel& model() const { return *m_model; }
|
||||
|
||||
void set_status_message(const String&);
|
||||
|
||||
ViewMode m_view_mode { Invalid };
|
||||
|
||||
Retained<DirectoryModel> m_model;
|
||||
|
||||
GTableView* m_table_view { nullptr };
|
||||
GItemView* m_item_view { nullptr };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue