1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

ProcessManager: Start working on a graphical process manager.

I need a table view widget for this thing, so I'm also using this to
prototype a model/view thingy.
This commit is contained in:
Andreas Kling 2019-02-28 01:43:50 +01:00
parent dda9b9ab1b
commit 166aadc4e1
14 changed files with 467 additions and 1 deletions

19
LibGUI/GModelIndex.h Normal file
View file

@ -0,0 +1,19 @@
#pragma once
class GModelIndex {
public:
GModelIndex() { }
GModelIndex(int row, int column)
: m_row(row)
, m_column(column)
{
}
bool is_valid() const { return m_row != -1 && m_column != -1; }
int row() const { return m_row; }
int column() const { return m_column; }
private:
int m_row { -1 };
int m_column { -1 };
};

20
LibGUI/GTableModel.h Normal file
View file

@ -0,0 +1,20 @@
#pragma once
#include <AK/AKString.h>
#include <LibGUI/GModelIndex.h>
class GTableModel {
public:
GTableModel() { }
virtual ~GTableModel() { }
virtual int row_count() const = 0;
virtual int column_count() const = 0;
virtual String row_name(int) const { return { }; }
virtual String column_name(int) const { return { }; }
virtual int column_width(int) const { return 0; }
virtual String data(int row, int column) const = 0;
virtual void set_selected_index(GModelIndex) { }
virtual GModelIndex selected_index() const { return GModelIndex(); }
virtual void update() = 0;
};